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 libraries 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_decl.pl  -- HTML emitter analysis and IDE supportShow 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
htmx_oob/4Emit an htmx out-of-band element.Source
reply_htmx/1Reply a plain HTML element as opposed to a complete HTML page as created using reply_html_page/2,3.Source
reply_htmx/2Reply a plain HTML element as opposed to a complete HTML page as created using reply_html_page/2,3.Source
http_authenticate.plShow 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
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
authenticate/3Plugin for library(http_dispatch) to perform basic HTTP authentication.Source
authenticate_client/2This hooks is called by http_open/3 with the following Action value:.Source
http_digest_challenge/4Generate the content for a 401 WWW-Authenticate: Digest header field.Source
http_digest_password_hash/4Compute the password hash for the HTTP password file.Source
http_digest_response/5Formulate a reply to a digest authentication request.Source
http_parse_digest_challenge/2Parse the value of an HTTP WWW-Authenticate header into a list of Name(Value) terms.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
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
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
try_proxy/4Connection is via an HTTP proxy for socket: Use HTTP CONNECT.Source
http_pwp.pl  -- Serve PWP pages through the HTTP serverShow source
pwp_handler/2Handle PWP files.Source
reply_pwp_page/3Reply a PWP file.Source
http_redis_plugin.pl  -- Hook session management to use RedisShow source
http_server.pl  -- HTTP server libraryShow source
http_server/1Create an HTTP server using http_dispatch/1 for handling requests.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
current_hub/2True when there exists a hub Hub with Name.Source
hub_add/3Add a WebSocket to the hub.Source
hub_broadcast/2Send Message to all websockets associated with Hub for which call(Condition, Id) succeeds.Source
hub_broadcast/3Send Message to all websockets associated with Hub for which call(Condition, Id) succeeds.Source
hub_create/3Create a new hub.Source
hub_member/2True when Id is a member of the hub HubName.Source
hub_send/2Send message to the indicated ClientId.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
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
term_html.pl  -- Represent Prolog terms as HTMLShow source
thread_httpd.plShow source
schedule_workers/1Hook called if a new connection or a keep-alive connection cannot be scheduled immediately to a worker.Source
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
message_level/2Determine the message stream used for exceptions that may occur during server_loop/5.Source
websocket.pl  -- WebSocket supportShow source
yadis.plShow 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