nodejs/http-parser
Freehttp request/response parser for c
About nodejs/http-parser
http-parser is a lightweight, high-performance HTTP message parser written in C, designed for use in performance-critical HTTP applications such as web servers and clients. It parses both HTTP requests and responses without making any syscalls or allocations, does not buffer data, and can be interrupted at any time. The parser requires approximately 40 bytes of data per message stream and supports persistent connections (keep-alive), chunked transfer encoding, and protocol upgrades. It also defends against buffer overflow attacks. The parser extracts header fields and values, Content-Length, request method, response status code, Transfer-Encoding, HTTP version, request URL, and message body. Note: this repository is archived and no longer actively maintained; new projects are advised to use llhttp instead.
Key Features
Pros & Cons
- Extremely lightweight and fast, ideal for performance-sensitive applications
- No runtime allocations or syscalls, reducing latency and overhead
- Small memory footprint per connection
- Robust handling of chunked encoding and persistent connections
- Includes buffer overflow protection for security
- Simple C API with callback-based event handling
- No longer actively maintained; repository is archived and read-only
- Only supports HTTP/1.x (no HTTP/2 or HTTP/3)
- Written in C, requiring manual memory management in host application
- Users are encouraged to migrate to llhttp for ongoing support
- Limited documentation beyond the README