This module provides a thin interface for collecting and validating incoming HTTP requests in OpenFlax.
openflax.http.interface is used to retrieve
the request and perform the basic parsing of the request line,
the headers, and the body. The results of this retrieval
are collected into a conf(), and validated for
compliance to RFC 2616.
In the case of non-trivial request bodies, such as a
multipart/form-data Content-Type for the request, a
custom parsing callback, if present, will be used to parse the form.
This callback is specified by the
cfg_openflax_http_body_parser
setting in the global configuration.
| collect/3 | Collects the incoming HTTP request as it comes in, then validates it. |
| collect_body/1 | Collect the body of the HTTP request. |
collect(Http::http(), Conf::conf(), MasterDict::master_dict()) -> {ok, conf()} | {error, {response(), conf()}}
Collects the incoming HTTP request as it comes in, then validates it.
Key=Value pairs given after the first ?
in the URI are extracted and added to the conf()
with an arg_ prefix added to each key.
Subsequent lines until a blank line are parsed as HTTP headers,
and each is added to the returned conf().
Finally, POSTed form data is parsed. Fields in it are extracted
and placed in the conf() with form_ prefixed
to each field name.
collect_body(Conf::conf()) -> conf()
Collect the body of the HTTP request.
This function may be called by handlers to retrieve the HTTP request body
as as form_* settings in a conf().