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![]() | ||
| 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![]() | ||
| schedule_workers/1 | Called if there is no immediately free worker to handle the incoming request. | ![]() |
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 -- 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_log.pl -- HTTP Logging module![]() | ||
http_multipart_plugin.pl -- Multipart form-data plugin![]() | ||
http_open.pl -- HTTP client library![]() | ||
http_parameters.pl -- Extract parameters (GET and POST) from HTTP requests![]() | ||
http_path.pl -- Abstract specification of HTTP server locations![]() | ||
http_redis_plugin.pl![]() | ||
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 -- HTTP Streams![]() | ||
http_unix_daemon.pl -- Run SWI-Prolog HTTP server as a Unix system daemon![]() | ||
http_wrapper.pl![]() | ||
| cgi_hook/2 | Hook called from the CGI processing stream. | ![]() |
| http_current_request/1 | Returns the HTTP request currently being processed. | ![]() |
| http_peer/2 | True when PeerIP is the IP address of the connection peer. | ![]() |
| http_relative_path/2 | Convert an absolute path (without host, fragment or search) into a path relative to the current page. | ![]() |
| http_send_header/1 | This API provides an alternative for writing the header field as a CGI header. | ![]() |
| http_spawned/1 | Internal use only. | ![]() |
| http_wrap_spawned/3 | Internal use only. | ![]() |
hub.pl -- Manage a hub for websockets![]() | ||
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![]() | ||
| 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. | ![]() |