38 releases (25 stable)

1.8.0 Aug 30, 2022
1.7.1 Apr 26, 2022
1.6.0 Feb 8, 2022
1.5.1 Aug 19, 2021
0.0.5 Mar 21, 2015

#11 in Parser implementations

Download history 1192392/week @ 2024-01-10 1300766/week @ 2024-01-17 1262533/week @ 2024-01-24 1346937/week @ 2024-01-31 1334141/week @ 2024-02-07 1320889/week @ 2024-02-14 1364976/week @ 2024-02-21 1440742/week @ 2024-02-28 1381739/week @ 2024-03-06 1357989/week @ 2024-03-13 1413478/week @ 2024-03-20 1314609/week @ 2024-03-27 1416016/week @ 2024-04-03 1409489/week @ 2024-04-10 1390905/week @ 2024-04-17 1168922/week @ 2024-04-24

5,647,657 downloads per month
Used in 19,862 crates (267 directly)

MIT/Apache

110KB
2.5K SLoC

httparse

crates.io Released API docs MIT licensed CI Discord chat

A push parser for the HTTP 1.x protocol. Avoids allocations. No copy. Fast.

Works with no_std, simply disable the std Cargo feature.

Changelog

Usage

let mut headers = [httparse::EMPTY_HEADER; 64];
let mut req = httparse::Request::new(&mut headers);

let buf = b"GET /index.html HTTP/1.1\r\nHost";
assert!(req.parse(buf)?.is_partial());

// a partial request, so we try again once we have more data

let buf = b"GET /index.html HTTP/1.1\r\nHost: example.domain\r\n\r\n";
assert!(req.parse(buf)?.is_complete());

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps