hyperium / h2

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

Feat: Add a feature flag to ignore connection headers #705

Open eaufavor opened 1 year ago

eaufavor commented 1 year ago

According to the RFC, when encountering connection headers, H2 should treat them as protocol errors. However, in reality there are servers just setting these headers but only for informational purpose.

This feature allow the receiving end to just ignore these headers without bailing the entire stream.

I'm just putting this out here to see whether it is possible for things like this to be accepted.

seanmonstar commented 1 year ago

Are there any other widely used implementations that support this? I initially think the pressure should instead be pushed back onto those servers to change, since weakening the implementations is how HTTP/1.1 got to have so many edge cases.

eaufavor commented 1 year ago

Good question. I've test a few user agents: The server: nginx conf

location /test_h2_header/ {
   add_header connection "keep-alive";
   return 200 "hello"
}

https://origin.eaufavor.net/test_h2_header/

I have not yet tested other connection headers.

nox commented 1 year ago

Why is "CI / Check MSRV (pull_request)" failing?

eaufavor commented 1 year ago

This https://github.com/hyperium/h2/pull/708?

nox commented 1 year ago

Ah, could you rebase then?