This directory provides the SWI-Prolog libraries for accessing and providing HTTP services.
The main client library is library(http/http_open)
, which can open
both HTTP and HTTPS connections and handle all request methods.
The main server libraries are
library(http/thread_httpd)
implements the serverlibrary(http/http_dispatch)
implements binding locations
predicateslibrary(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 HTMLlibrary(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.
html_decl.pl -- HTML emitter analysis and IDE support![]() | ||
---|---|---|
html_head.pl -- Automatic inclusion of CSS and scripts links![]() | ||
html_quasiquotations.pl -- HTML quasi quotations![]() | ||
html_write.pl -- Write HTML text![]() | ||
http_client.pl -- HTTP client library![]() | ||
http_cors.pl -- Enable CORS: Cross-Origin Resource Sharing![]() | ||
http_dispatch.pl -- Dispatch requests in the HTTP server![]() | ||
http_dyn_workers.pl -- Dynamically schedule HTTP workers.![]() | ||
http_exception.pl -- Map Prolog exceptions to HTTP errors![]() | ||
http_header.pl -- Handling HTTP headers![]() | ||
http_hook.pl![]() | ||
convert_parameter/3 | Hook to execute a step in the HTTP parameter conversion process. | |
http_connection_over_proxy/6 | Try to connect to the host Endpoint via Proxy for the purposes of retrieving the resource identified by URLParts. | ![]() |
http_host.pl![]() | ||
http_current_host/4 | ![]() | |
http_public_host/4 | Current global host and port of the HTTP server. | ![]() |
http_public_host_url/2 | True when URL is the public URL at which this server can be contacted. | ![]() |
http_public_url/2 | True when URL is an absolute URL for the current request. | ![]() |
http_json.pl -- HTTP JSON Plugin module![]() | ||
http_log.pl![]() | ||
http_log/2 | Write message from Format and Args to log-stream. | ![]() |
http_log_close/1 | If there is a currently open HTTP logfile, close it after adding a term server(Reason, Time) . | ![]() |
http_log_stream/1 | True when Stream is a stream to the opened HTTP log file. | ![]() |
http_logrotate/1 | Rotate the available log files. | ![]() |
http_schedule_logrotate/2 | Schedule log rotation based on maintenance broadcasts. | ![]() |
nolog/1 | Multifile predicate that can be defined to hide request parameters from the request logfile. | ![]() |
password_field/1 | Multifile predicate that can be defined to hide passwords from the logfile. | ![]() |
post_data_encoded/2 | Encode the POST body for inclusion into the HTTP log file. | ![]() |
http_multipart_plugin.pl![]() | ||
http_convert_data/4 | Convert multipart/form-data messages for http_read_data/3. | ![]() |
http_open.pl![]() | ||
disable_encoding_filter/1 | Do not use the Content-encoding as Transfer-encoding encoding for specific values of ContentType. | ![]() |
http_close_keep_alive/1 | Close all keep-alive connections matching Address. | ![]() |
http_open/3 | Open the data at the HTTP server as a Prolog stream. | ![]() |
http_set_authorization/2 | Set user/password to supply with URLs that have URL as prefix. | ![]() |
keep_alive/4 | Callback when closing the range stream used to process the content of the reply. | ![]() |
map_method/2 | Support additional METHOD keywords. | ![]() |
open_hook/6 | Hook implementation that makes open_any/5 support http and https URLs for Mode == read . | ![]() |
http_parameters.pl -- Extract parameters (GET and POST) from HTTP requests![]() | ||
http_path.pl -- Abstract specification of HTTP server locations![]() | ||
http_redis_plugin.pl -- Hook session management to use Redis![]() | ||
http_server.pl -- HTTP server library![]() | ||
http_server_files.pl -- Serve files needed by modules from the server![]() | ||
http_server_health.pl![]() | ||
health/2 | Multifile extensible. | ![]() |
hide/1 | Multifile hook. | ![]() |
server_health/1 | HTTP handler that replies with the overall health of the server. | ![]() |
http_session.pl -- HTTP Session management![]() | ||
http_stream.pl -- HTTP Streams![]() | ||
http_unix_daemon.pl![]() | ||
sni_options/2 | Hook to provide Server Name Indication (SNI) for TLS servers. | |
http_certificate_hook/3 | Hook called before starting the server if the --https option is used. | ![]() |
http_daemon/0 | Start the HTTP server as a daemon process. | ![]() |
http_daemon/1 | Start the HTTP server as a daemon process. | ![]() |
http_opt_help/2 | Allow reusing http option processing. | ![]() |
http_opt_meta/2 | Allow reusing http option processing. | ![]() |
http_opt_type/3 | Allow reusing http option processing. | ![]() |
http_server_hook/1 | Hook that is called to start the HTTP server. | ![]() |
http_wrapper.pl -- Server processing of an HTTP request![]() | ||
hub.pl -- Manage a hub for websockets![]() | ||
js_grammar.pl -- JavaScript grammar![]() | ||
js_write.pl -- Utilities for including JavaScript![]() | ||
json.pl![]() | ||
atom_json_dict/3 | Convert between textual representation and a JSON term represented as a dict. | ![]() |
atom_json_term/3 | Convert between textual representation and a JSON term. | ![]() |
is_json_term/1 | True if Term is a json term. | ![]() |
is_json_term/2 | True if Term is a json term. | ![]() |
json/4 | The predicate json/4 implements JSON quasi quotations. | ![]() |
json_read/2 | Read next JSON value from Stream into a Prolog term. | ![]() |
json_read/3 | Read next JSON value from Stream into a Prolog term. | ![]() |
json_read_dict/2 | Read a JSON object, returning objects as a dicts. | ![]() |
json_read_dict/3 | Read a JSON object, returning objects as a dicts. | ![]() |
json_write_dict/2 | Write a JSON term, represented using dicts. | ![]() |
json_write_dict/3 | Write a JSON term, represented using dicts. | ![]() |
json_convert.pl![]() | ||
current_json_object/3 | Multifile predicate computed from the json_object/1 declarations. | ![]() |
json_object/1 | Declare a JSON object. | ![]() |
json_to_prolog/2 | Translate a JSON term into an application term. | ![]() |
prolog_bool_to_json/2 | JSON is the JSON boolean for Prolog. | ![]() |
prolog_to_json/2 | Translate a Prolog application Term into a JSON object term. | ![]() |
mimepack.pl -- Create a MIME message![]() | ||
mime_pack/3 | Pack a number of inputs into a MIME package using a specified or generated boundary. | ![]() |
mimetype.pl -- Determine mime-type for a file![]() | ||
term_html.pl![]() | ||
term/4 | Render a Prolog term as a structured HTML tree. | ![]() |
thread_httpd.pl -- Threaded HTTP server![]() | ||
websocket.pl![]() | ||
http_open_websocket/3 | Establish a client websocket connection. | ![]() |
http_upgrade_to_websocket/3 | Create a websocket connection running call(Goal, WebSocket) , where WebSocket is a socket-pair. | ![]() |
ws_close/3 | Close a WebSocket connection by sending a close message if this was not already sent and wait for the close reply. | ![]() |
ws_mask/1 | Produce a good random number of the mask of a client message. | ![]() |
ws_open/3 | Turn a raw TCP/IP (or any other binary stream) into a websocket stream. | ![]() |
ws_property/2 | True if Property is a property WebSocket. | ![]() |
ws_receive/2 | Receive the next message from WebSocket. | ![]() |
ws_receive/3 | Receive the next message from WebSocket. | ![]() |
ws_send/2 | Send a message over a websocket. | ![]() |