Closed tykling closed 8 months ago
This is why dnspython sends http/1.1 first:
Here's the ALPN selection code (referenced above):
This is a client preference algorithm, but as noted in the issue description, it should be a server preference algorithm.
Quick summary to be sure this issue is correctly understood: when the nghttp2
DNS over HTTPS provider is used (default), if the client advertises support for HTTP/1.1
and HTTP/2
AND offers HTTP/1.1
before offering HTTP/2
, dnsdist
wrongly selects HTTP/1.1
. This is particularly bad because the nghttp2
provider doesn't actually support HTTP/1.1
, just enough to tell the client it should upgrade to HTTP/2
. The good news is that most DoH clients should in theory not offer HTTP/1.1
, or at the very least not before HTTP/2
.
Short description
dnsdist 1.9.0
pickshttp/1.1
overh2
when both are offered inalpn
, where1.8.3
picksh2
.Environment
dnspython==2.6.1
which useshttpx==0.26.0
which in turn useshttpcore==1.0.2
which always adds http/1.1 to alpn. The same client works with http/2 on dnsdist 1.8.3.Steps to reproduce
Expected behaviour
I expected
h2
to be usedActual behaviour
dnsdist
picks alpnhttp/1.1
and since that is not supported in 1.9.0 it returns an errorOther information
These pcaps illustrate the problem but because the ServerHello is partially encrypted the actual application_layer_protocol_negotiation extension is not readable: dnsdist 1.8.3 working dnsdist 1.9.0 failing
also:
And also section 3.2 of rfc7301 says:
In that case, the server SHOULD select the most highly preferred protocol that it supports and that is also advertised by the client.