Skip to content

Commit

Permalink
file-handler doc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok committed Jul 4, 2024
1 parent b9cb1ed commit 362d042
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,16 +598,18 @@ on the server.

(file-handler :key (directory-index '("index.html" #t))
(path-trans request-path)
(root (document-root)))
(root #f))

`PATH-TRANS` should be a procedure that takes `REQUEST` and returns
the server-side file path. The returned path should start from
slash, and the document-root directory passed to the start-http-server
is prepended to it. It is not allowed to go above the document
root directory by `"/../../.."` etc---403 error message would results.

If you need to access files other than document-root, you can specify
alternative root directory by the `ROOT` keyword argument.
The file to be served is determined as this: First, the path part
is extracted from the request with `PATH-TRANS`, then the directory
name given to `ROOT` argument is appended. If `ROOT` is `#f`, the
value of the parameter `document-root` is used.

The `DIRECTORY-INDEX` keyword argument specifies the behavior when
given path is a directory. It must be a list of either filename or
Expand Down

0 comments on commit 362d042

Please sign in to comment.