From 9a998d5e244dc58a1f7650e574371e0d4c75fcc1 Mon Sep 17 00:00:00 2001 From: Simon Sturmer Date: Fri, 1 Jun 2012 17:33:19 +1000 Subject: [PATCH] http: don't lowercase http req header until later Don't lowercase the request header until we're in the _addHeaderLine method, makes it easier to intercept the raw request headers. --- lib/http.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/http.js b/lib/http.js index 42d72bcb1cf..92e00049a26 100644 --- a/lib/http.js +++ b/lib/http.js @@ -87,7 +87,7 @@ function parserOnHeadersComplete(info) { for (var i = 0; i < n; i += 2) { var k = headers[i]; var v = headers[i + 1]; - parser.incoming._addHeaderLine(k.toLowerCase(), v); + parser.incoming._addHeaderLine(k, v); } @@ -134,7 +134,7 @@ function parserOnMessageComplete() { for (var i = 0, n = headers.length; i < n; i += 2) { var k = headers[i]; var v = headers[i + 1]; - parser.incoming._addHeaderLine(k.toLowerCase(), v); + parser.incoming._addHeaderLine(k, v); } parser._headers = []; parser._url = ''; @@ -380,6 +380,7 @@ IncomingMessage.prototype._emitEnd = function() { IncomingMessage.prototype._addHeaderLine = function(field, value) { var dest = this.complete ? this.trailers : this.headers; + field = field.toLowerCase(); switch (field) { // Array headers: case 'set-cookie':