Did you know ... | Search Documentation: |
Title for pldoc(dir_index) |
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 libraris 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.
ax.pl -- Attribute Exchange library | ||
---|---|---|
graphql.pl -- GraphQL interface | ||
graphql/4 | Quasi-quotation syntax for embedding GraphQL in Prolog text. | |
graphql_auth_token_hook/2 | Multifile, dynamic hook. | |
graphql_document_to_codes/3 | Serialize 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. | |
graphql_document_to_string/3 | Serialize the GraphQL document Document and unify String with the resulting string. | |
graphql_execute_document/4 | Send GraphQL document Document to be executed by the GraphQL endpoint at URI. | |
graphql_read_document/3 | True when Document is a term representing the abstract syntax tree obtained from parsing Source as a GraphQL executable document. | |
html_head.pl -- Automatic inclusion of CSS and scripts links | ||
html_current_resource/1 | True when About is a currently known resource. | |
html_insert_resource/3 | Actually include HTML head resources. | |
html_requires/3 | Include ResourceOrList and all dependencies derived from it and add them to the HTML head using html_post/2. | |
html_resource/2 | Register an HTML head resource. | |
mime_include/4 | Hook called to include a link to an HTML resource of type Mime into the HTML head. | |
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_header_hook/1 | This multifile hook is called just before the Content-type header is emitted. | |
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. | |
reply_html_partial/1 | Reply with partial HTML document. | |
xhtml_ns/4 | Demand an xmlns:id=Value in the outer html tag. | |
http_authenticate.pl -- Authenticate HTTP connections using 401 headers | ||
http_authenticate/3 | True if Request contains the information to continue according to Type. | |
http_authorization_data/2 | Decode the HTTP Authorization header. | |
http_current_user/3 | True when User is present in the htpasswd file File and Fields provides the additional fields. | |
http_read_passwd_file/2 | Read a password file. | |
http_write_passwd_file/2 | Write password data Data to File. | |
authenticate/3 | Plugin for library(http_dispatch) to perform basic HTTP authentication. | |
http_client.pl -- HTTP client library | ||
http_cookie.pl -- HTTP client cookie handling | ||
update_cookies/3 | Update the client cookie database. | |
write_cookies/3 | Emit a cookie header for the current request. | |
cookie_remove_all_clients/0 | Simply logout all clients. | |
cookie_remove_client/1 | Fake user quitting a browser. | |
http_cors.pl -- Enable CORS: Cross-Origin Resource Sharing | ||
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_digest.pl -- HTTP Digest authentication | ||
authenticate/3 | Plugin for library(http_dispatch) to perform basic HTTP authentication. | |
authenticate_client/2 | This hooks is called by http_open/3 with the following Action value:. | |
http_digest_challenge/4 | Generate the content for a 401 WWW-Authenticate: Digest header field. | |
http_digest_password_hash/4 | Compute the password hash for the HTTP password file. | |
http_digest_response/5 | Formulate a reply to a digest authentication request. | |
http_parse_digest_challenge/2 | Parse the value of an HTTP WWW-Authenticate header into a list of Name(Value) terms. | |
http_dirindex.pl -- HTTP directory listings | ||
mime_type_icon/2 | Multi-file hook predicate that can be used to associate icons to files listed by http_reply_dirindex/3. | |
directory_index/4 | Show index for a directory. | |
http_reply_dirindex/3 | Provide a directory listing for Request, assuming it is an index for the physical directrory Dir. | |
http_dispatch.pl -- Dispatch requests in the HTTP server | ||
http_404/2 | Reply using an "HTTP 404 not found" page. | |
http_current_handler/2 | True if Location is handled by Closure. | |
http_current_handler/3 | Resolve the current handler and options to execute it. | |
http_delete_handler/1 | Delete handler for Spec. | |
http_dispatch/1 | Dispatch a Request using http_handler/3 registrations. | |
http_handler/3 | Register Closure as a handler for HTTP requests. | |
http_link_to_id/3 | HREF is a link on the local server to a handler with given ID, passing the given Parameters. | |
http_location_by_id/2 | True when Location represents the HTTP path to which the handler with identifier ID is bound. | |
http_redirect/3 | Redirect to a new location. | |
http_reload_with_parameters/3 | Create a request on the current handler with replaced search parameters. | |
http_reply_file/3 | Options is a list of. | |
http_request_expansion/2 | Register Goal for expanding the HTTP request handler. | |
http_safe_file/2 | True if FileSpec is considered safe. | |
http_switch_protocol/2 | Send an "HTTP 101 Switching Protocols" reply. | |
http_dyn_workers.pl -- Dynamically schedule HTTP workers. | ||
http_error.pl -- Decorate uncaught HTTP exceptions with stack-trace | ||
http_exception.pl -- Map Prolog exceptions to HTTP errors | ||
http_files.pl -- Serve plain files from a hierarchy | ||
http_header.pl -- Handling HTTP headers | ||
http_hook.pl -- HTTP library hooks | ||
http_host.pl -- Obtain public server location | ||
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 | ||
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. | |
is_json_content_type/1 | True if ContentType is a header value (either parsed or as atom/string) that denotes a JSON value. | |
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_load.pl -- Load Prolog code from a web server | ||
http_log.pl -- HTTP Logging module | ||
http_multipart_plugin.pl -- Multipart form-data plugin | ||
http_convert_data/4 | Convert multipart/form-data messages for http_read_data/3. | |
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_convert_parameter/4 | Conversion of an HTTP form value. | |
http_convert_parameters/2 | Implements the parameter translation of http_parameters/2 or http_parameters/3. | |
http_convert_parameters/3 | Implements the parameter translation of http_parameters/2 or http_parameters/3. | |
http_parameters/2 | Get HTTP GET or POST form-data, applying type validation, default values, etc. | |
http_parameters/3 | Get HTTP GET or POST form-data, applying type validation, default values, etc. | |
http_path.pl -- Abstract specification of HTTP server locations | ||
http_proxy.pl -- Use HTTP network proxies | ||
http_pwp.pl -- Serve PWP pages through the HTTP server | ||
http_redis_plugin.pl -- Hook session management to use Redis | ||
http_server.pl -- HTTP server library | ||
http_server/1 | Create an HTTP server using http_dispatch/1 for handling requests. | |
http_server_files.pl -- Serve files needed by modules from the server | ||
http_server_health.pl -- HTTP Server health statistics | ||
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_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_assert/2 | Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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_asserta/2 | Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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_data/2 | Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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_retract/2 | Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit HTTP session. | |
http_session_retractall/1 | Versions of assert/1, retract/1 and retractall/1 that associate data with the current HTTP session. | |
http_session_retractall/2 | Versions of assert/1, retract/1 and retractall/1 that associate data with an explicit 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. | |
session_setting/2 | Find setting for SessionID. | |
http_sgml_plugin.pl -- Parse of HTML and XML documents for the HTTP client libs | ||
http_stream.pl -- HTTP Streams | ||
http_unix_daemon.pl -- Run SWI-Prolog HTTP server as a Unix system daemon | ||
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 | ||
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. | |
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 | ||
js_grammar.pl -- JavaScript grammar | ||
js_token/3 | Matches and classifies the next JavaScript token. | |
js_write.pl -- Utilities for including JavaScript | ||
javascript/4 | Quasi quotation parser for JavaScript that allows for embedding Prolog variables to substitude identifiers in the JavaScript snippet. | |
js_arg/3 | Same as js_expression//1, but fails if Expression is invalid, where js_expression//1 raises an error. | |
js_arg_list/3 | Write javascript (function) arguments. | |
js_call/3 | Emit a call to a Javascript function. | |
js_expression/3 | Emit a single JSON argument. | |
js_new/4 | Emit a call to a Javascript object declaration. | |
js_script/3 | Generate a JavaScript script element with the given content. | |
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_dict_pairs/2 | This hook may be used to order the keys of an object. | |
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_write_hook/4 | Hook that can be used to emit a JSON representation for Term to Stream. | |
json_convert.pl -- Convert between JSON terms and Prolog application terms | ||
mimepack.pl -- Create a MIME message | ||
mimetype.pl -- Determine mime-type for a file | ||
charset/3 | Hook that determines the Charset for File that has media type MediaType. | |
mime_extension/2 | Hook that is called by file_mime_type/2 before the default table is examined. | |
file_content_type/2 | True if File should be served using ContentType: ContentType. | |
file_content_type/3 | True if File should be served using ContentType: ContentType. | |
file_mime_type/2 | True when MimeType is the mime-type to be used for sending FileName. | |
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. | |
message_level/2 | Determine the message stream used for exceptions that may occur during server_loop/5. | |
websocket.pl -- WebSocket support | ||
yadis.pl -- Yadis discovery | ||
ssl_verify/5 | Accept all certificates. | |
xrds_dom/2 | True when XRDS_DOM is a parsed XML document for the given resource. | |
xrds_location/2 | Discover the location of the XRDS document from the given Id. |