1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 06:43:17 +00:00
musix-oss/node_modules/http-parser-js
2020-03-03 22:30:50 +02:00
..
CHANGELOG.md Modules 2020-03-03 22:30:50 +02:00
http-parser.js Modules 2020-03-03 22:30:50 +02:00
LICENSE.md Modules 2020-03-03 22:30:50 +02:00
package.json Modules 2020-03-03 22:30:50 +02:00
README.md Modules 2020-03-03 22:30:50 +02:00

HTTP Parser

This library parses HTTP protocol for requests and responses. It was created to replace http_parser.c since calling C++ function from JS is really slow in V8.

This was further modified by Jimbly to be useable in parsing responses, specifically tested with the "request" module, and addresses issues such as corrupt HTTP headers, which would otherwise cause Node's parser to throw a fatal error (HPE_INVALID_HEADER_TOKEN).

Jan Schär (jscissr) made some bigger changes and added tests. This fixed some bugs and added many missing features.

This is packaged as a standalone npm module. To use in node, monkeypatch HTTPParser.

// Monkey patch before you require http for the first time.
process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;

var http = require('http');
// ...

Testing

Simply do npm test. The tests are copied from node and mscedex/io.js, with some modifcations.

Status

This should now be usable in any node application, it now supports (nearly) everything http_parser.c does while still being tolerant with corrupted headers.

License

MIT. See LICENSE.md