Module openflax.http.parse

Routines for parsing HTTP requests.

Description

Routines for parsing HTTP requests.

Function Index

body/1Parses an HTTP request body, assuming it is in form POST format.
header_field/1Parses a single, well-formed HTTP header.
hostport/1Given a host and port both in a string like "www.foo.bar:1234", returns the host and port as seperate strings.
http_version/1Given an HTTP version string, returns the major and minor version numbers as seperate strings.
request_line/1Parses a well-formed HTTP request line.
unescape_hex/1Unescapes the hex sequences in URI and/or form data.
uri/1Returns basic request and arguments given a URI.

Function Details

body/1

body(Body::string()) -> [{string(), string()}]

Parses an HTTP request body, assuming it is in form POST format.

header_field/1

header_field(Line::string()) -> {key(), [{key(), value()}]}

Parses a single, well-formed HTTP header. Actually this is only for the kinds that work like Key: Value;key=value;key=value, also supporting quoted strings. However, most of the headers we're concerned with parsing look enough like this for now. TODO write different parsers for different kinds of headers.

hostport/1

hostport(HostPort::string()) -> {string(), string()}

Given a host and port both in a string like "www.foo.bar:1234", returns the host and port as seperate strings. The host is always returned in lowercase.

http_version/1

http_version(X1::string()) -> {string(), string()}

Given an HTTP version string, returns the major and minor version numbers as seperate strings.

request_line/1

request_line(Request::string()) -> {Host, Port, Request0, Major, Minor, Method, URI, Root, Args, ArgList}

Parses a well-formed HTTP request line.

unescape_hex/1

unescape_hex(H::string()) -> string()

Unescapes the hex sequences in URI and/or form data.

uri/1

uri(URI::string()) -> {string(), string(), string(), string(), [{string(), string()}]}

Returns basic request and arguments given a URI. {Host, Port, Root, ArgString, Args}.