
http_wrapper.pl -- Server processing of an HTTP request
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:
- http_current_request/1 finds the current request for occasional usage in places where it is not avaialable otherwise.
- http_peer/2 finds the (IP4) peer address, getting the original
address if we are behind a proxy (
X-Forwarded-For
) - http_relative_path/2 can be used to find a relative path from the current request.
http_wrapper(:Goal, +In, +Out, -Close, +Options) is det
- Simple wrapper to read and decode an HTTP header from `In', call
:Goal while watching for exceptions and send the result to the
stream `Out'.
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 lineTransfer-encoding: chunked
to request chunked encoding.Options:
- request(-Request)
- Return the full request to the caller
- peer(+Peer)
- IP address of client
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.