MCPcopy Index your code
hub / github.com/creationix/http-parser-js

github.com/creationix/http-parser-js @0.4.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.4.5 ↗ · + Follow
332 symbols 722 edges 183 files 6 documented · 2% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Core symbols most depended-on inside this repo

Shape

Function 175
Method 121
Class 36

Languages

Python58%
TypeScript42%

Modules by API surface

tests/test.py166 symbols
tests/testpy/__init__.py21 symbols
tests/iojs/test-http-parser-durability.js12 symbols
tests/parallel/test-http-parser.js9 symbols
tests/parallel/test-http-1.0-keep-alive.js7 symbols
tests/parallel/test-http-upgrade-server.js6 symbols
tests/parallel/test-http-agent-keepalive.js6 symbols
tests/parallel/test-http-createConnection.js5 symbols
tests/common.js5 symbols
tests/utils.py4 symbols
tests/parallel/test-http-same-map.js4 symbols
tests/parallel/test-http-keepalive-maxsockets.js4 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add http-parser-js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page