Passby.HttpParser (passby v0.1.0)

Copy Markdown View Source

Parses raw HTTP/1.0 and HTTP/1.1 requests from a :gen_tcp socket using Erlang's built-in :erlang.decode_packet/3.

Summary

Functions

Reads and parses an HTTP request from the given :gen_tcp socket.

Functions

parse_request(socket, buffer \\ <<>>, timeout \\ 5000)

@spec parse_request(port(), binary(), timeout()) ::
  {:ok, Passby.Conn.t()} | {:error, :closed | :timeout | atom()}

Reads and parses an HTTP request from the given :gen_tcp socket.

Returns {:ok, %Passby.Conn{}} or {:error, reason}.