Crate httparse

Source
Expand description

ยงhttparse

A push library for parsing HTTP/1.x requests and responses.

The focus is on speed and safety. Unsafe code is used to keep parsing fast, but unsafety is contained in a submodule, with invariants enforced. The parsing internals use an Iterator instead of direct indexing, while skipping bounds checks.

With Rust 1.27.0 or later, support for SIMD is enabled automatically. If building an executable to be run on multiple platforms, and thus not passing target_feature or target_cpu flags to the compiler, runtime detection can still detect SSE4.2 or AVX2 support to provide massive wins.

If compiling for a specific target, remembering to include -C target_cpu=native allows the detection to become compile time checks, making it even faster.

Modulesยง

iter ๐Ÿ”’
macros ๐Ÿ”’
Utility macros
simd ๐Ÿ”’

Structsยง

Header
Represents a parsed header.
HeaderParserConfig ๐Ÿ”’
InvalidChunkSize
An error in parsing a chunk size.
ParserConfig
Parser configuration.
Request
A parsed Request.
Response
A parsed Response.

Enumsยง

Error
An error in parsing.
Status
The result of a successful parse pass.

Constantsยง

EMPTY_HEADER
An empty header, useful for constructing a Header array to pass in for parsing.

Staticsยง

HEADER_VALUE_MAP ๐Ÿ”’
TOKEN_MAP ๐Ÿ”’
URI_MAP ๐Ÿ”’

Functionsยง

assume_init_slice ๐Ÿ”’ โš 
deinit_slice_mut ๐Ÿ”’ โš 
is_header_name_token ๐Ÿ”’
is_header_value_token ๐Ÿ”’
is_method_token ๐Ÿ”’
Determines if byte is a method token char.
is_uri_token ๐Ÿ”’
parse_chunk_size
Parse a buffer of bytes as a chunk size.
parse_code ๐Ÿ”’
parse_headers
Parse a buffer of bytes as headers.
parse_headers_iter ๐Ÿ”’
parse_headers_iter_uninit ๐Ÿ”’
parse_reason ๐Ÿ”’
From RFC 7230:
parse_token ๐Ÿ”’
skip_empty_lines ๐Ÿ”’
skip_spaces ๐Ÿ”’

Type Aliasesยง

Result
A Result of any parsing action.