diff options
author | Alex Kocharin <alex@kocharin.ru> | 2014-01-06 11:59:40 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2014-01-13 17:29:58 +0000 |
commit | ec57ecc982df6d4677fc5a347738201effeae5d1 (patch) | |
tree | 2fb9996900852da74e33bb8ebd21bf9adc35a4b6 /lib/_http_incoming.js | |
parent | 38a07a929bb551451b21513ce6262f416651d12b (diff) | |
download | android-node-v8-ec57ecc982df6d4677fc5a347738201effeae5d1.tar.gz android-node-v8-ec57ecc982df6d4677fc5a347738201effeae5d1.tar.bz2 android-node-v8-ec57ecc982df6d4677fc5a347738201effeae5d1.zip |
http: concatenate duplicate headers by default
Diffstat (limited to 'lib/_http_incoming.js')
-rw-r--r-- | lib/_http_incoming.js | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 650b054926..a8788c5fbd 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -154,40 +154,32 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) { } break; - // Comma separate. Maybe make these arrays? - case 'accept': - case 'accept-charset': - case 'accept-encoding': - case 'accept-language': - case 'connection': - case 'cookie': - case 'pragma': - case 'link': - case 'www-authenticate': - case 'proxy-authenticate': - case 'sec-websocket-extensions': - case 'sec-websocket-protocol': - if (!util.isUndefined(dest[field])) { - dest[field] += ', ' + value; - } else { + // list is taken from: + // https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp + case 'content-type': + case 'content-length': + case 'user-agent': + case 'referer': + case 'host': + case 'authorization': + case 'proxy-authorization': + case 'if-modified-since': + case 'if-unmodified-since': + case 'from': + case 'location': + case 'max-forwards': + // drop duplicates + if (util.isUndefined(dest[field])) dest[field] = value; - } break; - default: - if (field.slice(0, 2) == 'x-') { - // except for x- - if (!util.isUndefined(dest[field])) { - dest[field] += ', ' + value; - } else { - dest[field] = value; - } - } else { - // drop duplicates - if (util.isUndefined(dest[field])) dest[field] = value; + // make comma-separated list + if (!util.isUndefined(dest[field])) + dest[field] += ', ' + value; + else { + dest[field] = value; } - break; } }; |