Revision: 4262 Author: edi URL: http://bknr.net/trac/changeset/4262
More...
U trunk/thirdparty/hunchentoot/easy-handlers.lisp U trunk/thirdparty/hunchentoot/headers.lisp U trunk/thirdparty/hunchentoot/misc.lisp
Modified: trunk/thirdparty/hunchentoot/easy-handlers.lisp =================================================================== --- trunk/thirdparty/hunchentoot/easy-handlers.lisp 2009-02-16 22:16:31 UTC (rev 4261) +++ trunk/thirdparty/hunchentoot/easy-handlers.lisp 2009-02-16 22:33:22 UTC (rev 4262) @@ -161,7 +161,7 @@ DESCRIPTION is either a symbol NAME or a list matching the destructuring lambda list
- (name &key uri server-names default-parameter-type default-request-type). + (name &key uri acceptor-names default-parameter-type default-request-type).
LAMBDA-LIST is a list the elements of which are either a symbol VAR or a list matching the destructuring lambda list @@ -182,11 +182,11 @@ function and applying this function to the current request object returns a true value.
-SERVER-NAMES (which is evaluated) can be a list of symbols which +ACCEPTOR-NAMES (which is evaluated) can be a list of symbols which means that the handler will be returned by DISPATCH-EASY-HANDLERS in -servers which have one of these names (see SERVER-NAME). -SERVER-NAMES can also be the symbol T which means that the handler -will be returned by DISPATCH-EASY-HANDLERS in every server. +acceptor which have one of these names (see ACCEPTOR-NAME). +ACCEPTOR-NAMES can also be the symbol T which means that the handler +will be returned by DISPATCH-EASY-HANDLERS in every acceptor.
Whether the GET or POST parameter (or both) will be taken into consideration, depends on REQUEST-TYPE which can @@ -277,7 +277,7 @@ argument is provided." (when (atom description) (setq description (list description))) - (destructuring-bind (name &key uri (server-names t) + (destructuring-bind (name &key uri (acceptor-names t) (default-parameter-type ''string) (default-request-type :both)) description @@ -291,7 +291,7 @@ (or (equal ,uri (first list)) (eq ',name (third list)))) *easy-handler-alist*)) - (push (list ,uri ,server-names ',name) *easy-handler-alist*))))) + (push (list ,uri ,acceptor-names ',name) *easy-handler-alist*))))) (defun ,name (&key ,@(loop for part in lambda-list collect (make-defun-parameter part default-parameter-type @@ -310,9 +310,9 @@ (defun dispatch-easy-handlers (request) "This is a dispatcher which returns the appropriate handler defined with DEFINE-EASY-HANDLER, if there is one." - (loop for (uri server-names easy-handler) in *easy-handler-alist* - when (and (or (eq server-names t) - (find (acceptor-name *acceptor*) server-names :test #'eq)) + (loop for (uri acceptor-names easy-handler) in *easy-handler-alist* + when (and (or (eq acceptor-names t) + (find (acceptor-name *acceptor*) acceptor-names :test #'eq)) (cond ((stringp uri) (string= (script-name request) uri)) (t (funcall uri request))))
Modified: trunk/thirdparty/hunchentoot/headers.lisp =================================================================== --- trunk/thirdparty/hunchentoot/headers.lisp 2009-02-16 22:16:31 UTC (rev 4261) +++ trunk/thirdparty/hunchentoot/headers.lisp 2009-02-16 22:33:22 UTC (rev 4262) @@ -189,9 +189,8 @@ (setf content (string-to-octets content :external-format (reply-external-format)))) (when content ;; whenever we know what we're going to send out as content, set - ;; the content-length header properly. It may be that the user - ;; specified a different Content-Length, but that will not be - ;; right. We might want to warn the user. + ;; the Content-Length header properly; maybe the user specified + ;; a different content length, but that will wrong anyway (setf (header-out :content-length) (length content))) ;; write all headers from the REPLY object (loop for (key . value) in (headers-out) @@ -233,7 +232,7 @@ (defun read-initial-request-line (stream) "Reads and returns the initial HTTP request line, catching permitted errors and handling *BREAK-EVEN-WHILE-READING-REQUEST-TYPE-P*. If no -request could be read, return NIL." +request could be read, returns NIL." (let ((*break-on-signals* (and *break-even-while-reading-request-type-p* *break-on-signals*))) (handler-case
Modified: trunk/thirdparty/hunchentoot/misc.lisp =================================================================== --- trunk/thirdparty/hunchentoot/misc.lisp 2009-02-16 22:16:31 UTC (rev 4261) +++ trunk/thirdparty/hunchentoot/misc.lisp 2009-02-16 22:33:22 UTC (rev 4262) @@ -109,9 +109,9 @@ (address-string)))
(defun create-prefix-dispatcher (prefix handler) - "Creates a dispatch function which will dispatch to the -function denoted by HANDLER if the file name of the current -request starts with the string PREFIX." + "Creates a request dispatch function which will dispatch to the +function denoted by HANDLER if the file name of the current request +starts with the string PREFIX." (lambda (request) (let ((mismatch (mismatch (script-name request) prefix :test #'char=))) @@ -120,9 +120,9 @@ handler))))
(defun create-regex-dispatcher (regex handler) - "Creates a dispatch function which will dispatch to the -function denoted by HANDLER if the file name of the current -request matches the CL-PPCRE regular expression REGEX." + "Creates a request dispatch function which will dispatch to the +function denoted by HANDLER if the file name of the current request +matches the CL-PPCRE regular expression REGEX." (let ((scanner (create-scanner regex))) (lambda (request) (and (scan scanner (script-name request)) @@ -136,13 +136,13 @@
(defun handle-static-file (path &optional content-type) "A function which acts like a Hunchentoot handler for the file -denoted by PATH. Send a content type header corresponding to -CONTENT-TYPE or (if that is NIL) tries to determine the content -type via the file's suffix." +denoted by PATH. Sends a content type header corresponding to +CONTENT-TYPE or (if that is NIL) tries to determine the content type +via the file's suffix." (when (or (wild-pathname-p path) (not (fad:file-exists-p path)) (fad:directory-exists-p path)) - ;; does not exist + ;; file does not exist (setf (return-code) +http-not-found+) (abort-request-handler)) (let ((time (or (file-write-date path) (get-universal-time)))) @@ -166,10 +166,10 @@ (finish-output out))))))
(defun create-static-file-dispatcher-and-handler (uri path &optional content-type) - "Creates and returns a dispatch function which will dispatch to a -handler function which emits the file denoted by the pathname + "Creates and returns a request dispatch function which will dispatch +to a handler function which emits the file denoted by the pathname designator PATH with content type CONTENT-TYPE if the SCRIPT-NAME of -the request matches the string URI. If CONTENT-TYPE is NIL tries to +the request matches the string URI. If CONTENT-TYPE is NIL, tries to determine the content type via the file's suffix." ;; the dispatcher (lambda (request)