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
html_head.pl  -- Automatic inclusion of CSS and scripts linksShow source
html_quasiquotations.pl  -- HTML quasi quotationsShow source
html_write.pl  -- Write HTML textShow source
htmx.pl  -- Support htmx.orgShow source
http_authenticate.pl  -- Authenticate HTTP connections using 401 headersShow source
http_client.pl  -- HTTP client libraryShow 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
http_dispatch.pl  -- Dispatch requests in the HTTP serverShow source
http_404/2Reply using an "HTTP 404 not found" page.Source
http_current_handler/2True if Location is handled by Closure.Source
http_current_handler/3Resolve the current handler and options to execute it.Source
http_delete_handler/1Delete handler for Spec.Source
http_dispatch/1Dispatch a Request using http_handler/3 registrations.Source
http_handler/3Register Closure as a handler for HTTP requests.Source
http_link_to_id/3HREF is a link on the local server to a handler with given ID, passing the given Parameters.Source
http_location_by_id/2True when Location represents the HTTP path to which the handler with identifier ID is bound.Source
http_redirect/3Redirect to a new location.Source
http_reload_with_parameters/3Create a request on the current handler with replaced search parameters.Source
http_reply_file/3Options is a list of.Source
http_request_expansion/2Register Goal for expanding the HTTP request handler.Source
http_safe_file/2True if FileSpec is considered safe.Source
http_switch_protocol/2Send an "HTTP 101 Switching Protocols" reply.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_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
prolog_load_file/2Hook into load_files/2 that loads http:// and https:// resources directly from the web.Source
http_log.pl  -- HTTP Logging moduleShow 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
keep_alive/4Callback when closing the range stream used to process the content of the reply.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
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_server_health.pl  -- HTTP Server health statisticsShow 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_assert/2Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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_asserta/2Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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_data/2Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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_retract/2Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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_session_retractall/2Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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
session_setting/2Find setting for SessionID.Source
http_sgml_plugin.pl  -- Parse of HTML and XML documents for the HTTP client libsShow 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
js_grammar.pl  -- JavaScript grammarShow 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
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