Crate rhymuweb[][src]

This crate provides types for handling Hypertext Transfer Protocol (HTTP) 1.1 requests and responses, as specified in IETF RFC 7230.

To parse a request or response, construct a new Request or Response value with Request::new or Response::new, and then start feeding it input text via Request::parse or Response::parse. Each call will consume zero or more of the input characters. Input is only consumed if enough is provided for the parser to successfully build up another part of the message. Any unused input should be included in the next call along with additional input to continue parsing. Parsing is complete once the end of the message has been found.

To generate a request or response, construct a new value with Request::new or Response::new, fill in various fields of the value, and emit the final text using Request::generate or Response::generate.

By default, the following constraints are set the lengths of various parts of a Request:

  • request line: 1000 bytes
  • header lines: 1000 bytes each
  • message overall: 10,000,000 bytes

To change or remove the header line length constraint, use the MessageHeaders::set_line_limit function on the headers field of Request. To change or remove the overall message length constraint, set the max_message_size field of Request.

Modules

coding

This module contains helper functions for encoding and decoding the bodies of HTTP requests and responses. There are two kinds of coding: text coding and content coding. Content coding changes the bytes of the body in order to represent it differently; for example, to compress the body to a smaller size. Text coding is how the bytes of the body are interpreted as text, and therefore how it can be converted to/from a Rust string.

Structs

Request

This type is used to parse and generate HTTP 1.1 requests.

RequestParseResults

This holds the values returned by Request::parse.

Response

This type is used to parse and generate HTTP 1.1 responses.

ResponseParseResults

This holds the values returned by Response::parse.

Enums

Error

This is the enumeration of all the different kinds of errors which this crate generates.

RequestParseStatus

This enumerates the possible non-error states Request can be in after parsing a bit of input.

ResponseParseStatus

This enumerates the possible non-error states Response can be in after parsing a bit of input.