mist/http
Types
pub type Buffer {
Buffer(remaining: Int, data: BitString)
}
Constructors
-
Buffer(remaining: Int, data: BitString)
pub type DecodeError {
MalformedRequest
InvalidMethod
InvalidPath
UnknownHeader
UnknownMethod
InvalidBody
DiscardPacket
}
Constructors
-
MalformedRequest
-
InvalidMethod
-
InvalidPath
-
UnknownHeader
-
UnknownMethod
-
InvalidBody
-
DiscardPacket
pub type DecodedPacket {
BinaryData(HttpPacket, BitString)
EndOfHeaders(BitString)
MoreData(Option(Int))
}
Constructors
-
BinaryData(HttpPacket, BitString)
-
EndOfHeaders(BitString)
-
MoreData(Option(Int))
pub type HttpPacket {
HttpRequest(Dynamic, HttpUri, #(Int, Int))
HttpHeader(Int, Atom, BitString, BitString)
}
Constructors
-
HttpRequest(Dynamic, HttpUri, #(Int, Int))
-
HttpHeader(Int, Atom, BitString, BitString)
pub type HttpResponseBody {
BitBuilderBody(BitBuilder)
FileBody(
file_descriptor: file.FileDescriptor,
content_type: String,
offset: Int,
length: Int,
)
}
Constructors
-
BitBuilderBody(BitBuilder)
-
FileBody( file_descriptor: file.FileDescriptor, content_type: String, offset: Int, length: Int, )
pub type PacketType {
Http
HttphBin
HttpBin
}
Constructors
-
Http
-
HttphBin
-
HttpBin
Functions
pub fn from_header(value: BitString) -> String
pub fn parse_headers(bs: BitString, socket: Socket, transport: Transport, headers: Map(
String,
String,
)) -> Result(#(Map(String, String), BitString), DecodeError)
pub fn parse_request(bs: BitString, socket: Socket, transport: Transport) -> Result(
Request(Body),
DecodeError,
)
Turns the TCP message into an HTTP request
pub fn read_body(req: Request(Body), transport: Transport) -> Result(
Request(BitString),
DecodeError,
)
pub fn read_data(socket: Socket, transport: Transport, buffer: Buffer, error: DecodeError) -> Result(
BitString,
DecodeError,
)
pub fn upgrade(socket: Socket, transport: Transport, req: Request(
Body,
)) -> Result(Nil, Nil)
pub fn upgrade_socket(req: Request(Body)) -> Result(
Response(BitBuilder),
Request(Body),
)