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 ParseError {
  Incomplete(parser: Parser)
  Invalid
  TooLarge
  UnsupportedVersion
  HostMissing
  MultiLineHeaderUnsupported
}

Constructors

  • Incomplete(parser: Parser)
  • Invalid
  • TooLarge
  • UnsupportedVersion
  • HostMissing
  • MultiLineHeaderUnsupported
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

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

pub type Stage {
  RequestLine
  Headers
  Body(BodyType)
  Trailers
  Done
}

Constructors

  • RequestLine
  • Headers
  • Body(BodyType)
  • Trailers
  • Done

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
Search Document