Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spdy-transport

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spdy-transport - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

48

lib/spdy-transport/protocol/base/utils.js

@@ -37,1 +37,49 @@ 'use strict';

};
// Copy-Paste from node
exports.addHeaderLine = function addHeaderLine(field, value, dest) {
field = field.toLowerCase();
if (/^:/.test(field)) {
dest[field] = value;
return;
}
switch (field) {
// Array headers:
case 'set-cookie':
if (dest[field] !== undefined) {
dest[field].push(value);
} else {
dest[field] = [ value ];
}
break;
/* eslint-disable max-len */
// list is taken from:
/* eslint-enable max-len */
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 (dest[field] === undefined)
dest[field] = value;
break;
default:
// make comma-separated list
if (dest[field] !== undefined) {
dest[field] += ', ' + value;
} else {
dest[field] = value;
}
}
};

26

lib/spdy-transport/protocol/http2/framer.js

@@ -154,10 +154,22 @@ 'use strict';

// Do not compress, or index Cookie field (for security reasons)
var neverIndex = lowName === 'cookie';
var neverIndex = lowName === 'cookie' || lowName === 'set-cookie';
pairs.push({
name: lowName,
value: headers[name] + '',
neverIndex: neverIndex,
huffman: !neverIndex
});
var value = headers[name];
if (Array.isArray(value)) {
for (var i = 0; i < value.length; i++) {
pairs.push({
name: lowName,
value: value[i] + '',
neverIndex: neverIndex,
huffman: !neverIndex
});
}
} else {
pairs.push({
name: lowName,
value: value + '',
neverIndex: neverIndex,
huffman: !neverIndex
});
}
});

@@ -164,0 +176,0 @@

@@ -7,2 +7,3 @@ 'use strict';

var base = transport.protocol.base;
var utils = base.utils;
var constants = require('./').constants;

@@ -264,3 +265,3 @@

headers[header.name.toLowerCase()] = header.value;
utils.addHeaderLine(header.name, header.value, headers);
}

@@ -267,0 +268,0 @@

@@ -348,3 +348,5 @@ 'use strict';

headers[key] = value;
value = value.split(/\0/g);
for (var i = 0; i < value.length; i++)
utils.addHeaderLine(key, value[i], headers);
}

@@ -351,0 +353,0 @@

{
"name": "spdy-transport",
"version": "1.1.2",
"version": "1.1.3",
"description": "SPDY v2, v3, v3.1 and HTTP2 transport",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -685,3 +685,34 @@ var assert = require('assert');

});
it('should send request with Array header value', function(done) {
var sent = false;
var received = false;
client.request({
method: 'GET',
path: '/hello',
headers: {
cookie: [ 'd', 'e' ]
}
}, function(err, stream) {
assert(!err);
sent = true;
stream.on('response', function(code, headers) {
assert(received);
done();
});
});
server.on('stream', function(stream) {
stream.respond(200, {});
received = true;
assert(sent);
assert.equal(stream.headers.cookie, 'd, e');
});
});
});
});

@@ -132,4 +132,6 @@ var assert = require('assert');

'cache-control': 'max-age=0',
cookie: '__utmz=96992031.1418653936.1.1.utmcsr=(direct)|' +
'utmccn=(direct)|utmcmd=(none)',
cookie: '__utma=96992031.1688179242.1418653936.' +
'1431769072.1433090381.7, ' +
'__utmz=96992031.1418653936.1.1.utmcsr=(direct)|' +
'utmccn=(direct)|utmcmd=(none)',
dnt: '1',

@@ -136,0 +138,0 @@ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) ' +

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc