Projekt

Obecné

Profil

Stáhnout (1.12 KB) Statistiky
| Větev: | Revize:
1
# HTTP Parser
2

    
3
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.
4

    
5
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).
6

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

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

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

    
15
var http = require('http');
16
// ...
17
```
18

    
19
## Testing
20

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

    
23
## Status
24

    
25
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.
26

    
27
## License
28

    
29
MIT. See LICENSE.md
(3-3/5)