► |  | Web Server: PLT HTTP Server

1 | Running the Web Server
2 | Writing Servlets
3 | Extending the Web Server
4 | Troubleshooting and Tips
5 | Acknowledgements
| Index

► | 3 | Extending the Web Server

3.1 | Configuration
3.2 | Setting Up Servlets
3.3 | Dispatchers
3.4 | Web Config Unit
3.5 | Web Server Unit
3.6 | Internal

▼ | 3.3 | Dispatchers

3.3.1 | General
3.3.2 | Mapping URLs to Paths
3.3.3 | Sequencing
3.3.4 | Timeouts
3.3.5 | Lifting Procedures
3.3.6 | Filtering Requests
3.3.7 | Procedure Invocation upon Request
3.3.8 | Logging
3.3.9 | Password Protection
3.3.10 | Virtual Hosts
3.3.11 | Serving Files
3.3.12 | Serving Servlets
3.3.13 | Statistics
3.3.14 | Limiting Requests

On this page:

make

Version: 4.1.4
top← prev up next →

##### 3.3.11`` Serving Files

(require web-server/dispatchers/dispatch-files)

The web-server/dispatchers/dispatch-files module allows files to be served. It defines a dispatcher construction procedure.

(make |  | #:url->path url->path |  |  |  |
| [ | #:path->mime-type path->mime-type |  |  |  |
|  | #:indices indices]) |  | → |  | dispatcher/c

url->path : url->path/c

| path->mime-type |  | : |  | (path? . -> . bytes?)
|  |  | = |  | (lambda (path) TEXT/HTML-MIME-TYPE)

indices : (listof string?) = (list "index.html" "index.htm")

Uses url->path to extract a path from the URL in the request object. If this path does not exist, then the dispatcher does not apply and next-dispatcher is invoked. If the path is a directory, then the indices are checked in order for an index file to serve. In that case, or in the case of a path that is a file already, path->mime-type is consulted for the MIME Type of the path. The file is then streamed out the connection object.

This dispatcher supports HTTP Range GET requests and HEAD requests.

top← prev up next →