(sigil web static)
(sigil web static) - Static File Serving
Provides static file serving with MIME type detection and security features to prevent directory traversal attacks.
Example: (define static-handler (make-static-handler "public/"))
;; Serves files from public/ directory ;; Request to /css/style.css serves public/css/style.css
Exports
safe-path?procedureCheck if a path is safe (no directory traversal) Returns #t if path doesn't contain dangerous components
serve-fileprocedureServe a single file with appropriate headers Returns http-response or #f if file doesn't exist
text-mime-type?procedureCheck if MIME type is text-based
make-static-handlerprocedureCreate a static file handler for a directory base-dir: root directory for static files options: optional alist with:
- index: index file name (default: "index.html")
- prefix: URL prefix to strip (default: "")