Skip to content

http2: emit response event instead of trailers event - #41405

Closed
MoonBall wants to merge 1 commit into
nodejs:mainfrom
MoonBall:fix-http2-response
Closed

http2: emit response event instead of trailers event#41405
MoonBall wants to merge 1 commit into
nodejs:mainfrom
MoonBall:fix-http2-response

Conversation

@MoonBall

Copy link
Copy Markdown
Member

Fix#41251.

Should emit response event if cat == NGHTTP2_HCAT_HEADERS and status >= 200.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-botnodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Jan 5, 2022

@apapirovskiapapirovski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice find. And actually makes sense after reading the nghttp2 docs https://nghttp2.org/documentation/enums.html#c.nghttp2_headers_category

@szmarczak

Copy link
Copy Markdown
Member

The naming is very confusing. HTTP/2 states that those are trailers (since HEADERS are sent with an END_STREAM flag), nghttp2 defines NGHTTP2_HCAT_RESPONSE (informational) + NGHTTP2_HCAT_HEADERS (final) and Node.js would emit response (however it also has a trailers event).

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina

Copy link
Copy Markdown
Member

The naming is very confusing. HTTP/2 states that those are trailers (since HEADERS are sent with an END_STREAM flag), nghttp2 defines NGHTTP2_HCAT_RESPONSE (informational) + NGHTTP2_HCAT_HEADERS (final) and Node.js would emit response (however it also has a trailers event).

Is this an objection? How would you like this PR to be changed?

@szmarczak

Copy link
Copy Markdown
Member

In the Examples section of RFC7540:

 HTTP/1.1 100 Continue HEADERS
Extension-Field: bar ==> - END_STREAM
+ END_HEADERS
:status = 100
extension-field = bar
HTTP/1.1 200 OK HEADERS
Content-Type: image/jpeg ==> - END_STREAM
Transfer-Encoding: chunked + END_HEADERS
Trailer: Foo :status = 200
content-length = 123
123 content-type = image/jpeg
{binary data} trailer = Foo
0
Foo: bar DATA
- END_STREAM
{binary data}
HEADERS
+ END_STREAM
+ END_HEADERS
foo = bar

in this instance there are three HEADERS frames. I think it would make sense to have an information event, like in HTTP/1 API. What do you think?

@aduh95

Copy link
Copy Markdown
Contributor

This needs a rebase.

@aduh95

Copy link
Copy Markdown
Contributor

This still needs a rebase :)

@aduh95

Copy link
Copy Markdown
Contributor

Superseded by #41739

@aduh95aduh95 closed this May 11, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http2Issues or PRs related to the http2 subsystem.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http2: trailers or response to be emitted?

7 participants

@MoonBall@nodejs-github-bot@szmarczak@mcollina@aduh95@apapirovski@jasnell