Socket
Socket
Sign inDemoInstall

http-parser-js

Package Overview
Dependencies
0
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.4.1

14

http-parser.js

@@ -55,2 +55,6 @@ /*jshint node:true */

'UNLOCK',
'BIND',
'REBIND',
'UNBIND',
'ACL',
'REPORT',

@@ -66,3 +70,5 @@ 'MKACTIVITY',

'PURGE',
'MKCALENDAR'
'MKCALENDAR',
'LINK',
'UNLINK'
];

@@ -85,3 +91,3 @@ HTTPParser.prototype.reinitialize = HTTPParser;

}
// backward compat to node < 0.11.4

@@ -282,3 +288,3 @@ // Note: the start and length params were removed in newer version

}
info.shouldKeepAlive = this.shouldKeepAlive();

@@ -294,3 +300,3 @@ //problem which also exists in original node: we should know skipBody before calling onHeadersComplete

}
if (info.upgrade) {

@@ -297,0 +303,0 @@ this.nextRequest();

{
"name": "http-parser-js",
"version": "0.4.0",
"version": "0.4.1",
"description": "A pure JS HTTP parser for node.",

@@ -5,0 +5,0 @@ "main": "http-parser.js",

@@ -0,1 +1,2 @@

/* eslint-disable required-modules */
'use strict';

@@ -10,2 +11,3 @@ process.binding('http_parser').HTTPParser = require('../http-parser.js').HTTPParser;

exports.testDir = path.dirname(__filename);

@@ -18,2 +20,7 @@ exports.fixturesDir = path.join(exports.testDir, 'fixtures');

exports.isAix = process.platform === 'aix';
exports.isLinuxPPCBE = (process.platform === 'linux') &&
(process.arch === 'ppc64') &&
(os.endianness() === 'BE');
exports.isSunOS = process.platform === 'sunos';
exports.isFreeBSD = process.platform === 'freebsd';

@@ -37,3 +44,3 @@ function rimrafSync(p) {

if (e.code === 'EPERM')
return rmdirSync(p, er);
return rmdirSync(p, e);
if (e.code !== 'EISDIR')

@@ -138,6 +145,14 @@ throw e;

Object.defineProperty(exports, 'hasCrypto', {get: function() {
return process.versions.openssl ? true : false;
}});
Object.defineProperty(exports, 'hasCrypto', {
get: function() {
return process.versions.openssl ? true : false;
}
});
Object.defineProperty(exports, 'hasFipsCrypto', {
get: function() {
return process.config.variables.openssl_fips ? true : false;
}
});
if (exports.isWindows) {

@@ -174,6 +189,2 @@ exports.PIPE = '\\\\.\\pipe\\libuv-test';

var util = require('util');
for (var i in util) exports[i] = util[i];
//for (var i in exports) global[i] = exports[i];
function protoCtrChain(o) {

@@ -379,7 +390,2 @@ var result = [];

exports.checkSpawnSyncRet = function(ret) {
assert.strictEqual(ret.status, 0);
assert.strictEqual(ret.error, undefined);
};
var etcServicesFileName = path.join('/etc', 'services');

@@ -417,11 +423,5 @@ if (exports.isWindows) {

try {
/*
* I'm not a big fan of readFileSync, but reading /etc/services
* asynchronously here would require implementing a simple line parser,
* which seems overkill for a simple utility function that is not running
* concurrently with any other one.
*/
var servicesContent = fs.readFileSync(etcServicesFileName,
{ encoding: 'utf8'});
var regexp = util.format('^(\\w+)\\s+\\s%d/%s\\s', port, protocol);
var regexp = `^(\\w+)\\s+\\s${port}/${protocol}\\s`;
var re = new RegExp(regexp, 'm');

@@ -457,1 +457,5 @@

};
exports.fail = function(msg) {
assert.fail(null, null, msg);
};

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

s.close();
common.error('curled response correctly');
common.error(common.inspect(stdout));
});
});
console.log('Server running at http://127.0.0.1:' + common.PORT + '/');

@@ -11,3 +11,3 @@ 'use strict';

var server = http.createServer(function(req, res) {
common.debug('Server got GET request');
console.error('Server got GET request');
req.resume();

@@ -22,3 +22,3 @@ ++serverRequests;

server.on('connect', function(req, socket, firstBodyChunk) {
common.debug('Server got CONNECT request');
console.error('Server got CONNECT request');
serverConnected = true;

@@ -38,3 +38,3 @@ socket.write('HTTP/1.1 200 Connection established\r\n\r\n');

req.on('connect', function(res, socket, firstBodyChunk) {
common.debug('Client got CONNECT response');
console.error('Client got CONNECT response');
socket.end();

@@ -55,3 +55,3 @@ socket.on('end', function() {

}, function(res) {
common.debug('Client got GET response');
console.error('Client got GET response');
var data = '';

@@ -58,0 +58,0 @@ res.setEncoding('utf8');

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

var server = http.createServer(function(req, res) {
common.error('got req');
gotReq = true;

@@ -27,3 +26,2 @@ assert.equal('GET', req.method);

c.on('connect', function() {
common.error('client wrote message');
c.write('GET /blah HTTP/1.1\r\n' +

@@ -42,3 +40,2 @@ 'Host: mapdevel.trolologames.ru:443\r\n' +

c.on('close', function() {
common.error('client close');
server.close();

@@ -45,0 +42,0 @@ });

@@ -17,2 +17,4 @@ 'use strict';

common.refreshTmpDir();
server.listen(common.PIPE, function() {

@@ -19,0 +21,0 @@ var req = http.request({

'use strict';
require('../common');
var net = require('net');

@@ -3,0 +4,0 @@ var http = require('http');

@@ -14,2 +14,4 @@ 'use strict';

common.refreshTmpDir();
// first fire up a simple HTTP server

@@ -16,0 +18,0 @@ var server = http.createServer(function(req, res) {

@@ -8,3 +8,3 @@ 'use strict';

// Path with spaces in it should throw.
http.get({ path: 'bad path' }, assert.fail);
http.get({ path: 'bad path' }, common.fail);
}, /contains unescaped characters/);

@@ -46,4 +46,2 @@ 'use strict';

req.end();
common.error('client finished sending request');
});

@@ -50,0 +48,0 @@

@@ -49,4 +49,2 @@ 'use strict';

req.end();
common.error('client finished sending request');
});

@@ -53,0 +51,0 @@

@@ -15,3 +15,3 @@ 'use strict';

assert.equal(req.url, 'google.com:443');
common.debug('Server got CONNECT request');
console.error('Server got CONNECT request');
serverGotConnect = true;

@@ -44,3 +44,3 @@

req.on('connect', function(res, socket, firstBodyChunk) {
common.debug('Client got CONNECT request');
console.error('Client got CONNECT request');
clientGotConnect = true;

@@ -47,0 +47,0 @@

@@ -14,3 +14,3 @@ 'use strict';

assert.equal(sent_continue, true, 'Full response sent before 100 Continue');
common.debug('Server sending full response...');
console.error('Server sending full response...');
res.writeHead(200, {

@@ -25,3 +25,3 @@ 'Content-Type' : 'text/plain',

server.on('checkContinue', function(req, res) {
common.debug('Server got Expect: 100-continue...');
console.error('Server got Expect: 100-continue...');
res.writeContinue();

@@ -43,7 +43,7 @@ sent_continue = true;

});
common.debug('Client sending request...');
console.error('Client sending request...');
outstanding_reqs++;
var body = '';
req.on('continue', function() {
common.debug('Client got 100 Continue...');
console.error('Client got 100 Continue...');
got_continue = true;

@@ -60,3 +60,3 @@ req.end(test_req_body);

res.on('end', function() {
common.debug('Got full response.');
console.error('Got full response.');
assert.equal(body, test_res_body, 'Response body doesn\'t match.');

@@ -63,0 +63,0 @@ assert.ok('abcd' in res.headers, 'Response headers missing.');

@@ -13,3 +13,3 @@ 'use strict';

server.listen(common.PORT, '127.0.0.1', function() {
let req = http.request({
const req = http.request({
method: 'GET',

@@ -16,0 +16,0 @@ host: '127.0.0.1',

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

}, function(res) {
common.error('response');
res.on('end', function() {
common.error('response end');
server.close();

@@ -34,3 +32,2 @@ responseComplete = true;

});
common.error('req');
req.end();

@@ -37,0 +34,0 @@ });

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

}, function(res) {
common.error('response');
res.on('end', function() {
common.error('response end');
server.close();

@@ -34,3 +32,2 @@ responseComplete = true;

});
common.error('req');
req.end();

@@ -37,0 +34,0 @@ });

@@ -30,3 +30,3 @@ 'use strict';

default:
assert.fail('unreachable');
assert.fail(null, null, 'unreachable');
}

@@ -33,0 +33,0 @@ res.write(responseBody);

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

function p(x) {
common.error(common.inspect(x));
}
var responses_sent = 0;

@@ -43,4 +39,2 @@ var responses_recvd = 0;

req.resume();
//assert.equal('127.0.0.1', res.connection.remoteAddress);
});

@@ -59,3 +53,3 @@

res.on('data', function(chunk) { body0 += chunk; });
common.debug('Got /hello response');
console.error('Got /hello response');
});

@@ -71,3 +65,3 @@

res.on('data', function(chunk) { body1 += chunk; });
common.debug('Got /world response');
console.error('Got /world response');
});

@@ -78,6 +72,6 @@ }, 1);

process.on('exit', function() {
common.debug('responses_recvd: ' + responses_recvd);
console.error('responses_recvd: ' + responses_recvd);
assert.equal(2, responses_recvd);
common.debug('responses_sent: ' + responses_sent);
console.error('responses_sent: ' + responses_sent);
assert.equal(2, responses_sent);

@@ -84,0 +78,0 @@

@@ -27,3 +27,3 @@ 'use strict';

}, function(res) {
assert.fail('unexpectedly got response from server');
assert.fail(null, null, 'unexpectedly got response from server');
}).on('error', function(e) {

@@ -30,0 +30,0 @@ console.log('client got error: ' + e.message);

@@ -113,3 +113,3 @@ 'use strict';

default:
throw Error('?');
throw new Error('?');
}

@@ -116,0 +116,0 @@

@@ -12,6 +12,6 @@ 'use strict';

var server = http.createServer(function(req, res) {
common.debug('pause server request');
console.error('pause server request');
req.pause();
setTimeout(function() {
common.debug('resume server request');
console.error('resume server request');
req.resume();

@@ -23,3 +23,3 @@ req.setEncoding('utf8');

req.on('end', function() {
common.debug(resultServer);
console.error(resultServer);
res.writeHead(200);

@@ -37,6 +37,6 @@ res.end(expectedClient);

}, function(res) {
common.debug('pause client response');
console.error('pause client response');
res.pause();
setTimeout(function() {
common.debug('resume client response');
console.error('resume client response');
res.resume();

@@ -47,3 +47,3 @@ res.on('data', function(chunk) {

res.on('end', function() {
common.debug(resultClient);
console.error(resultClient);
server.close();

@@ -50,0 +50,0 @@ });

@@ -34,3 +34,3 @@ 'use strict';

res.on('end', function() {
common.debug('res' + i + ' end');
console.error('res' + i + ' end');
if (i === 2) {

@@ -43,3 +43,3 @@ server.close();

req.on('socket', function(s) {
common.debug('req' + i + ' start');
console.error('req' + i + ' start');
});

@@ -46,0 +46,0 @@ req.end('12345');

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

if (req.id == 1) {
common.error('req 1');
assert.equal('POST', req.method);

@@ -33,3 +32,2 @@ assert.equal('/quit', url.parse(req.url).pathname);

if (req.id == 2) {
common.error('req 2');
assert.equal('foo', req.headers['x-x']);

@@ -39,6 +37,4 @@ }

if (req.id == 3) {
common.error('req 3');
assert.equal('bar', req.headers['x-x']);
this.close();
common.error('server closed');
}

@@ -45,0 +41,0 @@

@@ -13,3 +13,3 @@ 'use strict';

req.connection.destroy();
common.debug('TIMEOUT');
console.error('TIMEOUT');
server.close();

@@ -16,0 +16,0 @@ });

@@ -56,3 +56,3 @@ 'use strict';

c.write('GET / HTTP/1.1\r\n\r\n');
tid = setTimeout(assert.fail, 2000, 'Couldn\'t find last chunk.');
tid = setTimeout(common.fail, 2000, 'Couldn\'t find last chunk.');
});

@@ -59,0 +59,0 @@

@@ -21,2 +21,4 @@ 'use strict';

common.refreshTmpDir();
server.listen(common.PIPE, function() {

@@ -23,0 +25,0 @@

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

var server = http.createServer(function(req, res) {
common.error('got req');
throw new Error('This shouldn\'t happen.');

@@ -14,3 +13,2 @@ });

server.on('upgrade', function(req, socket, upgradeHead) {
common.error('got upgrade event');
// test that throwing an error from upgrade gets

@@ -24,3 +22,2 @@ // is uncaught

process.on('uncaughtException', function(e) {
common.error('got \'clientError\' event');
assert.equal('upgrade error', e.message);

@@ -36,3 +33,2 @@ gotError = true;

c.on('connect', function() {
common.error('client wrote message');
c.write('GET /blah HTTP/1.1\r\n' +

@@ -49,3 +45,2 @@ 'Upgrade: WebSocket\r\n' +

c.on('close', function() {
common.error('client close');
server.close();

@@ -52,0 +47,0 @@ });

@@ -34,5 +34,4 @@ 'use strict';

});
common.error('Got /hello response');
});
});

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

function p(x) {
common.error(common.inspect(x));
}
var responses_sent = 0;

@@ -60,3 +56,3 @@ var responses_recvd = 0;

res.on('data', function(chunk) { body0 += chunk; });
common.debug('Got /hello response');
console.error('Got /hello response');
});

@@ -75,3 +71,3 @@

res.on('data', function(chunk) { body1 += chunk; });
common.debug('Got /world response');
console.error('Got /world response');
});

@@ -83,6 +79,6 @@ req.end();

process.on('exit', function() {
common.debug('responses_recvd: ' + responses_recvd);
console.error('responses_recvd: ' + responses_recvd);
assert.equal(2, responses_recvd);
common.debug('responses_sent: ' + responses_sent);
console.error('responses_sent: ' + responses_sent);
assert.equal(2, responses_sent);

@@ -89,0 +85,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc