PublicShow sourcehttp_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:

Source 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 line Transfer-encoding: chunked to request chunked encoding.

Options:

request(-Request)
Return the full request to the caller
peer(+Peer)
IP address of client
Arguments:
Close- Unified to one of close, Keep-Alive or spawned(ThreadId).

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source http_spawned(Arg1)
Source http_relative_path(Arg1, Arg2)
Source http_wrap_spawned(Arg1, Arg2, Arg3)
Source http_current_request(Arg1)
Source http_peer(Arg1, Arg2)
Source http_send_header(Arg1)