summaryrefslogtreecommitdiff
path: root/lib/_http_outgoing.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/_http_outgoing.js')
-rw-r--r--lib/_http_outgoing.js21
1 files changed, 5 insertions, 16 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js
index 8406c9cd8b..770e555d1e 100644
--- a/lib/_http_outgoing.js
+++ b/lib/_http_outgoing.js
@@ -52,7 +52,7 @@ const { utcDate } = internalHttp;
const kIsCorked = Symbol('isCorked');
-var RE_CONN_VALUES = /(?:^|\W)close|upgrade(?:$|\W)/ig;
+var RE_CONN_CLOSE = /(?:^|\W)close(?:$|\W)/i;
var RE_TE_CHUNKED = common.chunkExpression;
// isCookieField performs a case-insensitive comparison of a provided string
@@ -432,20 +432,6 @@ function storeHeader(self, state, key, value, validate) {
matchHeader(self, state, key, value);
}
-function matchConnValue(self, state, value) {
- var sawClose = false;
- var m = RE_CONN_VALUES.exec(value);
- while (m) {
- if (m[0].length === 5)
- sawClose = true;
- m = RE_CONN_VALUES.exec(value);
- }
- if (sawClose)
- self._last = true;
- else
- self.shouldKeepAlive = true;
-}
-
function matchHeader(self, state, field, value) {
if (field.length < 4 || field.length > 17)
return;
@@ -453,7 +439,10 @@ function matchHeader(self, state, field, value) {
switch (field) {
case 'connection':
state.connection = true;
- matchConnValue(self, state, value);
+ if (RE_CONN_CLOSE.test(value))
+ self._last = true;
+ else
+ self.shouldKeepAlive = true;
break;
case 'transfer-encoding':
state.te = true;