httpcore
httpcore copied to clipboard
prioritize h2
Summary
When using h2 give it priority in tls alpn. In general order of tls alpn is important and servers mostly choose the first version that they support, by setting http1.1 first most server will actually negotiate http1.1
Also don't specify http1.1 if only h2 is enabled. This could otherwise lead to negotiating something that is not supported, which was especially bad when the wrong order was used.
Found this actually when forcing httpcore to use h2 only and then wireshark failing to decode traffic because tls negotiated http1.1 but we were actually using h2
Checklist
- [x] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
- [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- [x] I've updated the documentation accordingly.