Add WebSocket RFC6455 multiheader fields to the http parser.
This commit is contained in:
parent
2c07712860
commit
83fd1c1de5
@ -295,6 +295,8 @@ IncomingMessage.prototype._addHeaderLine = function(field, value) {
|
|||||||
case 'pragma':
|
case 'pragma':
|
||||||
case 'link':
|
case 'link':
|
||||||
case 'www-authenticate':
|
case 'www-authenticate':
|
||||||
|
case 'sec-websocket-extensions':
|
||||||
|
case 'sec-websocket-protocol':
|
||||||
if (field in dest) {
|
if (field in dest) {
|
||||||
dest[field] += ', ' + value;
|
dest[field] += ', ' + value;
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,6 +33,8 @@ var srv = http.createServer(function(req, res) {
|
|||||||
assert.equal(req.headers['www-authenticate'], 'foo, bar, baz');
|
assert.equal(req.headers['www-authenticate'], 'foo, bar, baz');
|
||||||
assert.equal(req.headers['x-foo'], 'bingo');
|
assert.equal(req.headers['x-foo'], 'bingo');
|
||||||
assert.equal(req.headers['x-bar'], 'banjo, bango');
|
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.writeHead(200, {'Content-Type' : 'text/plain'});
|
||||||
res.end('EOF');
|
res.end('EOF');
|
||||||
@ -57,7 +59,12 @@ srv.listen(common.PORT, function() {
|
|||||||
['WWW-AUTHENTICATE', 'baz'],
|
['WWW-AUTHENTICATE', 'baz'],
|
||||||
['x-foo', 'bingo'],
|
['x-foo', 'bingo'],
|
||||||
['x-bar', 'banjo'],
|
['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…
x
Reference in New Issue
Block a user