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.


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
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
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_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
http_log.pl  -- HTTP Logging moduleShow source
http_multipart_plugin.pl  -- Multipart form-data pluginShow source
http_open.pl  -- HTTP client libraryShow 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_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