internal/parser
Types
pub type BodyType {
ContentLength(Int)
Chunked(chunk_size: option.Option(Int))
Empty
}
Constructors
-
ContentLength(Int) -
Chunked(chunk_size: option.Option(Int)) -
Empty
pub type HttpVersion {
Http11
}
Constructors
-
Http11
pub type ParsedRequest {
ParsedRequest(
method: option.Option(http.Method),
uri: option.Option(uri.Uri),
version: option.Option(HttpVersion),
headers: option.Option(dict.Dict(String, String)),
trailers: option.Option(set.Set(String)),
body: option.Option(BitArray),
body_size: Int,
)
}
Constructors
-
ParsedRequest( method: option.Option(http.Method), uri: option.Option(uri.Uri), version: option.Option(HttpVersion), headers: option.Option(dict.Dict(String, String)), trailers: option.Option(set.Set(String)), body: option.Option(BitArray), body_size: Int, )
pub type Parser {
Parser(
request: request.Request(BitArray),
headers_: dict.Dict(String, String),
trailers_: set.Set(String),
body_size_: Int,
stage: Stage,
buffer: BitArray,
)
}
Constructors
-
Parser( request: request.Request(BitArray), headers_: dict.Dict(String, String), trailers_: set.Set(String), body_size_: Int, stage: Stage, buffer: BitArray, )
Values
pub fn new_parsed_request() -> ParsedRequest
pub fn new_parser() -> Parser
pub fn parse_method(
method: BitArray,
) -> Result(http.Method, ParseError)
pub fn parse_request(
parser: Parser,
) -> Result(request.Request(BitArray), ParseError)
pub fn pretty_print_parsed(
request: request.Request(BitArray),
) -> Nil