Closed dancek closed 1 year ago
If this sounds reasonable I could make a PR.
Thanks for raising this. Could you please maybe do a draft PR with a failing test reproducing the issue first?
I'm still planning to do this but I've been a bit too busy with other coding. I'll try to find time tomorrow.
Now that I tried writing a proper test case and experimented with a couple of different HTTP servers, I realize the server I was connecting to was misbehaving. Since the Upgrade: h2c
mechanism always actually starts with HTTP/1.1, any server that doesn't support HTTP/2 won't be upgraded and there's no issue. In my case I guess the server does upgrade to HTTP/2 but then fails to process the request for one reason or another.
Sorry for the misdiagnosis! I'll be closing this issue.
I'll still make a tiny PR to fix a currently failing unit test.
For plain-http (non-TLS) requests to a server only supporting HTTP/1.1, hato.client seems to default to HTTP/2 but fail to fallback, yielding a HTTP 400 response that's hard to debug.
This may be specific to the server, but at a glance it seems like the fallback mechanism probably uses ALPN which requires TLS.
Since basically nobody does unencrypted HTTP/2, maybe the default for unencrypted connections should be HTTP/1.1?