Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f6969a1

Browse filesBrowse files
indutnyMylesBorins
authored andcommitted
http: skip body and next message of CONNECT res
When handling a response to `CONNECT` request - skip message body and do not attempt to parse the next message. `CONNECT` requests are used in similar sense to HTTP Upgrade. Fix: #6198 PR-URL: #6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent b7dd451 commit f6969a1
Copy full SHA for f6969a1

File tree

Expand file treeCollapse file tree

3 files changed

+7
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-4
lines changed
Open diff view settings
Collapse file

‎lib/_http_client.js‎

Copy file name to clipboardExpand all lines: lib/_http_client.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
432432
// Responses to CONNECT request is handled as Upgrade.
433433
if (req.method === 'CONNECT') {
434434
res.upgrade = true;
435-
return true; // skip body
435+
return 2; // skip body, and the rest
436436
}
437437

438438
// Responses to HEAD requests are crazy.
Collapse file

‎lib/_http_common.js‎

Copy file name to clipboardExpand all lines: lib/_http_common.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method,
9494

9595
parser.incoming.upgrade = upgrade;
9696

97-
var skipBody = false; // response to HEAD or CONNECT
97+
var skipBody = 0; // response to HEAD or CONNECT
9898

9999
if (!upgrade) {
100100
// For upgraded connections and CONNECT method request, we'll emit this
@@ -103,7 +103,10 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method,
103103
skipBody = parser.onIncoming(parser.incoming, shouldKeepAlive);
104104
}
105105

106-
return skipBody;
106+
if (typeof skipBody !== 'number')
107+
return skipBody ? 1 : 0;
108+
else
109+
return skipBody;
107110
}
108111

109112
// XXX This is a mess.
Collapse file

‎src/node_http_parser.cc‎

Copy file name to clipboardExpand all lines: src/node_http_parser.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class Parser : public AsyncWrap {
300300
return -1;
301301
}
302302

303-
return head_response->IsTrue() ? 1 : 0;
303+
return head_response->IntegerValue();
304304
}
305305

306306

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.