-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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: add rawPacket in err of clientError
event
#17672
Changes from 2 commits
e9eb792
5e1369f
0e73e2c
9758fb1
008e5a8
7fb6c62
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 |
---|---|---|
|
@@ -765,6 +765,11 @@ object, so any HTTP response sent, including response headers and payload, | |
*must* be written directly to the `socket` object. Care must be taken to | ||
ensure the response is a properly formatted HTTP response message. | ||
|
||
`err` is an instance of `Error` with two extra columns: | ||
|
||
+ `bytesParsed`: the bytes count of request packet that Node.js may have parsed correctly; | ||
+ `rawPacket`: the raw packet of current request. | ||
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. Sorry, one thing I forgot to mention: Can you list the addition of 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. done |
||
|
||
### Event: 'close' | ||
<!-- YAML | ||
added: v0.1.4 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -475,7 +475,11 @@ function socketOnError(e) { | |
function onParserExecuteCommon(server, socket, parser, state, ret, d) { | ||
resetSocketTimeout(server, socket, state); | ||
|
||
if (!d) | ||
d = parser.getCurrentBuffer(); | ||
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. Can you move this into the branches of the if statement? 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. But if we don't get the buffer, we cannot pass it to the |
||
|
||
if (ret instanceof Error) { | ||
ret.rawPacket = d; | ||
debug('parse error', ret); | ||
socketOnError.call(socket, ret); | ||
} else if (parser.incoming && parser.incoming.upgrade) { | ||
|
@@ -484,9 +488,6 @@ function onParserExecuteCommon(server, socket, parser, state, ret, d) { | |
var req = parser.incoming; | ||
debug('SERVER upgrade or connect', req.method); | ||
|
||
if (!d) | ||
d = parser.getCurrentBuffer(); | ||
|
||
socket.removeListener('data', state.onData); | ||
socket.removeListener('end', state.onEnd); | ||
socket.removeListener('close', state.onClose); | ||
|
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.
Long line.