#http #parser #callback #push

http-box

Fast push/callback oriented HTTP parser

6 releases

Uses old Rust 2015

0.1.5 Mar 16, 2017
0.1.4 Mar 15, 2017
0.1.0 Dec 6, 2016

#5 in #push

Apache-2.0

465KB
12K SLoC

http-box

Build: Passing dev: 0.1.5 license: Apache 2.0

What is http-box?

http-box is a push oriented HTTP 1 & 2 parser with the goal of remaining fast and bare bones. Utilities are provided for handling additional HTTP details such as query parsing, decoding hex encoded strings, and header field parsing.

The intent of http-box is to parse HTTP content and nothing more, so you will not find Request or Response types within the library. They have not been ruled out entirely, however, if they are provided at any future point, they will be provided by a utility crate.

http-box will happily process any &[u8] data, and is not tied to any socket or network dependencies.

Features

  • New: HTTP/2 support
  • Push oriented and will process a single byte at a time
  • Data is received via callback with the ability to break out of the parser loop at any point
  • HTTP/1.x headers are normalized to lower-case
  • Errors report type of error and on which byte it occurred
  • Parse HTTP/1.x phases separately:
    • Head
      • Request / Response
      • Headers
    • Multipart
      • Headers
      • Data
    • Chunk Transfer-Encoded
      • Chunk Length
      • Extensions
      • Chunk Data
      • Trailers
    • URL encoded
      • Parameters
  • Zero copy philosophy
  • DoS protection is easily supported
  • Fast!
  • Use with any networking library

API Documentation

https://docs.rs/http-box/0.1.5/http_box/

HTTP/2.x Examples

HTTP/1.x Examples

HTTP Utilities

Dependencies