Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Add WebSocket RFC6455 multiheader fields to the http parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
einaros authored and isaacs committed Feb 16, 2012
1 parent 2c07712 commit 83fd1c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/http.js
Expand Up @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion test/simple/test-http-server-multiheaders.js
Expand Up @@ -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');
Expand All @@ -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']
]
});
});

0 comments on commit 83fd1c1

Please sign in to comment.