3.2 library(http/http_dispatch): Dispatch requests in the HTTP server
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • The HTTP server libraries
          • library(http/http_dispatch): Dispatch requests in the HTTP server
            • http_handler/3
            • http_delete_handler/1
            • http_dispatch/1
            • http_request_expansion/2
            • http_current_handler/2
            • http_current_handler/3
            • http_location_by_id/2
            • http_link_to_id/3
            • http_reload_with_parameters/3
            • http_reply_file/3
            • http_safe_file/2
            • http_redirect/3
            • http_404/2
            • http_switch_protocol/2
Availability::- use_module(library(http/http_dispatch)).
Source[det]http_reply_file(+FileSpec, +Options, +Request)
Options is a list of
cache(+Boolean)
If true (default), handle If-modified-since and send modification time.
mime_type(+Type)
Overrule mime-type guessing from the filename as provided by file_mime_type/2.
static_gzip(+Boolean)
If true (default false) and, in addition to the plain file, there is a .gz file that is not older than the plain file and the client acceps gzip encoding, send the compressed file with Transfer-encoding: gzip.
cached_gzip(+Boolean)
If true (default false) the system maintains cached gzipped files in a directory accessible using the file search path http_gzip_cache and serves these similar to the static_gzip(true) option. If the gzip file does not exist or is older than the input the file is recreated.
unsafe(+Boolean)
If false (default), validate that FileSpec does not contain references to parent directories. E.g., specifications such as www('../../etc/passwd') are not allowed.
headers(+List)
Provides additional reply-header fields, encoded as a list of Field(Value).

If caching is not disabled, it processes the request headers If-modified-since and Range.

throws
- http_reply(not_modified)
- http_reply(file(MimeType, Path))