commit | 0e1eb5fab8692a7bcc8a95f0b8692bad95844d5d | [log] [tgz] |
---|---|---|
author | Hyun Jae Moon <hyunjaemoon@google.com> | Fri Jun 23 16:05:18 2023 +0000 |
committer | Hyun Jae Moon <hyunjaemoon@google.com> | Fri Jun 23 16:10:52 2023 +0000 |
tree | 8ff2521fdbd60d16e2b4beb96dc858e84465c507 | |
parent | b6085ab53157bc7d6964c93e3f4cf17223a6e483 [diff] |
Import httparse crate Bug: 288308432 Bug: 286134481 Test: m libhttparse Change-Id: I9f28ace87d855a87127032fb5c5c95db62f744bf
A push parser for the HTTP 1.x protocol. Avoids allocations. No copy. Fast.
Works with no_std
, simply disable the std
Cargo feature.
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());
Licensed under either of
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.