htpp 0.1.2

A simple, fast, and secure http parser. It adheres strictly to the http specification, which is intentional as to be efficient and prevent possible http related attacks. It only supports http 1.1 but support for http 2.0 is planned
Documentation

Htpp

A fast and simple HTTP 1.1 parser written in Rust

Usage

To parse an HTTP request:

let req = b"GET /index.html HTTP/1.1\r\n\r\n";
let parsed_req = htpp::RequestParser::new(req).parse().unwrap();
assert!(parsed_req.method() == htpp::Method::Get);
assert!(parsed_req.path() == "/index.html");

To parse an HTTP response:

let resp = b"HTTP/1.1 200 OK\r\n\r\n";
let parsed_resp = htpp::ResponseParser::new(resp).parse().unwrap();
assert!(parsed_resp.status() == 200);
assert!(parsed_resp.reason() == "OK");

Contribution

Feel free to make a pull request if you think you can improve the code