SWI-Prolog HTTP support library

This directory provides the SWI-Prolog libraries for accessing and providing HTTP services. The client libraries come in two forms:

The primary server-library is thread_httpd.pl, providing full-blown scalable embedded HTTP server.

Further reading

Prolog files

ax.pl  -- Attribute Exchange libraryShow source
html_head.pl  -- Automatic inclusion of CSS and scripts linksShow source
html_current_resource/1True when About is a currently known resource.Source
html_requires/3Include ResourceOrList and all dependencies derived from it and add them to the HTML head using html_post/2.Source
html_resource/2Register an HTML head resource.Source
mime_include/4Hook called to include a link to an HTML resource of type Mime into the HTML head.Source
html_quasiquotations.plShow source
html/4The predicate html/4 implements HTML quasi quotations.Source
html_write.pl  -- Write HTML textShow source
http_authenticate.pl  -- Authenticate HTTP connections using 401 headersShow source
http_authenticate/3True if Request contains the information to continue according to Type.Source
http_authorization_data/2Decode the HTTP Authorization header.Source
http_current_user/3True when User is present in the htpasswd file File and Fields provides the additional fields.Source
http_read_passwd_file/2Read a password file.Source
http_write_passwd_file/2Write password data Data to File.Source
authenticate/3Plugin for library(http_dispatch) to perform basic HTTP authentication.Source
http_client.pl  -- HTTP client libraryShow source
post_data_hook/3Hook to extend the datatypes supported by the post(Data) option of http_open/3.Source
http_convert_data/4Multi-file hook to convert a HTTP payload according to the Content-Type header.Source
http_delete/3Execute a DELETE method on the server.Source
http_disconnect/1Close down some connections.Source
http_get/3Get data from a URL server and convert it to a suitable Prolog representation based on the Content-Type header and plugins.Source
http_patch/4Issue an HTTP PATCH request.Source
http_post/4Issue an HTTP POST request.Source
http_put/4Issue an HTTP PUT request.Source
http_read_data/3Read data from an HTTP connection and convert it according to the supplied to(Format) option or based on the Content-type in the Request.Source
http_cors.pl  -- Enable CORS: Cross-Origin Resource SharingShow source
cors_enable/0Emit the HTTP header Access-Control-Allow-Origin using domains from the setting http:cors.Source
cors_enable/2CORS reply to a Preflight OPTIONS request.Source
http_dirindex.pl  -- HTTP directory listingsShow source
http_dispatch.pl  -- Dispatch requests in the HTTP serverShow source
http_exception.pl  -- Map Prolog exceptions to HTTP errorsShow source
http_header.pl  -- Handling HTTP headersShow source
http_address/2HTML-rule that emits the location of the HTTP server.
mime_type_encoding/2Encoding is the (default) character encoding for MimeType.Source
status_page/3Hook 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/3Append headers from Default to Header if they are not already part of it.Source
http_parse_header/2Header is a list of Name(Value)-terms representing the structure of the HTTP header in Text.Source
http_parse_header_value/3Translate Value in a meaningful Prolog term.Source
http_post_data/3Send data on behalf on an HTTP POST request.Source
http_read_header/2Read Name: Value lines from FD until an empty line is encountered.Source
http_read_reply_header/2Read the HTTP reply header.Source
http_read_request/2Read an HTTP request-header from FdIn and return the broken-down request fields as +Name(+Value) pairs in a list.Source
http_reply/2Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out.Source
http_reply/3Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out.Source
http_reply/4Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out.Source
http_reply/5Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out.Source
http_reply/6Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out.Source
http_reply_header/3Create a reply header using reply_header//3 and send it to Stream.Source
http_status_reply/4Emit HTML non-200 status reports.Source
http_status_reply/5Emit HTML non-200 status reports.Source
http_timestamp/2Generate a description of a Time in HTTP format (RFC1123).Source
http_update_connection/4Merge keep-alive information from Request and CGIHeader into Header.Source
http_update_encoding/3Allow for rewrite of the header, adjusting the encoding.Source
http_update_transfer/4Decide on the transfer encoding from the Request and the CGI header.Source
http_hook.pl  -- HTTP library hooksShow source
convert_parameter/3Hook to execute a step in the HTTP parameter conversion process.
http_connection_over_proxy/6Try to connect to the host Endpoint via Proxy for the purposes of retrieving the resource identified by URLParts.Source
http_host.pl  -- Obtain public server locationShow source
http_current_host/4Source
http_public_host/4Current global host and port of the HTTP server.Source
http_public_host_url/2True when URL is the public URL at which this server can be contacted.Source
http_public_url/2True when URL is an absolute URL for the current request.Source
http_json.pl  -- HTTP JSON Plugin moduleShow source
post_data_hook/3Hook implementation that allows http_post_data/3 posting JSON objects using one of the forms below.Source
http_convert_data/4Hook implementation that supports reading JSON documents.Source
http_read_json/2Extract JSON data posted to this HTTP request.Source
http_read_json/3Extract JSON data posted to this HTTP request.Source
http_read_json_dict/2Similar to http_read_json/2,3, but by default uses the version 7 extended datatypes.Source
http_read_json_dict/3Similar to http_read_json/2,3, but by default uses the version 7 extended datatypes.Source
json_type/1True if MediaType is a JSON media type.Source
reply_json/1Formulate a JSON HTTP reply.Source
reply_json/2Formulate a JSON HTTP reply.Source
reply_json_dict/1As reply_json/1 and reply_json/2, but assumes the new dict based data representation.Source
reply_json_dict/2As reply_json/1 and reply_json/2, but assumes the new dict based data representation.Source
http_multipart_plugin.pl  -- Multipart form-data pluginShow source
http_open.pl  -- HTTP client libraryShow source
disable_encoding_filter/1Do not use the Content-encoding as Transfer-encoding encoding for specific values of ContentType.Source
open_options/2This hook is used by the HTTP client library to define default options based on the the broken-down request-URL.Source
update_cookies/3Update the cookie database.Source
write_cookies/3Emit a Cookie: header for the current connection.Source
http_close_keep_alive/1Close all keep-alive connections matching Address.Source
http_open/3Open the data at the HTTP server as a Prolog stream.Source
http_set_authorization/2Set user/password to supply with URLs that have URL as prefix.Source
open_hook/6Hook implementation that makes open_any/5 support http and https URLs for Mode == read.Source
http_openid.pl  -- OpenID consumer and server libraryShow source
http_parameters.pl  -- Extract parameters (GET and POST) from HTTP requestsShow source
http_convert_parameter/4Conversion of an HTTP form value.Source
http_convert_parameters/2Implements the parameter translation of http_parameters/2 or http_parameters/3.Source
http_convert_parameters/3Implements the parameter translation of http_parameters/2 or http_parameters/3.Source
http_parameters/2Get HTTP GET or POST form-data, applying type validation, default values, etc.Source
http_parameters/3Get HTTP GET or POST form-data, applying type validation, default values, etc.Source
http_path.pl  -- Abstract specification of HTTP server locationsShow source
http_server_files.pl  -- Serve files needed by modules from the serverShow source
serve_files_in_directory/2Serve files from the directory Alias from the path-info from Request.Source
http_session.pl  -- HTTP Session managementShow source
http_close_session/1Closes an HTTP session.Source
http_current_session/2Enumerate the current sessions and associated data.Source
http_in_session/1True if SessionId is an identifier for the current session.Source
http_open_session/2Establish a new session.Source
http_session_assert/1Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session.Source
http_session_asserta/1Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session.Source
http_session_cookie/1Generate a random cookie that can be used by a browser to identify the current session.Source
http_session_data/1True if Data is associated using http_session_assert/1 to the current HTTP session.Source
http_session_id/1True if SessionId is an identifier for the current session.Source
http_session_option/1True if Option is a current option of the session system.Source
http_session_retract/1Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session.Source
http_session_retractall/1Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session.Source
http_set_session/1Overrule a setting for the current or specified session.Source
http_set_session/2Overrule a setting for the current or specified session.Source
http_set_session_options/1Set options for the session library.Source
http_ssl_plugin.pl  -- SSL plugin for HTTP librariesShow source
http_connection_over_proxy/6Facilitate an HTTPS connection via a proxy using HTTP CONNECT.Source
http_protocol_hook/5Hook for http_open/3 to connect to an HTTPS (SSL-based HTTP) server.Source
open_options/2Implementation of the multifile hook http:open_options/2 used by library(http/http_open).Source
ssl_server_create_hook/3Extensible predicate that is called once after creating an HTTPS server.
ssl_server_open_client_hook/3Extensible predicate that is called before each connection that the server negotiates with a client.
accept_hook/2Implement the accept for HTTPS connections.Source
make_socket_hook/3Hook into http_server/2 to create an SSL server if the option ssl(SSLOptions) is provided.Source
http_stream.pl  -- HTTP StreamsShow source
http_unix_daemon.pl  -- Run SWI-Prolog HTTP server as a Unix system daemonShow source
http_wrapper.pl  -- Server processing of an HTTP requestShow source
jquery.pl  -- Provide JQueryShow source
js_grammar.pl  -- JavaScript grammarShow source
js_token/3Matches and classifies the next JavaScript token.Source
js_write.pl  -- Utilities for including JavaScriptShow source
json.pl  -- Reading and writing JSON serializationShow source
json_convert.pl  -- Convert between JSON terms and Prolog application termsShow source
mimepack.pl  -- Create a MIME messageShow source
mimetype.pl  -- Determine mime-type for a fileShow source
mime_extension/2Hook that is called by file_mime_type/2 before the default table is examined.Source
file_mime_type/2True when MimeType is the mime-type to be used for sending FileName.Source
term_html.pl  -- Represent Prolog terms as HTMLShow source
thread_httpd.pl  -- Threaded HTTP serverShow source
schedule_workers/1Hook called if a new connection or a keep-alive connection cannot be scheduled immediately to a worker.
http_add_worker/2Add a new worker to the HTTP server for port Port.Source
http_close_connection/1Close connection associated to Request.Source
http_current_server/2True if Goal is the goal of a server at Port.Source
http_current_worker/2True if ThreadID is the identifier of a Prolog thread serving Port.Source
http_enough_workers/3Check that we have enough workers in our queue.Source
http_requeue/1Re-queue a connection to the worker pool.Source
http_server/2Create a server at Port that calls Goal for each parsed request.Source
http_server_property/2True if Property is a property of the HTTP server running at Port.Source
http_spawn/2Continue this connection on a new thread.Source
http_stop_server/2Stop the indicated HTTP server gracefully.Source
http_workers/2Query or set the number of workers for the server at this port.Source
yadis.pl  -- Yadis discoveryShow source
xrds_dom/2True when XRDS_DOM is a parsed XML document for the given resource.Source
xrds_location/2Discover the location of the XRDS document from the given Id.Source
xrds_specified_location/2Hook that allows for specifying locations of XRDS documents.Source