hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 265 forks source link

Add option to disable connection preface #767

Closed Alvenix closed 2 months ago

Alvenix commented 2 months ago

Edit: I think it is better to handle this in curl side, by using a single clientconn.

Curl disabled http/2 support, as they used to make clientconn for each request. The problem is that requires resending the HTTP/2 connection preface. Perhaps adding such feature may make it easier to support HTTP/2 in curl

If adding this option is acceptable, I will try to work on a PR.

This is described in details here.

Quoted:

The current design of the Hyper integration requires rebuilding the Hyper clientconn for each request. However, building the clientconn requires resending the HTTP/2 connection preface, which is incorrect from a protocol perspective. That in turn causes servers to send GOAWAY frames, effectively degrading performance to "no connection reuse" in the best case. It may also be triggering some bugs where requests get dropped entirely and reconnects take too long.

This doesn't rule out HTTP/2 support with Hyper, but it may take a redesign of the Hyper integration in order to make things work.