-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
http: response should always emit close on finish #20043
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -328,15 +328,19 @@ function socketCloseListener() { | |
| // NOTE: It's important to get parser here, because it could be freed by | ||
| // the `socketOnData`. | ||
| var parser = socket.parser; | ||
| if (req.res && req.res.readable) { | ||
| // Socket closed before we emitted 'end' below. | ||
| if (!req.res.complete) req.res.emit('aborted'); | ||
| var res = req.res; | ||
| res.on('end', function() { | ||
| var res = req.res; | ||
| if (res) { | ||
| if (res.readable) { | ||
| // Socket closed before we emitted 'end' below. | ||
| res.emit('aborted'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, definitely not.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any edit required here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should have
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corrected in 8ffc3c7 |
||
| res.on('end', function() { | ||
| this.emit('close'); | ||
| }); | ||
| res.push(null); | ||
| } else { | ||
| res.emit('close'); | ||
| }); | ||
| res.push(null); | ||
| } else if (!req.res && !req.socket._hadError) { | ||
| } | ||
| } else if (!req.socket._hadError) { | ||
| // This socket error fired before we started to | ||
| // receive a response. The error needs to | ||
| // fire on the request. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consthere.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in 8ffc3c7