Most code doesn't need to use this directly; instead use library(http/http_server), which combines this library with the typical HTTP libraries that most servers need.
This library provides the core of the implementation of the HTTP
protocol at the server side and is mainly intended for internal use.
It is used by library(thread_httpd)
and library(inet_httpd)
(deprecated).
Still, it provides a few predicates that are occasinally useful for applications:
X-Forwarded-For
)
The goal is assumed to write the reply to current_output
preceeded by an HTTP header, closed by a blank line. The header
must contain a Content-type: <type> line. It may optionally
contain a line Transfer-encoding: chunked
to request chunked
encoding.
Options:
not_modified
, moved
) or a request to reply with
the content of a file.current_output
no
longer points to the CGI stream, but simply to the socket that
connects us to the client.
ok
, the error from catch/3 or a term error(goal_failed(Goal),
_)
.
Location
and optional Status
headers for
formulating a HTTP redirect. Redirection is only established if
no Status
is provided, or Status
is 3XX.Fastly-client-ip
X-real-ip
X-forwarded-for