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

http: reset stream to unconsumed in unconsume() #14410

Closed
wants to merge 2 commits into from

Conversation

addaleax
Copy link
Member

Reset the underlying socket of an HTTP stream to be marked as
unconsume after the HTTP parser no longer owns it.

Fixes: #14407

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

http

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. http_parser Issues and PRs related to the HTTP Parser dependency or the http_parser binding. labels Jul 21, 2017
@@ -0,0 +1,26 @@
'use strict';
const common = require('../common');
const tls = require('tls');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the hasCrypto skip check.

Copy link
Member Author

Choose a reason for hiding this comment

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

@cjihrig Thanks for pointing that out, done

Reset the underlying socket of an HTTP stream to be marked as
unconsume after the HTTP parser no longer owns it.

Fixes: nodejs#14407
}));

server.listen(0, common.mustCall(() => {
http.request({
Copy link
Member

Choose a reason for hiding this comment

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

Nit (feel free to ignore): http.get()? so we can remove .end().

Copy link
Member Author

Choose a reason for hiding this comment

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

@lpinca done

http.get({
port: server.address().port,
headers: {
'Connection': 'Upgrade',
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Even though we agreed not to lint quote-props in #14059, most people seem to prefer as-needed, so I would probably drop the quotes here. It's up to you :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the quotes for map-like objects :)

@addaleax
Copy link
Member Author

@addaleax
Copy link
Member Author

Landed in 29353e5

@addaleax addaleax closed this Jul 26, 2017
@addaleax addaleax deleted the http-parser-unconsume branch July 26, 2017 18:09
addaleax added a commit that referenced this pull request Jul 26, 2017
Reset the underlying socket of an HTTP stream to be marked as
unconsume after the HTTP parser no longer owns it.

Fixes: #14407
PR-URL: #14410
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
addaleax added a commit that referenced this pull request Jul 27, 2017
Reset the underlying socket of an HTTP stream to be marked as
unconsume after the HTTP parser no longer owns it.

Fixes: #14407
PR-URL: #14410
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@addaleax addaleax mentioned this pull request Aug 2, 2017
@MylesBorins
Copy link
Contributor

Should this be backported? It lands cleanly

@MylesBorins
Copy link
Contributor

ping @nodejs/streams

@mcollina
Copy link
Member

@MylesBorins 👍 for me.

MylesBorins pushed a commit that referenced this pull request Sep 19, 2017
Reset the underlying socket of an HTTP stream to be marked as
unconsume after the HTTP parser no longer owns it.

Fixes: #14407
PR-URL: #14410
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. http_parser Issues and PRs related to the HTTP Parser dependency or the http_parser binding.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants