#parser #http #no-std

no-std httparse

A tiny, safe, speedy, zero-copy HTTP/1.x parser

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 964272/week @ 2023-11-21 1086052/week @ 2023-11-28 1130936/week @ 2023-12-05 1161578/week @ 2023-12-12 902690/week @ 2023-12-19 617956/week @ 2023-12-26 1085718/week @ 2024-01-02 1187876/week @ 2024-01-09 1285836/week @ 2024-01-16 1257865/week @ 2024-01-23 1346501/week @ 2024-01-30 1340941/week @ 2024-02-06 1317730/week @ 2024-02-13 1355482/week @ 2024-02-20 1419014/week @ 2024-02-27 1164087/week @ 2024-03-05

5,488,077 downloads per month
Used in 19,087 crates (261 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