This directory provides the SWI-Prolog libraries for accessing and providing HTTP services.
The main client library is library(http/http_open), which can open
both HTTP and HTTPS connections and handle all request methods.
The main server libraries are
library(http/thread_httpd) implements the serverlibrary(http/http_dispatch) implements binding locations
predicateslibrary(http/http_unix_daemon) implements integration in various
Unix server managers and in general provides a suitable entry point
for HTTP servers on Unix.library(http/html_write) implements generating HTMLlibrary(http/http_json) implements reading and writing JSON documents.
For simplicity, you can use library(http/http_server), which
combines the typical HTTP libraries that most servers need. The
idea of a common request handling system and three controlling
libraries is outdated; the threaded server now being the only sensible
controlling library.
This library uses functionality from the ssl package to support HTTPS,
the sgml package to read XML/HTML and the clib package for various
extensions.
html_decl.pl -- HTML emitter analysis and IDE support![]() | ||
|---|---|---|
html_head.pl -- Automatic inclusion of CSS and scripts links![]() | ||
html_quasiquotations.pl -- HTML quasi quotations![]() | ||
html_write.pl -- Write HTML text![]() | ||
http_client.pl![]() | ||
| post_data_hook/3 | Hook to extend the datatypes supported by the post(Data) option of http_open/3. | ![]() |
| http_convert_data/4 | Multi-file hook to convert a HTTP payload according to the Content-Type header. | ![]() |
| http_delete/3 | Execute a DELETE method on the server. | ![]() |
| http_disconnect/1 | Close down some connections. | ![]() |
| http_get/3 | Get data from a URL server and convert it to a suitable Prolog representation based on the Content-Type header and plugins. | ![]() |
| http_patch/4 | Issue an HTTP PATCH request. | ![]() |
| http_post/4 | Issue an HTTP POST request. | ![]() |
| http_put/4 | Issue an HTTP PUT request. | ![]() |
| http_read_data/3 | Read data from an HTTP connection and convert it according to the supplied to(Format) option or based on the Content-type in the Request. | ![]() |
http_cors.pl![]() | ||
| cors_enable/0 | Emit the HTTP header Access-Control-Allow-Origin using domains from the setting http:cors. | ![]() |
| cors_enable/2 | CORS reply to a Preflight OPTIONS request. | ![]() |
http_dispatch.pl -- Dispatch requests in the HTTP server![]() | ||
http_dyn_workers.pl![]() | ||
| schedule_workers/1 | Called if there is no immediately free worker to handle the incoming request. | ![]() |
http_exception.pl -- Map Prolog exceptions to HTTP errors![]() | ||
http_header.pl![]() | ||
| http_address/2 | HTML-rule that emits the location of the HTTP server. | |
| mime_type_encoding/2 | Encoding is the (default) character encoding for MimeType. | |
| serialize_reply/2 | Multifile hook to serialize the result of status_reply/3 into a term. | ![]() |
| status_page/3 | Hook called by http_status_reply/4 and http_status_reply/5 that allows for emitting custom error pages for the following HTTP page types:. | |
| http_join_headers/3 | Append headers from Default to Header if they are not already part of it. | ![]() |
| http_parse_header/2 | Header is a list of Name(Value)-terms representing the structure of the HTTP header in Text. | ![]() |
| http_parse_header_value/3 | Translate Value in a meaningful Prolog term. | ![]() |
| http_post_data/3 | Send data on behalf on an HTTP POST request. | ![]() |
| http_read_header/2 | Read Name: Value lines from FD until an empty line is encountered. | ![]() |
| http_read_reply_header/2 | Read the HTTP reply header. | ![]() |
| http_read_request/2 | Read an HTTP request-header from FdIn and return the broken-down request fields as +Name(+Value) pairs in a list. | ![]() |
| http_reply/2 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/3 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/4 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/5 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/6 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply_header/3 | Create a reply header using reply_header//3 and send it to Stream. | ![]() |
| http_status_reply/4 | Emit HTML non-200 status reports. | ![]() |
| http_status_reply/5 | Emit HTML non-200 status reports. | ![]() |
| http_timestamp/2 | Convert between a SWI-Prolog time stamp and a string in HTTP format (RFC1123). | ![]() |
| http_update_connection/4 | Merge keep-alive information from Request and CGIHeader into Header. | ![]() |
| http_update_encoding/3 | Allow for rewrite of the header, adjusting the encoding. | ![]() |
| http_update_transfer/4 | Decide on the transfer encoding from the Request and the CGI header. | ![]() |
http_hook.pl -- HTTP library hooks![]() | ||
http_host.pl![]() | ||
| http_current_host/4 | ![]() | |
| http_public_host/4 | Current global host and port of the HTTP server. | ![]() |
| http_public_host_url/2 | True when URL is the public URL at which this server can be contacted. | ![]() |
| http_public_url/2 | True when URL is an absolute URL for the current request. | ![]() |
http_log.pl -- HTTP Logging module![]() | ||
http_multipart_plugin.pl -- Multipart form-data plugin![]() | ||
http_open.pl -- HTTP client library![]() | ||
http_parameters.pl![]() | ||
| http_convert_parameter/4 | Conversion of an HTTP form value. | ![]() |
| http_convert_parameters/2 | Implements the parameter translation of http_parameters/2 or http_parameters/3. | ![]() |
| http_convert_parameters/3 | Implements the parameter translation of http_parameters/2 or http_parameters/3. | ![]() |
| http_parameters/2 | Get HTTP GET or POST form-data, applying type validation, default values, etc. | ![]() |
| http_parameters/3 | Get HTTP GET or POST form-data, applying type validation, default values, etc. | ![]() |
http_path.pl -- Abstract specification of HTTP server locations![]() | ||
http_redis_plugin.pl -- Hook session management to use Redis![]() | ||
http_server.pl -- HTTP server library![]() | ||
http_server_files.pl -- Serve files needed by modules from the server![]() | ||
http_server_health.pl -- HTTP Server health statistics![]() | ||
http_session.pl -- HTTP Session management![]() | ||
http_stream.pl -- HTTP Streams![]() | ||
http_unix_daemon.pl![]() | ||
| sni_options/2 | Hook to provide Server Name Indication (SNI) for TLS servers. | |
| http_certificate_hook/3 | Hook called before starting the server if the --https option is used. | ![]() |
| http_daemon/0 | Start the HTTP server as a daemon process. | ![]() |
| http_daemon/1 | Start the HTTP server as a daemon process. | ![]() |
| http_opt_help/2 | Allow reusing http option processing. | ![]() |
| http_opt_meta/2 | Allow reusing http option processing. | ![]() |
| http_opt_type/3 | Allow reusing http option processing. | ![]() |
| http_server_hook/1 | Hook that is called to start the HTTP server. | ![]() |
http_wrapper.pl -- Server processing of an HTTP request![]() | ||
hub.pl![]() | ||
| current_hub/2 | True when there exists a hub Hub with Name. | ![]() |
| hub_add/3 | Add a WebSocket to the hub. | ![]() |
| hub_broadcast/2 | Send Message to all websockets associated with Hub for which call(Condition, Id) succeeds. | ![]() |
| hub_broadcast/3 | Send Message to all websockets associated with Hub for which call(Condition, Id) succeeds. | ![]() |
| hub_create/3 | Create a new hub. | ![]() |
| hub_member/2 | True when Id is a member of the hub HubName. | ![]() |
| hub_send/2 | Send message to the indicated ClientId. | ![]() |
js_write.pl![]() | ||
| javascript/4 | Quasi quotation parser for JavaScript that allows for embedding Prolog variables to substitude identifiers in the JavaScript snippet. | ![]() |
| js_arg/3 | Same as js_expression//1, but fails if Expression is invalid, where js_expression//1 raises an error. | ![]() |
| js_arg_list/3 | Write javascript (function) arguments. | ![]() |
| js_call/3 | Emit a call to a Javascript function. | ![]() |
| js_expression/3 | Emit a single JSON argument. | ![]() |
| js_new/4 | Emit a call to a Javascript object declaration. | ![]() |
| js_script/3 | Generate a JavaScript script element with the given content. | ![]() |
mimepack.pl -- Create a MIME message![]() | ||
| mime_pack/3 | Pack a number of inputs into a MIME package using a specified or generated boundary. | ![]() |
mimetype.pl -- Determine mime-type for a file![]() | ||
term_html.pl -- Represent Prolog terms as HTML![]() | ||
thread_httpd.pl -- Threaded HTTP server![]() | ||
websocket.pl -- WebSocket support![]() | ||