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/4 | The predicate html/4 implements HTML quasi quotations. | ![]() |
html_write.pl -- Write HTML text![]() | ||
http_client.pl -- HTTP client library![]() | ||
http_cors.pl![]() | ||
| cors_enable/0 | Emit the HTTP header Access-Control-Allow-Origin using domains from the setting http:cors. | ![]() |
| cors_enable/2 | CORS reply to a Preflight OPTIONS request. | ![]() |
http_dispatch.pl -- Dispatch requests in the HTTP server![]() | ||
http_dyn_workers.pl -- Dynamically schedule HTTP workers.![]() | ||
http_exception.pl![]() | ||
| bad_request_error/2 | If an exception of the term error(Formal, context(Stack, Context)) is caught and subsumes_term(ContextTemplate, Context) is true, translate the exception into an HTTP 400 exception. | |
| in_or_exclude_backtrace/2 | Remove the stacktrace from the exception, unless setting http:client_backtrace is true. | ![]() |
| map_exception_to_http_status/4 | Map certain exceptions to HTTP status codes. | ![]() |
http_header.pl![]() | ||
| http_address/2 | HTML-rule that emits the location of the HTTP server. | |
| mime_type_encoding/2 | Encoding is the (default) character encoding for MimeType. | |
| serialize_reply/2 | Multifile hook to serialize the result of status_reply/3 into a term. | ![]() |
| status_page/3 | Hook called by http_status_reply/4 and http_status_reply/5 that allows for emitting custom error pages for the following HTTP page types:. | |
| http_join_headers/3 | Append headers from Default to Header if they are not already part of it. | ![]() |
| http_parse_header/2 | Header is a list of Name(Value)-terms representing the structure of the HTTP header in Text. | ![]() |
| http_parse_header_value/3 | Translate Value in a meaningful Prolog term. | ![]() |
| http_post_data/3 | Send data on behalf on an HTTP POST request. | ![]() |
| http_read_header/2 | Read Name: Value lines from FD until an empty line is encountered. | ![]() |
| http_read_reply_header/2 | Read the HTTP reply header. | ![]() |
| http_read_request/2 | Read an HTTP request-header from FdIn and return the broken-down request fields as +Name(+Value) pairs in a list. | ![]() |
| http_reply/2 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/3 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/4 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/5 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply/6 | Compose a complete HTTP reply from the term Data using additional headers from HdrExtra to the output stream Out. | ![]() |
| http_reply_header/3 | Create a reply header using reply_header//3 and send it to Stream. | ![]() |
| http_status_reply/4 | Emit HTML non-200 status reports. | ![]() |
| http_status_reply/5 | Emit HTML non-200 status reports. | ![]() |
| http_timestamp/2 | Convert between a SWI-Prolog time stamp and a string in HTTP format (RFC1123). | ![]() |
| http_update_connection/4 | Merge keep-alive information from Request and CGIHeader into Header. | ![]() |
| http_update_encoding/3 | Allow for rewrite of the header, adjusting the encoding. | ![]() |
| http_update_transfer/4 | Decide on the transfer encoding from the Request and the CGI header. | ![]() |
http_hook.pl -- HTTP library hooks![]() | ||
http_host.pl -- Obtain public server location![]() | ||
http_log.pl -- HTTP Logging module![]() | ||
http_multipart_plugin.pl -- Multipart form-data plugin![]() | ||
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![]() | ||
| location/3 | Multifile hook used to specify new HTTP locations. | ![]() |
| http_absolute_location/3 | Path is the HTTP location for the abstract specification Spec. | ![]() |
| http_absolute_uri/2 | URI is the absolute (i.e., starting with http://) URI for the abstract specification Spec. | ![]() |
| http_clean_location_cache/0 | HTTP locations resolved through http_absolute_location/3 are cached. | ![]() |
http_redis_plugin.pl -- Hook session management to use Redis![]() | ||
http_server.pl -- HTTP server library![]() | ||
http_server_files.pl![]() | ||
| serve_files_in_directory/2 | Serve files from the directory Alias from the path-info from Request. | ![]() |
http_server_health.pl -- HTTP Server health statistics![]() | ||
http_session.pl -- HTTP Session management![]() | ||
http_stream.pl![]() | ||
| current_transfer_encoding/1 | True if Encoding is supported. | ![]() |
| encoding_filter/3 | Install a filter to deal with chunked encoded messages. | ![]() |
| cgi_discard/1 | Discard content produced so far. | ![]() |
| cgi_open/4 | Process CGI output. | ![]() |
| cgi_property/2 | Inquire the status of the CGI stream. | ![]() |
| cgi_set/2 | Change one of the properties. | ![]() |
| cgi_statistics/1 | Return statistics on the CGI stream subsystem. | ![]() |
| http_chunked_add_trailer/3 | Add a trailer key/value to DataStream. | ![]() |
| http_chunked_flush/2 | Emits the next chunk flush_output/1 on DataStream, but in addition adds extension parameters to the chunk. | ![]() |
| http_chunked_open/3 | Create a stream to realise HTTP chunked encoding or decoding. | ![]() |
| http_is_chunked/1 | True if DataStream is created using http_chunked_open/3. | ![]() |
| is_cgi_stream/1 | True if Stream is a CGI stream created using cgi_open/4. | ![]() |
| multipart_open/3 | DataStream is a stream that signals end_of_file if the multipart boundary is encountered. | ![]() |
| multipart_open_next/1 | Prepare DataStream to read the next part from the multipart input data. | ![]() |
| stream_range_open/3 | DataStream is a stream whose size is defined by the option size(ContentLength). | ![]() |
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![]() | ||
| current_hub/2 | True when there exists a hub Hub with Name. | ![]() |
| hub_add/3 | Add a WebSocket to the hub. | ![]() |
| hub_broadcast/2 | Send Message to all websockets associated with Hub for which call(Condition, Id) succeeds. | ![]() |
| hub_broadcast/3 | Send Message to all websockets associated with Hub for which call(Condition, Id) succeeds. | ![]() |
| hub_create/3 | Create a new hub. | ![]() |
| hub_member/2 | True when Id is a member of the hub HubName. | ![]() |
| hub_send/2 | Send message to the indicated ClientId. | ![]() |
js_write.pl -- Utilities for including JavaScript![]() | ||
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 -- Represent Prolog terms as HTML![]() | ||
thread_httpd.pl![]() | ||
| schedule_workers/1 | Hook called if a new connection or a keep-alive connection cannot be scheduled immediately to a worker. | ![]() |
| http_add_worker/2 | Add a new worker to the HTTP server for port Port. | ![]() |
| http_close_connection/1 | Close connection associated to Request. | ![]() |
| http_current_server/2 | True if Goal is the goal of a server at Port. | ![]() |
| http_current_worker/2 | True if ThreadID is the identifier of a Prolog thread serving Port. | ![]() |
| http_enough_workers/3 | Check that we have enough workers in our queue. | ![]() |
| http_requeue/1 | Re-queue a connection to the worker pool. | ![]() |
| http_server/2 | Create a server at Port that calls Goal for each parsed request. | ![]() |
| http_server_property/2 | True if Property is a property of the HTTP server running at Port. | ![]() |
| http_spawn/2 | Continue this connection on a new thread. | ![]() |
| http_stop_server/2 | Stop the indicated HTTP server gracefully. | ![]() |
| http_workers/2 | Query or set the number of workers for the server at this port. | ![]() |
| message_level/2 | Determine the message stream used for exceptions that may occur during server_loop/5. | ![]() |
websocket.pl -- WebSocket support![]() | ||