Browse Source

Add WebSocket RFC6455 multiheader fields to the http parser.

v0.8.7-release
einaros 13 years ago
committed by isaacs
parent
commit
83fd1c1de5
  1. 2
      lib/http.js
  2. 9
      test/simple/test-http-server-multiheaders.js

2
lib/http.js

@ -295,6 +295,8 @@ IncomingMessage.prototype._addHeaderLine = function(field, value) {
case 'pragma':
case 'link':
case 'www-authenticate':
case 'sec-websocket-extensions':
case 'sec-websocket-protocol':
if (field in dest) {
dest[field] += ', ' + value;
} else {

9
test/simple/test-http-server-multiheaders.js

@ -33,6 +33,8 @@ var srv = http.createServer(function(req, res) {
assert.equal(req.headers['www-authenticate'], 'foo, bar, baz');
assert.equal(req.headers['x-foo'], 'bingo');
assert.equal(req.headers['x-bar'], 'banjo, bango');
assert.equal(req.headers['sec-websocket-protocol'], 'chat, share');
assert.equal(req.headers['sec-websocket-extensions'], 'foo; 1, bar; 2, baz');
res.writeHead(200, {'Content-Type' : 'text/plain'});
res.end('EOF');
@ -57,7 +59,12 @@ srv.listen(common.PORT, function() {
['WWW-AUTHENTICATE', 'baz'],
['x-foo', 'bingo'],
['x-bar', 'banjo'],
['x-bar', 'bango']
['x-bar', 'bango'],
['sec-websocket-protocol', 'chat'],
['sec-websocket-protocol', 'share'],
['sec-websocket-extensions', 'foo; 1'],
['sec-websocket-extensions', 'bar; 2'],
['sec-websocket-extensions', 'baz']
]
});
});

Loading…
Cancel
Save