- library
- http
- http_unix_daemon.pl -- Run SWI-Prolog HTTP server as a Unix system daemon
- thread_httpd.pl -- Threaded HTTP server
- http_wrapper.pl -- Server processing of an HTTP request
- http_header.pl -- Handling HTTP headers
- html_write.pl -- Write HTML text
- html_quasiquotations.pl -- HTML quasi quotations
- http_dispatch.pl -- Dispatch requests in the HTTP server
- mimetype.pl -- Determine mime-type for a file
- http_path.pl -- Abstract specification of HTTP server locations
- http_host.pl -- Obtain public server location
- http_exception.pl -- Map Prolog exceptions to HTTP errors
- mimepack.pl -- Create a MIME message
- http_stream.pl -- HTTP Streams
- http_ssl_plugin.pl -- SSL plugin for HTTP libraries
- http_parameters.pl -- Extract parameters (GET and POST) from HTTP requests
- http_client.pl -- HTTP client library
- http_open.pl -- HTTP client library
- http_multipart_plugin.pl -- Multipart form-data plugin
- http_hook.pl -- HTTP library hooks
- html_head.pl -- Automatic inclusion of CSS and scripts links
- term_html.pl -- Represent Prolog terms as HTML
- jquery.pl -- Provide JQuery
- http_server_files.pl -- Serve files needed by modules from the server
- json.pl -- Reading and writing JSON serialization
- http_session.pl -- HTTP Session management
- http_openid.pl -- OpenID consumer and server library
- yadis.pl -- Yadis discovery
- ax.pl -- Attribute Exchange library
- http_authenticate.pl -- Authenticate HTTP connections using 401 headers
- http_json.pl -- HTTP JSON Plugin module
- http_dirindex.pl -- HTTP directory listings
- js_write.pl -- Utilities for including JavaScript
- js_grammar.pl -- JavaScript grammar
- http_cors.pl -- Enable CORS: Cross-Origin Resource Sharing
- json_convert.pl -- Convert between JSON terms and Prolog application terms
- http
- http_daemon
- Start the HTTP server as a daemon process. This predicate
processes the commandline arguments below. Commandline arguments
that specify servers are processed in the order they appear
using the following schema:
- Arguments that act as default for all servers.
--http=Spec
or--https=Spec
is followed by arguments for that server until the next--http=Spec
or--https=Spec
or the end of the options.- If no
--http=Spec
or--https=Spec
appears, one HTTP server is created from the specified parameters.Examples:
--workers=10 --http --https --http=8080 --https=8443 --http=localhost:8080 --workers=1 --https=8443 --workers=25
- --port=Port
-
Start HTTP server at Port. It requires root permission and the
option
--user=User
to open ports below 1000. The default port is 80. If--https
is used, the default port is 443. - --ip=IP
-
Only listen to the given IP address. Typically used as
--ip=localhost
to restrict access to connections from localhost if the server itself is behind an (Apache) proxy server running on the same host. - --debug=Topic
- Enable debugging Topic. See debug/3.
- --syslog=Ident
- Write debug messages to the syslog daemon using Ident
- --user=User
-
When started as root to open a port below 1000, this option
must be provided to switch to the target user for operating
the server. The following actions are performed as root, i.e.,
before switching to User:
- open the
socket(s)
- write the pidfile
- setup syslog interaction
- Read the certificate, key and password file (
--pwfile=File
)
- open the
- --group=Group
-
May be used in addition to
--user
. If omitted, the login group of the target user is used. - --pidfile=File
- Write the PID of the daemon process to File.
- --output=File
- Send output of the process to File. By default, all Prolog console output is discarded.
- --fork[=Bool]
-
If given as
--no-fork
or--fork=false
, the process runs in the foreground. - --http[=(Bool|Port|BindTo:Port)]
-
Create a plain HTTP server. If the argument is missing or
true
, create at the specified or default address. Else use the given port and interface. Thus,--http
creates a server at port 80,--http=8080
creates one at port 8080 and--http=localhost:8080
creates one at port 8080 that is only accessible fromlocalhost
. - --https[=(Bool|Port|BindTo:Port)]
-
As
--http
, but creates an HTTPS server. Use--certfile
,--keyfile
,-pwfile
,--password
and--cipherlist
to configure SSL for this server. - --certfile=File
- The server certificate for HTTPS.
- --keyfile=File
- The server private key for HTTPS.
- --pwfile=File
-
File holding the password for accessing the private key. This
is preferred over using
--password=PW
as it allows using file protection to avoid leaking the password. The file is read before the server drops privileges when started with the--user
option. - --password=PW
- The password for accessing the private key. See also `--pwfile`.
- --cipherlist=Ciphers
- One or more cipher strings separated by colons. See the OpenSSL documentation for more information. Starting with SWI-Prolog 7.5.11, the default value is always a set of ciphers that was considered secure enough to prevent all critical attacks at the time of the SWI-Prolog release.
- --interactive[=Bool]
-
If
true
(defaultfalse
) implies--no-fork
and presents the Prolog toplevel after starting the server. - --gtrace=[Bool]
- Use the debugger to trace http_daemon/1.
- --sighup=Action
-
Action to perform on
kill -HUP <pid>
. Default isreload
(running make/0). Alternative isquit
, stopping the server.
Other options are converted by argv_options/3 and passed to http_server/1. For example, this allows for:
- --workers=Count
- Set the number of workers for the multi-threaded server.
http_daemon/0 is defined as below. The start code for a specific server can use this as a starting point, for example for specifying defaults.
http_daemon :- current_prolog_flag(argv, Argv), argv_options(Argv, _RestArgv, Options), http_daemon(Options).
- See also
- - http_daemon/1