-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Http2 reverses order of headers starting with ":" prefix #38797
Comments
HTTP/2 assigns no significance to the ordering of pseudo-header fields beyond requiring that they appear before the other headers. |
That's a good point @jasnell. It doesn't violate the spec. I just found it to be unexpected behavior that all other http request functions in nodejs maintain the order you send them in. In http2, node will tell you the "headers sent" match the ones you send in, but if you look in wireshark, something different is sent. It seems unintentional - simply a byproduct of the header sorting that's happening. It seems like a minor change to create a second string for prefixed headers that's "appended", and then just concatenating with the rest of the headers to return. |
Keep prefixed headers order same as sent order Fixes: nodejs#38797
Keep prefixed headers order same as sent order Fixes: nodejs#38797
Keep pseudo-headers order same as sent order Fixes: nodejs#38797
Keep pseudo-headers order same as sent order Fixes: nodejs#38797 PR-URL: nodejs#41735 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Keep pseudo-headers order same as sent order Fixes: nodejs#38797 PR-URL: nodejs#41735 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Everytime
What is the expected behavior?
Header order matching provided headers
What do you see instead?
Headers are reversed
Additional information
NodeJs is following the spec to insert special http2 headers in the front of the list, but since it traverses headers in order and prepends each one, the prefixed headers will be reversed:
node/lib/internal/http2/util.js
Line 521 in e46c680
The text was updated successfully, but these errors were encountered: