- Documentation
- Reference manual
- Packages
- SWI-Prolog HTTP support
- The HTTP server libraries
- Creating an HTTP reply
- library(http/http_dispatch): Dispatch requests in the HTTP server
- library(http/http_dirindex): HTTP directory listings
- library(http/http_files): Serve plain files from a hierarchy
- library(http/http_session): HTTP Session management
- library(http/http_cors): Enable CORS: Cross-Origin Resource Sharing
- library(http/http_authenticate): Authenticate HTTP connections using 401 headers
- library(http/http_digest): HTTP Digest authentication
- library(http/http_dyn_workers): Dynamically schedule HTTP workers.
- Custom Error Pages
- library(http/http_openid): OpenID consumer and server library
- Get parameters from HTML forms
- Request format
- Running the server
- The wrapper library
- library(http/http_host): Obtain public server location
- library(http/http_log): HTTP Logging module
- Debugging HTTP servers
- library(http/http_header): Handling HTTP headers
- The library(http/html_write) library
- library(http/js_write): Utilities for including JavaScript
- library(http/http_path): Abstract specification of HTTP server locations
- library(http/html_head): Automatic inclusion of CSS and scripts links
- library(http/http_pwp): Serve PWP pages through the HTTP server
- The HTTP server libraries
- SWI-Prolog HTTP support
http_openid.pl
).
The address is established from the settings http:public_host
and
http:public_port
if provided. Otherwise it is deduced from
the request.
- [det]http_public_url(+Request, -URL)
- True when URL is an absolute URL for the current request. Typically, the login page should redirect to this URL to avoid losing the session.
- [det]http_public_host_url(+Request, -URL)
- True when URL is the public URL at which this server can be contacted. This value is not easy to obtain. See http_public_host/4 for the hardest part: find the host and port.
- [det]http_public_host(?Request, -Hostname, -Port, +Options)
- Current global host and port of the HTTP server. This is the basis to
form absolute address, which we need for redirection based interaction
such as the OpenID protocol. Options are:
- global(+Bool)
- If
true
(defaultfalse
), try to replace a local hostname by a world-wide accessible name.
This predicate performs the following steps to find the host and port:
- Use the settings
http:public_host
andhttp:public_port
- Use
X-Forwarded-Host
header, which applies if this server runs behind a proxy. - Use the
Host
header, which applies for HTTP 1.1 if we are contacted directly. - Use gethostname/1 to find the host and http_current_server/2 to find the port.
Request is the current request. If it is left unbound, and the request is needed, it is obtained with http_current_request/1. - [det]http_current_host(?Request, -Hostname, -Port, +Options)
-
- deprecated
- Use http_public_host/4 (same semantics)
3.17 library(http/http_log): HTTP Logging module
Simple module for logging HTTP requests to a file. Logging is enabled
by loading this file and ensure the setting http:logfile is not the
empty atom. The default file for writing the log is httpd.log
.
See
library(settings)
for details.
The level of logging can be modified using the multifile predicate
http_log:nolog/1 to hide HTTP request
fields from the logfile and
http_log:password_field/1 to hide
passwords from HTTP search specifications (e.g. /topsecret?password=secret
).
- [semidet]http_log_stream(-Stream)
- True when Stream is a stream to the opened HTTP log file.
Opens the log file in
append
mode if the file is not yet open. The log file is determined from the settinghttp:logfile
. If this setting is set to the empty atom (''), this predicate fails.If a file error is encountered, this is reported using print_message/2, after which this predicate silently fails. Opening is retried every minute when