[Bese-devel] Re: Static Files using HTTPD Backend

Alexey Antipov alexey.antipov at gmail.com
Mon Oct 3 13:02:04 UTC 2005


Scott Bell <sebell <at> gmail.com> writes:

> If this is not an appropriate place for this question, please feel
> free to direct me elsewhere or simply ignore me. I'm having some
> difficulties serving static files using the httpd backend in ucw_dev.
> It seems as if I'm not able to properly set the :www-roots  list of
> pathnames, although I have tried several approaches (absolute,
> relative, etc.). Of course the error for all my attempts to grab
> static files is 404.

The problem appeared after examples was moved to "/".
Here my try:

(in-package :it.bese.ucw)

(defun url-rel-name (url base)
  (cond ((equal "/" base)
	 (but-head url))
	(t (enough-namestring url base))))

(defmethod publish-directory ((backend httpd-backend)
			      directory-pathname url-base)
  (flet ((truename-from-url (query-path)
           (merge-pathnames (url-rel-name query-path url-base)
                            directory-pathname)))
    (push (cons (lambda (request-url)
                  (and (starts-with request-url url-base)
                       (probe-file (truename-from-url request-url))))
                (lambda (request response)
                  (serve-file (truename-from-url (query-path request))
			      request response)))
          (handlers backend))))


Obviously, Marco will do better.




More information about the bese-devel mailing list