diff --git a/lib/_http_client.js b/lib/_http_client.js index bc294263c7f881..68eb125e0e10e9 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -432,7 +432,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) { // Responses to CONNECT request is handled as Upgrade. if (req.method === 'CONNECT') { res.upgrade = true; - return true; // skip body + return 2; // skip body, and the rest } // Responses to HEAD requests are crazy. diff --git a/lib/_http_common.js b/lib/_http_common.js index 7c9fac5c6b7671..583c5d610a5ed9 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -96,7 +96,7 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method, parser.incoming.upgrade = upgrade; - var skipBody = false; // response to HEAD or CONNECT + var skipBody = 0; // response to HEAD or CONNECT if (!upgrade) { // For upgraded connections and CONNECT method request, we'll emit this @@ -105,7 +105,10 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method, skipBody = parser.onIncoming(parser.incoming, shouldKeepAlive); } - return skipBody; + if (typeof skipBody !== 'number') + return skipBody ? 1 : 0; + else + return skipBody; } // XXX This is a mess. diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 7d30cfd99ee19b..d1a130d7eead04 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -300,7 +300,7 @@ class Parser : public AsyncWrap { return -1; } - return head_response->IsTrue() ? 1 : 0; + return head_response->IntegerValue(); }