summaryrefslogtreecommitdiff
path: root/lib/_http_common.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2016-12-31 16:18:43 -0500
committerBrian White <mscdex@mscdex.net>2017-01-11 12:54:31 -0500
commitc00e4adbb4c6dd5bfbf22a3efcecb63c56958339 (patch)
treeb18dc321b81c4c054471c577f665f2f27352dd36 /lib/_http_common.js
parentec8910bcea8d57a1faf07202364cb4f3eee769ac (diff)
downloadnode-new-c00e4adbb4c6dd5bfbf22a3efcecb63c56958339.tar.gz
http: optimize header storage and matching
This commit implements two optimizations when working with headers: * Avoid having to explicitly "render" headers and separately store the original casing for header names. * Match special header names using a single regular expression instead of testing one regular expression per header name. PR-URL: https://github.com/nodejs/node/pull/10558 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'lib/_http_common.js')
-rw-r--r--lib/_http_common.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/_http_common.js b/lib/_http_common.js
index 2ce523fe62..f585d97d7b 100644
--- a/lib/_http_common.js
+++ b/lib/_http_common.js
@@ -14,8 +14,8 @@ const debug = require('util').debuglog('http');
exports.debug = debug;
exports.CRLF = '\r\n';
-exports.chunkExpression = /chunk/i;
-exports.continueExpression = /100-continue/i;
+exports.chunkExpression = /(?:^|\W)chunked(?:$|\W)/i;
+exports.continueExpression = /(?:^|\W)100-continue(?:$|\W)/i;
exports.methods = methods;
const kOnHeaders = HTTPParser.kOnHeaders | 0;