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

cometd-nodejs-client

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cometd-nodejs-client - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

26

cometd-nodejs-client.js

@@ -55,10 +55,12 @@ module.exports = {

}
var list = cookieStore[_config.hostname];
if (list) {
var jar = cookieStore[_config.hostname];
if (jar) {
var cookies = '';
for (var i = 0; i < list.length; ++i) {
if (i > 0) {
cookies += '; ';
for (var name in jar) {
if (jar.hasOwnProperty(name)) {
if (cookies) {
cookies += '; ';
}
cookies += jar[name];
}
cookies += list[i];
}

@@ -88,7 +90,11 @@ if (cookies) {

var host = _config.hostname;
var list = cookieStore[host];
if (list === undefined) {
cookieStore[host] = list = [];
var jar = cookieStore[host];
if (jar === undefined) {
cookieStore[host] = jar = {};
}
list.push(cookie);
var equal = cookie.indexOf('=');
if (equal > 0) {
jar[cookie.substring(0, equal)] = cookie;
}
}

@@ -95,0 +101,0 @@ }

{
"name": "cometd-nodejs-client",
"version": "1.0.1",
"version": "1.0.2",
"description": "Adapter code to run the CometD JavaScript library in a NodeJS environment",

@@ -5,0 +5,0 @@ "keywords": [

@@ -147,2 +147,41 @@ var assert = require('assert');

});
it('handles cookie sent multiple times', function(done) {
var cookieName = 'a';
var cookieValue = 'b';
var cookie = cookieName + '=' + cookieValue;
_server = http.createServer(function(request, response) {
if (/\/verify$/.test(request.url)) {
assert.strictEqual(request.headers['cookie'], cookie);
response.end();
} else {
response.setHeader('Set-Cookie', cookie);
response.end();
}
});
_server.listen(0, 'localhost', function() {
var port = _server.address().port;
console.log('listening on localhost:' + port);
var xhr1 = new window.XMLHttpRequest();
xhr1.open('GET', 'http://localhost:' + port + '/1');
xhr1.onload = function() {
assert.strictEqual(xhr1.status, 200);
var xhr2 = new window.XMLHttpRequest();
xhr2.open('GET', 'http://localhost:' + port + '/2');
xhr2.onload = function() {
assert.strictEqual(xhr2.status, 200);
var xhr3 = new window.XMLHttpRequest();
xhr3.open('GET', 'http://localhost:' + port + '/verify');
xhr3.onload = function() {
assert.strictEqual(xhr1.status, 200);
done();
};
xhr3.send();
};
xhr2.send();
};
xhr1.send();
});
});
});

Sorry, the diff of this file is not supported yet

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