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

#10 in Parser implementations

Download history 1102519/week @ 2023-12-14 702869/week @ 2023-12-21 798786/week @ 2023-12-28 1163556/week @ 2024-01-04 1197662/week @ 2024-01-11 1298638/week @ 2024-01-18 1266473/week @ 2024-01-25 1346085/week @ 2024-02-01 1353445/week @ 2024-02-08 1304794/week @ 2024-02-15 1372575/week @ 2024-02-22 1458967/week @ 2024-02-29 1360518/week @ 2024-03-07 1377772/week @ 2024-03-14 1394493/week @ 2024-03-21 1082579/week @ 2024-03-28

5,478,048 downloads per month
Used in 19,485 crates (262 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