Did you know ... Search Documentation:
Title for pldoc(dir_index)

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 server
  • library(http/http_dispatch) implements binding locations predicates
  • library(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 HTML
  • library(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 libraryShow source
graphql.pl  -- GraphQL interfaceShow source
graphql/4Quasi-quotation syntax for embedding GraphQL in Prolog text.Source
graphql_auth_token_hook/2Multifile, dynamic hook.Source
graphql_document_to_codes/3Serialize Document, a Prolog term representing a GraphQL document as obtained from graphql_read_document/3 or the graphql/4 quasi-quotation, and unify Codes with the resulting list of character codes.Source
graphql_document_to_string/3Serialize the GraphQL document Document and unify String with the resulting string.Source
graphql_execute_document/4Send GraphQL document Document to be executed by the GraphQL endpoint at URI.Source
graphql_read_document/3True when Document is a term representing the abstract syntax tree obtained from parsing Source as a GraphQL executable document.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_insert_resource/3Actually include HTML head resources.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.pl  -- HTML quasi quotationsShow 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_cookie.pl  -- HTTP client cookie handlingShow source
update_cookies/3Update the client cookie database.Source
write_cookies/3Emit a cookie header for the current request.Source
cookie_remove_all_clients/0Simply logout all clients.Source
cookie_remove_client/1Fake user quitting a browser.Source
http_cors.pl  -- Enable CORS: Cross-Origin Resource SharingShow source
http_digest.pl  -- HTTP Digest authenticationShow source
http_dirindex.pl  -- HTTP directory listingsShow source
mime_type_icon/2Multi-file hook predicate that can be used to associate icons to files listed by http_reply_dirindex/3.Source
directory_index/4Show index for a directory.Source
http_reply_dirindex/3Provide a directory listing for Request, assuming it is an index for the physical directrory Dir.Source
http_dispatch.pl  -- Dispatch requests in the HTTP serverShow source
http_dyn_workers.pl  -- Dynamically schedule HTTP workers.Show source
http_error.pl  -- Decorate uncaught HTTP exceptions with stack-traceShow source
http_exception.pl  -- Map Prolog exceptions to HTTP errorsShow source
http_files.pl  -- Serve plain files from a hierarchyShow source
http_reply_from_files/3HTTP handler that serves files from the directory Dir.Source
http_header.pl  -- Handling HTTP headersShow source
http_hook.pl  -- HTTP library hooksShow source
http_host.pl  -- Obtain public server locationShow source
http_json.pl  -- HTTP JSON Plugin moduleShow source
http_load.pl  -- Load Prolog code from a web serverShow source
http_log.pl  -- HTTP Logging moduleShow source
http_log/2Write message from Format and Args to log-stream.Source
http_log_close/1If there is a currently open HTTP logfile, close it after adding a term server(Reason, Time).Source
http_log_stream/1True when Stream is a stream to the opened HTTP log file.Source
http_logrotate/1Rotate the available log files.Source
http_schedule_logrotate/2Schedule log rotation based on maintenance broadcasts.Source
nolog/1Multifile predicate that can be defined to hide request parameters from the request logfile.Source
nolog_post_content_type/1Multifile hook called with the Content-type header.Source
password_field/1Multifile predicate that can be defined to hide passwords from the logfile.Source
post_data_encoded/2Encode the POST body for inclusion into the HTTP log file.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
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
map_method/2Support additional METHOD keywords.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
openid_associate/3Calls openid_associate/4 as.Source
openid_associate/4Associate with an open-id server.Source
openid_authenticate/4Succeeds if Request comes from the OpenID server and confirms that User is a verified OpenID user.Source
openid_current_host/3Find current location of the server.Source
openid_current_url/2Find the public URL for Request that we can make available to our identity provider.Source
openid_grant/1Handle the reply from checkid_setup_server/3.Source
openid_hook/1Call hook on the OpenID management library.Source
openid_logged_in/1True if session is associated with OpenID.Source
openid_login/1Associate the current HTTP session with OpenID.Source
openid_login_form/4Create the OpenID form.Source
openid_logout/1Remove the association of the current session with any OpenID.Source
openid_server/2Realise the OpenID server.Source
openid_server/3True if OpenIDLogin is the typed id for OpenID verified by Server.Source
openid_user/3True if OpenID is a validated OpenID associated with the current session.Source
openid_verify/2Handle the initial login form presented to the user by the relying party (consumer).Source
ssl_verify/5Accept all certificates.Source
http_parameters.pl  -- Extract parameters (GET and POST) from HTTP requestsShow source
http_path.pl  -- Abstract specification of HTTP server locationsShow source
http_proxy.pl  -- Use HTTP network proxiesShow source
http_pwp.pl  -- Serve PWP pages through the HTTP serverShow source
http_redis_plugin.pl  -- Hook session management to use RedisShow source
http_server.pl  -- HTTP server libraryShow source
http_server_files.pl  -- Serve files needed by modules from the serverShow source
http_session.pl  -- HTTP Session managementShow source
http_sgml_plugin.pl  -- Parse of HTML and XML documents for the HTTP client libsShow source
http_ssl_plugin.pl  -- SSL plugin for HTTP librariesShow 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
hub.pl  -- Manage a hub for websocketsShow 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
javascript/4Quasi quotation parser for JavaScript that allows for embedding Prolog variables to substitude identifiers in the JavaScript snippet.Source
js_arg/3Same as js_expression//1, but fails if Expression is invalid, where js_expression//1 raises an error.Source
js_arg_list/3Write javascript (function) arguments.Source
js_call/3Emit a call to a Javascript function.Source
js_expression/3Emit a single JSON argument.Source
js_new/4Emit a call to a Javascript object declaration.Source
js_script/3Generate a JavaScript script element with the given content.Source
json.pl  -- Reading and writing JSON serializationShow source
json_convert.pl  -- Convert between JSON terms and Prolog application termsShow source
current_json_object/3Multifile predicate computed from the json_object/1 declarations.Source
json_object/1Declare a JSON object.Source
json_to_prolog/2Translate a JSON term into an application term.Source
prolog_bool_to_json/2JSON is the JSON boolean for Prolog.Source
prolog_to_json/2Translate a Prolog application Term into a JSON object term.Source
mimepack.pl  -- Create a MIME messageShow source
mime_pack/3Pack a number of inputs into a MIME package using a specified or generated boundary.Source
mimetype.pl  -- Determine mime-type for a fileShow source
charset/3Hook that determines the Charset for File that has media type MediaType.
mime_extension/2Hook that is called by file_mime_type/2 before the default table is examined.
file_content_type/2True if File should be served using ContentType: ContentType.Source
file_content_type/3True if File should be served using ContentType: ContentType.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
websocket.pl  -- WebSocket supportShow source
yadis.pl  -- Yadis discoveryShow source
ssl_verify/5Accept all certificates.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