From 6141386f7eaedc66aafd39a5a842772e91b414af Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 15 Feb 2012 00:20:54 +0100 Subject: [PATCH] http: allow multiple WWW-Authenticate headers --- lib/http.js | 1 + test/simple/test-http-server-multiheaders.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/http.js b/lib/http.js index 34e84b6..02f631e 100644 --- a/lib/http.js +++ b/lib/http.js @@ -345,6 +345,7 @@ IncomingMessage.prototype._addHeaderLine = function(field, value) { case 'cookie': case 'pragma': case 'link': + case 'www-authenticate': if (field in dest) { dest[field] += ', ' + value; } else { diff --git a/test/simple/test-http-server-multiheaders.js b/test/simple/test-http-server-multiheaders.js index a2930f1..9917dd2 100644 --- a/test/simple/test-http-server-multiheaders.js +++ b/test/simple/test-http-server-multiheaders.js @@ -30,6 +30,7 @@ var http = require('http'); var srv = http.createServer(function(req, res) { assert.equal(req.headers.accept, 'abc, def, ghijklmnopqrst'); assert.equal(req.headers.host, 'foo'); + assert.equal(req.headers['www-authenticate'], 'foo, bar, baz'); assert.equal(req.headers['x-foo'], 'bingo'); assert.equal(req.headers['x-bar'], 'banjo, bango'); @@ -51,6 +52,9 @@ srv.listen(common.PORT, function() { ['host', 'foo'], ['Host', 'bar'], ['hOst', 'baz'], + ['www-authenticate', 'foo'], + ['WWW-Authenticate', 'bar'], + ['WWW-AUTHENTICATE', 'baz'], ['x-foo', 'bingo'], ['x-bar', 'banjo'], ['x-bar', 'bango'] -- 2.7.4