Skip to content
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

How to get the "Date" set on a response header for HTTP2? #30894

Closed
niftylettuce opened this issue Dec 11, 2019 · 7 comments
Closed

How to get the "Date" set on a response header for HTTP2? #30894

niftylettuce opened this issue Dec 11, 2019 · 7 comments
Labels
doc Issues and PRs related to the documentations. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. http2 Issues or PRs related to the http2 subsystem.

Comments

@niftylettuce
Copy link

Ref: #28302

@niftylettuce niftylettuce changed the title Undocumented breaking + core change to http's res._header: The value is set to true (Boolean) instead of the raw headers (String) as in earlier versions of Node Node v12.10.0 - Undocumented breaking + core change to http's res._header: The value is set to true (Boolean) instead of the raw headers (String) as in earlier versions of Node Dec 11, 2019
@niftylettuce
Copy link
Author

I think this is due to HTTP2 vs HTTP1. Can someone help clarify this? For HTTP2: how to get raw headers is my question?

@niftylettuce
Copy link
Author

After digging I discovered HTTP1 has a String returned for res._header and HTTP2 has a Boolean returned for res._header

// User land modules such as finalhandler just check truthiness of this
// but if someone is actually trying to use this for more than that
// then we simply can't support such use cases
get _header() {
return this.headersSent;
}
.

@niftylettuce niftylettuce changed the title Node v12.10.0 - Undocumented breaking + core change to http's res._header: The value is set to true (Boolean) instead of the raw headers (String) as in earlier versions of Node Node v12.x+ Undocumented Breaking Change = No way to get the "Date" set on a response header for HTTP2 Dec 11, 2019
@niftylettuce niftylettuce changed the title Node v12.x+ Undocumented Breaking Change = No way to get the "Date" set on a response header for HTTP2 How to get the "Date" set on a response header for HTTP2? Dec 11, 2019
niftylettuce added a commit to cabinjs/cabin that referenced this issue Dec 11, 2019
@ZYSzys ZYSzys added the http2 Issues or PRs related to the http2 subsystem. label Dec 11, 2019
@ZYSzys
Copy link
Member

ZYSzys commented Dec 11, 2019

For HTTP2: how to get raw headers is my question?

So use res.getHeaders() ?

getHeaders() {
return { ...this[kHeaders] };
}

AFAIK, I think we shouldn't rely on a "private" property that could change in value over time for various reasons.

@niftylettuce
Copy link
Author

niftylettuce commented Dec 11, 2019 via email

@BridgeAR BridgeAR added doc Issues and PRs related to the documentations. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. labels Dec 20, 2019
@niftylettuce
Copy link
Author

niftylettuce commented Dec 27, 2019

Could we have someone look at this on the core team? I would gladly donate.

@rexagod
Copy link
Member

rexagod commented Apr 28, 2020

@niftylettuce I think the commit below should fix this. I'll open a PR soon.

Refer: rexagod@8604411

rexagod added a commit to rexagod/node that referenced this issue Apr 30, 2020
codebytere pushed a commit that referenced this issue Jun 18, 2020
Fixes: #30894
Refs: #29829

PR-URL: #33160
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@niftylettuce
Copy link
Author

@addaleax any chance this could get backported to v12 before next weeks release (that also fixes the core Chrome HTTP/2 XHR issue at #33875)? cc @BridgeAR @rexagod @codebytere

Ref: https://www.theregister.com/2020/08/18/nodejs_chromium_patch/

addaleax pushed a commit that referenced this issue Sep 22, 2020
Fixes: #30894
Refs: #29829

PR-URL: #33160
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants