Skip to main content

Crate horrorhttp

Crate horrorhttp 

Source
Expand description

§HorrorHTTP

Please consider not using this library. It is not meant for general use in e.g. a website, but it is very very flexible

HorrorHTTP is an extremely light HTTP library meant to allow for complete flexibility in what you want to do with the connection.

To start, feed a TcpStream and handler state into handle. This creates a state machine which allows for each state to transition into any other state.

Structs§

BeginState
Reads the head, and potentially part of the body. Hands control to ParseHeadState.
BodyReaderDoNothing
Hands control further along.
BodyReaderEOF
Reads the body until EOF (single-side shutdown).
BodyReaderHeader
Reads the body based on Content-Length header.
Connection
OrState
ParseHeadState
Parses the head and hands control to the body_reader.
ResponseWriter
State that writes a response to the socket and then returns control to the custom_handler_state.
StopProcessingState

Traits§

BodyReader
ConnectionState

Functions§

handle
Begins handling a TCP connection. You must choose a body reader and a handler. The body reader can be any of BodyReaderDoNothing, which does not read the body any further than the head reader has already read, BodyReaderHeader, which reads as many bytes as specified by Content-Length, or BodyReaderEOF, which reads until the input closes. Custom BodyReaders may also be used.
handle_here
Same as handle, but does not create a thread