-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
http: setEncoding error for incoming socket connections #19344
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 all commits
a7e2aab
345ff3c
4643c63
f3c429c
3613e8d
190ef7e
06a34eb
cd2c3ce
a8c605e
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 |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ const { | |
| const { IncomingMessage } = require('_http_incoming'); | ||
| const { | ||
| ERR_HTTP_HEADERS_SENT, | ||
| ERR_HTTP_INCOMING_SOCKET_ENCODING, | ||
| ERR_HTTP_INVALID_STATUS_CODE, | ||
| ERR_INVALID_CHAR | ||
| } = require('internal/errors').codes; | ||
|
|
@@ -380,6 +381,7 @@ function connectionListenerInternal(server, socket) { | |
|
|
||
| // Override on to unconsume on `data`, `readable` listeners | ||
| socket.on = socketOnWrap; | ||
| socket.setEncoding = socketSetEncoding; | ||
|
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. nit: either a comment or a new line here would be nice, since this line isn't related to // Override on to unconsume on `data`, `readable` listeners
Contributor
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. I agree, because I didn't see that done in |
||
|
|
||
| // We only consume the socket if it has never been consumed before. | ||
| if (socket._handle) { | ||
|
|
@@ -694,6 +696,10 @@ function onSocketPause() { | |
| } | ||
| } | ||
|
|
||
| function socketSetEncoding() { | ||
| throw new ERR_HTTP_INCOMING_SOCKET_ENCODING('setEncoding'); | ||
|
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. There is no dynamic argument in this error, so there is no need to pass through any arguments. |
||
| } | ||
|
|
||
| function unconsume(parser, socket) { | ||
| if (socket._handle) { | ||
| if (parser._consumed) | ||
|
|
||
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.
The added new line has to be removed again.