-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
HTTP/2 server compatibility API ignores sendDate #34841
Comments
If you're not already working on it, I would like to try my hand at this @pimterry :) |
No @joaolucasl I'm not! If you want to take a look at this that sounds great, feel free 👍 |
joaolucasl
added a commit
to joaolucasl/node
that referenced
this issue
Aug 20, 2020
The `sendDate` flag was not being respected by the current implementation and the `Date` header was being sent regardless of the config. This commit fixes that and adds tests for this case. Fixes: nodejs#34841
3 tasks
BethGriggs
pushed a commit
that referenced
this issue
Aug 24, 2020
The `sendDate` flag was not being respected by the current implementation and the `Date` header was being sent regardless of the config. This commit fixes that and adds tests for this case. Fixes: #34841 PR-URL: #34850 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
addaleax
pushed a commit
that referenced
this issue
Sep 22, 2020
The `sendDate` flag was not being respected by the current implementation and the `Date` header was being sent regardless of the config. This commit fixes that and adds tests for this case. Fixes: #34841 PR-URL: #34850 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What steps will reproduce the bug?
Run this:
It prints:
How often does it reproduce? Is there a required condition?
Always reproduces.
What is the expected behavior?
When
response.sendDate
is set tofalse
, no date header should be included in the response.What do you see instead?
This works fine for HTTP/1 servers, but as visible in the output above, HTTP/2 servers send the date header in the response regardless.
This is inconsistent with HTTP/1, and this behaviour is explicitly documented as working for the HTTP/2 API too.
For context: I'm using these HTTP/2 APIs to mock services and test HTTP/2 client behaviour, so I'd like to be able to fully control the HTTP headers that are returned in the response. With HTTP/1 that's easy to do, by using sendDate or by manually removing headers e.g. with
res.removeHeader('content-length')
. That's explicitly supported by the code, which watches for removed default headers and ensures they're not reinserted:node/lib/_http_outgoing.js
Lines 604 to 631 in 849d9e7
In HTTP/2 the Date header is the only remaining default header (ignoring pseudo headers), but neither
sendDate = false
norremoveHeader('date')
do anything, so there doesn't seem to be any way to disable it.The text was updated successfully, but these errors were encountered: