SWI-Prolog HTTP support library
This directory provides the SWI-Prolog libraries for accessing and providing HTTP services.
Client library
The main client library is library(http/http_open), which can open
both HTTP and HTTPS connections and handle all request methods.
Server library
The main server libraris 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.
Requirements
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.
Prolog files
ax.pl -- Attribute Exchange library![]() | ||
|---|---|---|
html_head.pl -- Automatic inclusion of CSS and scripts links![]() | ||
html_quasiquotations.pl -- HTML quasi quotations![]() | ||
html_write.pl -- Write HTML text![]() | ||
http_authenticate.pl -- Authenticate HTTP connections using 401 headers![]() | ||
http_client.pl -- HTTP client library![]() | ||
http_cors.pl -- Enable CORS: Cross-Origin Resource Sharing![]() | ||
| 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_dirindex.pl -- HTTP directory listings![]() | ||
http_dispatch.pl -- Dispatch requests in the HTTP server![]() | ||
http_dyn_workers.pl -- Dynamically schedule HTTP workers.![]() | ||
| schedule_workers/1 | Called if there is no immediately free worker to handle the incomming request. | ![]() |
http_exception.pl -- Map Prolog exceptions to HTTP errors![]() | ||
http_header.pl -- Handling HTTP headers![]() | ||
http_hook.pl -- HTTP library hooks![]() | ||
| convert_parameter/3 | Hook to execute a step in the HTTP parameter conversion process. | ![]() |
| http_connection_over_proxy/6 | Try to connect to the host Endpoint via Proxy for the purposes of retrieving the resource identified by URLParts. | ![]() |
http_host.pl -- Obtain public server location![]() | ||
| 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_json.pl -- HTTP JSON Plugin module![]() | ||
http_log.pl -- HTTP Logging module![]() | ||
| http_log/2 | Write message from Format and Args to log-stream. | ![]() |
| http_log_close/1 | If there is a currently open HTTP logfile, close it after adding a term server(Reason, Time). | ![]() |
| http_log_stream/1 | True when Stream is a stream to the opened HTTP log file. | ![]() |
| http_logrotate/1 | Rotate the available log files. | ![]() |
| http_schedule_logrotate/2 | Schedule log rotation based on maintenance broadcasts. | ![]() |
| nolog/1 | Multifile predicate that can be defined to hide request parameters from the request logfile. | ![]() |
| nolog_post_content_type/1 | Multifile hook called with the Content-type header. | ![]() |
| password_field/1 | Multifile predicate that can be defined to hide passwords from the logfile. | ![]() |
| post_data_encoded/2 | Encode the POST body for inclusion into the HTTP log file. | ![]() |
http_multipart_plugin.pl -- Multipart form-data plugin![]() | ||
| http_convert_data/4 | Convert multipart/form-data messages for http_read_data/3. | ![]() |
http_open.pl -- HTTP client library![]() | ||
| disable_encoding_filter/1 | Do not use the Content-encoding as Transfer-encoding encoding for specific values of ContentType. | ![]() |
| http_close_keep_alive/1 | Close all keep-alive connections matching Address. | ![]() |
| http_open/3 | Open the data at the HTTP server as a Prolog stream. | ![]() |
| http_set_authorization/2 | Set user/password to supply with URLs that have URL as prefix. | ![]() |
| keep_alive/4 | Callback when closing the range stream used to process the content of the reply. | ![]() |
| map_method/2 | Support additional METHOD keywords. | ![]() |
| open_hook/6 | Hook implementation that makes open_any/5 support http and https URLs for Mode == read. | ![]() |
http_openid.pl -- OpenID consumer and server library![]() | ||
http_parameters.pl -- Extract parameters (GET and POST) from HTTP requests![]() | ||
| 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_server.pl -- HTTP server library![]() | ||
http_server_files.pl -- Serve files needed by modules from the server![]() | ||
| serve_files_in_directory/2 | Serve files from the directory Alias from the path-info from Request. | ![]() |
http_server_health.pl -- HTTP Server health statistics![]() | ||
http_session.pl -- HTTP Session management![]() | ||
http_stream.pl -- HTTP Streams![]() | ||
http_unix_daemon.pl -- Run SWI-Prolog HTTP server as a Unix system daemon![]() | ||
http_wrapper.pl -- Server processing of an HTTP request![]() | ||
hub.pl -- Manage a hub for websockets![]() | ||
js_grammar.pl -- JavaScript grammar![]() | ||
js_write.pl -- Utilities for including JavaScript![]() | ||
json.pl -- Reading and writing JSON serialization![]() | ||
| atom_json_dict/3 | Convert between textual representation and a JSON term represented as a dict. | ![]() |
| atom_json_term/3 | Convert between textual representation and a JSON term. | ![]() |
| is_json_term/1 | True if Term is a json term. | ![]() |
| is_json_term/2 | True if Term is a json term. | ![]() |
| json_dict_pairs/2 | This hook may be used to order the keys of an object. | ![]() |
| json_read/2 | Read next JSON value from Stream into a Prolog term. | ![]() |
| json_read/3 | Read next JSON value from Stream into a Prolog term. | ![]() |
| json_read_dict/2 | Read a JSON object, returning objects as a dicts. | ![]() |
| json_read_dict/3 | Read a JSON object, returning objects as a dicts. | ![]() |
| json_write/2 | Write a JSON term to Stream. | ![]() |
| json_write/3 | Write a JSON term to Stream. | ![]() |
| json_write_dict/2 | Write a JSON term, represented using dicts. | ![]() |
| json_write_dict/3 | Write a JSON term, represented using dicts. | ![]() |
| json_write_hook/4 | Hook that can be used to emit a JSON representation for Term to Stream. | ![]() |
json_convert.pl -- Convert between JSON terms and Prolog application terms![]() | ||
mimepack.pl -- Create a MIME message![]() | ||
mimetype.pl -- Determine mime-type for a file![]() | ||
term_html.pl -- Represent Prolog terms as HTML![]() | ||
thread_httpd.pl![]() | ||
websocket.pl -- WebSocket support![]() | ||
yadis.pl -- Yadis discovery![]() | ||
| ssl_verify/5 | Accept all certificates. | ![]() |
| xrds_dom/2 | True when XRDS_DOM is a parsed XML document for the given resource. | ![]() |
| xrds_location/2 | Discover the location of the XRDS document from the given Id. | ![]() |
