Revision: 4280 Author: edi URL: http://bknr.net/trac/changeset/4280
Checkpoint
U trunk/thirdparty/hunchentoot/acceptor.lisp U trunk/thirdparty/hunchentoot/doc/index.xml U trunk/thirdparty/hunchentoot/request.lisp U trunk/thirdparty/hunchentoot/session.lisp
Modified: trunk/thirdparty/hunchentoot/acceptor.lisp =================================================================== --- trunk/thirdparty/hunchentoot/acceptor.lisp 2009-02-18 14:57:40 UTC (rev 4279) +++ trunk/thirdparty/hunchentoot/acceptor.lisp 2009-02-18 19:58:57 UTC (rev 4280) @@ -63,12 +63,13 @@ symbol naming) a class which inherits from REPLY. The default is the symbol REPLY.") (request-dispatcher :initarg :request-dispatcher - :accessor acceptor-request-dispatcher - :documentation "A designator for the request + :accessor acceptor-request-dispatcher + :documentation "A designator for the request dispatcher function used by this acceptor. A function which accepts a REQUEST object and calls a request handler of its choice (and returns its return value). The default is the unexported symbol -LIST-REQUEST-DISPATCHER which works through the list *DISPATCH-TABLE*.") +LIST-REQUEST-DISPATCHER which works through the list +*DISPATCH-TABLE*.") (taskmaster :initarg :taskmaster :reader acceptor-taskmaster :documentation "The taskmaster (i.e. an instance of a @@ -220,8 +221,14 @@ stream object in SOCKET. It reads the request headers, sets up the request and reply objects, and hands over to PROCESS-REQUEST. This is done in a loop until the stream has to be closed or until a connection -timeout occurs.")) +timeout occurs.
+It is probably not a good idea to re-implement this method until you +really, really know what you're doing, but you can for example write +an around method specialized for your subclass of ACCEPTOR which binds +or rebinds special variables which can then be accessed by your +handlers.")) + (defgeneric acceptor-ssl-p (acceptor) (:documentation "Returns a true value if ACCEPTOR uses SSL connections. The default is to unconditionally return NIL and @@ -402,9 +409,9 @@ nil)
(defun list-request-dispatcher (request) - "The default handler selector which selects a request handler based -on a list of individual request dispatchers all of which can either -return a handler or neglect by returning NIL." + "The default request dispatcher which selects a request handler +based on a list of individual request dispatchers all of which can +either return a handler or neglect by returning NIL." (loop for dispatcher in *dispatch-table* for action = (funcall dispatcher request) when action return (funcall action)
Modified: trunk/thirdparty/hunchentoot/doc/index.xml =================================================================== --- trunk/thirdparty/hunchentoot/doc/index.xml 2009-02-18 14:57:40 UTC (rev 4279) +++ trunk/thirdparty/hunchentoot/doc/index.xml 2009-02-18 19:58:57 UTC (rev 4280) @@ -605,6 +605,15 @@ handler for the request and sends its reply to the client. This is done in a loop until the stream has to be closed or until a connection timeout occurs. + +<p> +It is probably not a good idea to re-implement this method until you +really, really know what you're doing, but you can for example write +an around method specialized for your subclass +of clix:refACCEPTOR</clix:ref> which binds or rebinds special +variables which can then be accessed by +your <a href="#handlers">handlers</a>. +</p> </clix:description> </clix:function>
Modified: trunk/thirdparty/hunchentoot/request.lisp =================================================================== --- trunk/thirdparty/hunchentoot/request.lisp 2009-02-18 14:57:40 UTC (rev 4279) +++ trunk/thirdparty/hunchentoot/request.lisp 2009-02-18 19:58:57 UTC (rev 4280) @@ -96,11 +96,18 @@ the REQUEST-CLASS slot of the ACCEPTOR class."))
(defgeneric process-request (request) - (:documentation "This function is called by PROCESS-CONNECTION after the incoming -headers have been read. It selects and calls a handler and sends the -output of this handler to the client using START-OUTPUT. It also sets -up simple error handling for the actual request handler. + (:documentation "This function is called by PROCESS-CONNECTION after +the incoming headers have been read. It selects and calls a handler +and sends the output of this handler to the client using START-OUTPUT. +It also sets up simple error handling for the actual request handler. +Note that PROCESS-CONNECTION is called once per connection and loops +in case of a persistent connection while PROCESS-REQUEST is called +anew for each request.
+Like PROCESS-CONNECTION, this might be a good place to introduce +around methods which bind special variables or do other interesting +things. + The return value of this function is ignored."))
(defun convert-hack (string external-format) @@ -204,9 +211,9 @@ (setf (return-code*) +http-bad-request+)))))
(defmethod process-request (request) - - "Standard implementation for processing a request." - + "Standard implementation for processing a request. You should not +change or replace this functionality unless you know what you're +doing." (let (*tmp-files* *headers-sent*) (unwind-protect (let* ((*request* request))
Modified: trunk/thirdparty/hunchentoot/session.lisp =================================================================== --- trunk/thirdparty/hunchentoot/session.lisp 2009-02-18 14:57:40 UTC (rev 4279) +++ trunk/thirdparty/hunchentoot/session.lisp 2009-02-18 19:58:57 UTC (rev 4280) @@ -127,11 +127,11 @@ (defun encode-session-string (id user-agent remote-addr start) "Creates a uniquely encoded session string based on the values ID, USER-AGENT, REMOTE-ADDR, and START" - ;; *SESSION-SECRET* is used twice due to known theoretical - ;; vulnerabilities of MD5 encoding (unless (boundp '*session-secret*) (hunchentoot-warn "Session secret is unbound. Using Lisp's RANDOM function to initialize it.") (reset-session-secret)) + ;; *SESSION-SECRET* is used twice due to known theoretical + ;; vulnerabilities of MD5 encoding (md5-hex (concatenate 'string *session-secret* (md5-hex (format nil "~A~A~@[~A~]~@[~A~]~A"