SWI-Prolog HTTP support library
This directory provides the SWI-Prolog libraries for accessing and providing HTTP services. The client libraries come in two forms:
- The lightweight http_open.pl opens an HTTP location as a stream
- The more full-blown http_client.pl performs arbitrary HTTP requests and, depending on loaded plugins, transforms the data in a Prolog-friendly format.
The primary server-library is thread_httpd.pl, providing full-blown scalable embedded HTTP server.
Further reading
- ../../packages/http.pdf
- ../../packages/examples/http contains some demos.
- http://www.swi-prolog.org/pldoc/package/http.html
Prolog files
ax.pl -- Attribute Exchange library![]() | ||
|---|---|---|
html_head.pl -- Automatic inclusion of CSS and scripts links![]() | ||
html_quasiquotations.pl -- HTML quasi quotations![]() | ||
| html/4 | The predicate html/4 implements HTML quasi quotations. | ![]() |
html_write.pl -- Write HTML text![]() | ||
| html/3 | Generate HTML from Content. | ![]() |
| html_begin/3 | For html_begin//1, Env is a term Env(Attributes); for html_end//1 it is the plain environment name. | ![]() |
| html_current_option/1 | True if Option is an active option for the HTML generator. | ![]() |
| html_end/3 | For html_begin//1, Env is a term Env(Attributes); for html_end//1 it is the plain environment name. | ![]() |
| html_meta/1 | This directive can be used to declare that an HTML rendering rule takes HTML content as argument. | ![]() |
| html_post/4 | Reposition HTML to the receiving Id. | ![]() |
| html_print_length/2 | Determine the content length of a token list produced using html//1. | ![]() |
| html_quoted/3 | Quote the value for normal (CDATA) text. | ![]() |
| html_quoted_attribute/3 | Quote the value according to the rules for tag-attributes included in double-quotes. | ![]() |
| html_receive/3 | Receive posted HTML tokens. | ![]() |
| html_receive/4 | This extended version of html_receive//1 causes Handler to be called to process all messages posted to the channal at the time output is generated. | ![]() |
| html_root_attribute/4 | Add an attribute to the HTML root element of the page. | ![]() |
| html_set_options/1 | Set options for the HTML output. | ![]() |
| layout/3 | Define required newlines before and after tags. | ![]() |
| page/3 | Generate a page including the HTML <!DOCTYPE> header. | ![]() |
| page/4 | Generate a page including the HTML <!DOCTYPE> header. | ![]() |
| print_html/1 | Print list of atoms and layout instructions. | ![]() |
| print_html/2 | Print list of atoms and layout instructions. | ![]() |
| reply_html_page/2 | Provide the complete reply as required by http_wrapper.pl for a page constructed from Head and Body. | ![]() |
| reply_html_page/3 | Provide the complete reply as required by http_wrapper.pl for a page constructed from Head and Body. | ![]() |
| xhtml_ns/4 | Demand an xmlns:id=Value in the outer html tag. | ![]() |
http_authenticate.pl -- Authenticate HTTP connections using 401 headers![]() | ||
http_client.pl -- HTTP client library![]() | ||
http_cors.pl -- Enable CORS: Cross-Origin Resource Sharing![]() | ||
http_dirindex.pl -- HTTP directory listings![]() | ||
http_dispatch.pl -- Dispatch requests in the HTTP server![]() | ||
http_error.pl -- Decorate uncaught HTTP exceptions with stack-trace![]() | ||
http_exception.pl -- Map Prolog exceptions to HTTP errors![]() | ||
http_header.pl -- Handling HTTP headers![]() | ||
http_hook.pl -- HTTP library hooks![]() | ||
http_host.pl -- Obtain public server location![]() | ||
http_json.pl -- HTTP JSON Plugin module![]() | ||
| post_data_hook/3 | Hook implementation that allows http_post_data/3 posting JSON objects using one of the forms below. | ![]() |
| http_convert_data/4 | Hook implementation that supports reading JSON documents. | ![]() |
| http_read_json/2 | Extract JSON data posted to this HTTP request. | ![]() |
| http_read_json/3 | Extract JSON data posted to this HTTP request. | ![]() |
| http_read_json_dict/2 | Similar to http_read_json/2,3, but by default uses the version 7 extended datatypes. | ![]() |
| http_read_json_dict/3 | Similar to http_read_json/2,3, but by default uses the version 7 extended datatypes. | ![]() |
| json_type/1 | True if MediaType is a JSON media type. | ![]() |
| reply_json/1 | Formulate a JSON HTTP reply. | ![]() |
| reply_json/2 | Formulate a JSON HTTP reply. | ![]() |
| reply_json_dict/1 | As reply_json/1 and reply_json/2, but assumes the new dict based data representation. | ![]() |
| reply_json_dict/2 | As reply_json/1 and reply_json/2, but assumes the new dict based data representation. | ![]() |
http_log.pl -- HTTP Logging module![]() | ||
| 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. | ![]() |
| nolog_post_content_type/1 | Multifile hook called with the Content-type header. | ![]() |
| 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 -- Multipart form-data plugin![]() | ||
http_open.pl -- HTTP client library![]() | ||
http_openid.pl -- OpenID consumer and server library![]() | ||
http_parameters.pl -- Extract parameters (GET and POST) from HTTP requests![]() | ||
http_path.pl -- Abstract specification of HTTP server locations![]() | ||
http_server_files.pl -- Serve files needed by modules from the server![]() | ||
http_session.pl -- HTTP Session management![]() | ||
| http_close_session/1 | Closes an HTTP session. | ![]() |
| http_current_session/2 | Enumerate the current sessions and associated data. | ![]() |
| http_in_session/1 | True if SessionId is an identifier for the current session. | ![]() |
| http_open_session/2 | Establish a new session. | ![]() |
| http_session_assert/1 | Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session. | ![]() |
| http_session_asserta/1 | Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session. | ![]() |
| http_session_cookie/1 | Generate a random cookie that can be used by a browser to identify the current session. | ![]() |
| http_session_data/1 | True if Data is associated using http_session_assert/1 to the current HTTP session. | ![]() |
| http_session_id/1 | True if SessionId is an identifier for the current session. | ![]() |
| http_session_option/1 | True if Option is a current option of the session system. | ![]() |
| http_session_retract/1 | Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session. | ![]() |
| http_session_retractall/1 | Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session. | ![]() |
| http_set_session/1 | Overrule a setting for the current or specified session. | ![]() |
| http_set_session/2 | Overrule a setting for the current or specified session. | ![]() |
| http_set_session_options/1 | Set options for the session library. | ![]() |
http_ssl_plugin.pl -- SSL plugin for HTTP libraries![]() | ||
http_stream.pl -- HTTP Streams![]() | ||
| 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 sofar. | ![]() |
| cgi_open/4 | Process CGI output. | ![]() |
| cgi_property/2 | Inquire the status of the CGI stream. | ![]() |
| cgi_set/2 | Change one of the properies. | ![]() |
| cgi_statistics/1 | Return statistics on the CGI stream subsystem. | ![]() |
| http_chunked_open/3 | Create a stream to realise HTTP chunked encoding or decoding. | ![]() |
| 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 -- Run SWI-Prolog HTTP server as a Unix system daemon![]() | ||
http_wrapper.pl -- Server processing of an HTTP request![]() | ||
| 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. | ![]() |
| http_wrapper/5 | Simple wrapper to read and decode an HTTP header from `In', call :Goal while watching for exceptions and send the result to the stream `Out'. | ![]() |
hub.pl -- Manage a hub for websockets![]() | ||
jquery.pl -- Provide JQuery![]() | ||
js_grammar.pl -- JavaScript grammar![]() | ||
js_write.pl -- Utilities for including JavaScript![]() | ||
json.pl -- Reading and writing JSON serialization![]() | ||
| 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_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/2 | Write a JSON term to Stream. | ![]() |
| json_write/3 | Write a JSON term to Stream. | ![]() |
| 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 -- Convert between JSON terms and Prolog application terms![]() | ||
| 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_to_json/2 | Translate a Prolog application Term into a JSON object term. | ![]() |
mimepack.pl -- Create a MIME message![]() | ||
mimetype.pl -- Determine mime-type for a file![]() | ||
term_html.pl -- Represent Prolog terms as HTML![]() | ||
thread_httpd.pl -- Threaded HTTP server![]() | ||
| 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. | ![]() |
websocket.pl -- WebSocket support![]() | ||
| 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_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. | ![]() |
yadis.pl -- Yadis discovery![]() | ||
