New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
curl not functioning properly after updating to libnghttp2 1.49.0
#1786
Comments
|
The web site returns malformed header field whose value ends with a white space. It is explicitly marked malformed by RFC 9113. RFC 9113 is a new revision of RFC 7445 HTTP/2. It says client must not accept malformed response. Historically, nghttp2 follows RFC and treats this as a stream error. Application which needs accept such malformed header fields can specify nghttp2_on_invalid_header_callback2. |
|
It seems a bit strict since the browsers don't fault on those headers so they will be used and this will only punish users of nghttp2... |
|
Interesting. Hmm, I assume that will affect my proxy module as well. |
|
Further: as this most certainly is going to happen to more (curl) users very soon: is there a way we can figure out (and report) that this happened because of trailing space in a header field? |
|
I like the checks by nghttp2. When registering the callback hook, I will basically no longer use them as I am forced to have my own validation code run. I mean, we have header validation code in the server for the http/1.1 parts. I just have to make sure that nothing falls between the cracks when I switch... |
|
If a browser-like behavior is needed, just returning 0 from nghttp2_on_invalid_header_callback2 would make most people happy. We have no indication of which validation failed for the particular header field, so you can check the existence of trailing spaces in header field value, but there are other errors in name or value. |
|
Just to confirm my understanding of the nghttp2 code: returning 0 from a registered callback makes the header disappear without error. But there is no way that a header with trailing spaces might be accepted (other than the application passing it internally). |
|
Yes. If you really want to treat trailing white spaces specially, you need to run some kind of validation by yourself. Note that https://datatracker.ietf.org/doc/html/rfc9113#section-8.1.1 The RFC authors know this is deliberately strict. |
|
RFC authors also don't have users breathing down their neck... |
|
That's what we get when we use a library from someone who follows standards. |
|
The code paths that lead to invalid header callback are quite limited.
'host' header field adds some complexity because it is validated by nghttp2_check_authority instead of nghttp2_check_header_value_rfc9113 if it is in request or PUSH_PROMISE. In on_invalid_header_callback, return error if nghttp2_check_header_name returns 0. And if you get host header field, then return error. |
|
Alright, I will write HTTP/4 library without reading RFC. |
|
This is very informative. Appreciate everyone's input here and glad to know this is deliberate and not a bug. |
|
A lot of Wordpress/Automattic website are returning EDIT: same thing on https://data.opendatasoft.com/pages/home/ (contacted using https://hello.opendatasoft.com/contact) |
Originally found in Homebrew/homebrew-core#108833
After upgrading to
libnghttp21.49.0 I am not able to utilizecurlwithout the errorHTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1).Same command using the macOS system
curl(truncated for relevancy):The text was updated successfully, but these errors were encountered: