Module openflax.http.request

HTTP request collecting and validating for OpenFlax.

Description

HTTP request collecting and validating for OpenFlax.

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.

Function Index

collect/3Collects the incoming HTTP request as it comes in, then validates it.
collect_body/1Collect the body of the HTTP request.

Function Details

collect/3

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/1

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().