3.24 library(http/http_pwp): Serve PWP pages through the HTTP server
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • The HTTP server libraries
          • library(http/http_pwp): Serve PWP pages through the HTTP server
            • pwp_handler/2
            • reply_pwp_page/3
Availability::- use_module(library(http/http_pwp)).
reply_pwp_page(:File, +Options, +Request)
Reply a PWP file. This interface is provided to server individual locations from PWP files. Using a PWP file rather than generating the page from Prolog may be desirable because the page contains a lot of text (which is cumbersome to generate from Prolog) or because the maintainer is not familiar with Prolog.

Options supported are:

mime_type(+Type)
Serve the file using the given mime-type. Default is text/html.
unsafe(+Boolean)
Passed to http_safe_file/2 to check for unsafe paths.
pwp_module(+Boolean)
If true, (default false), process the PWP file in a module constructed from its canonical absolute path. Otherwise, the PWP file is processed in the calling module.

Initial context:

SCRIPT_NAME
Virtual path of the script.
SCRIPT_DIRECTORY
Physical directory where the script lives
QUERY
Var=Value list representing the query-parameters
REMOTE_USER
If access has been authenticated, this is the authenticated user.
REQUEST_METHOD
One of get, post, put or head
CONTENT_TYPE
Content-type provided with HTTP POST and PUT requests
CONTENT_LENGTH
Content-length provided with HTTP POST and PUT requests

While processing the script, the file-search-path pwp includes the current location of the script. I.e., the following will find myprolog in the same directory as where the PWP file resides.

pwp:ask="ensure_loaded(pwp(myprolog))"
See also
pwp_handler/2.
To be done
complete the initial context, as far as possible from CGI variables. See http://hoohoo.ncsa.illinois.edu/docs/cgi/env.html