From bknr at bknr.net Sat Feb 5 07:46:00 2011 From: bknr at bknr.net (BKNR Commits) Date: Sat, 05 Feb 2011 08:46:00 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/acceptor.lisp Message-ID: Revision: 4641 Author: hans URL: http://bknr.net/trac/changeset/4641 Use FINISH-OUTPUT instead of FORCE-OUTPUT before connection teardown. Thanks to Ilya Perminov for reporting. U trunk/thirdparty/hunchentoot/acceptor.lisp Modified: trunk/thirdparty/hunchentoot/acceptor.lisp =================================================================== --- trunk/thirdparty/hunchentoot/acceptor.lisp 2011-01-25 11:43:07 UTC (rev 4640) +++ trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-05 07:45:59 UTC (rev 4641) @@ -323,7 +323,7 @@ :method method :uri url-string :server-protocol protocol)))) - (force-output *hunchentoot-stream*) + (finish-output *hunchentoot-stream*) (setq *hunchentoot-stream* (reset-connection-stream *acceptor* *hunchentoot-stream*)) (when *close-hunchentoot-stream* (return))))) @@ -332,7 +332,7 @@ ;; errors that may occur while flushing and/or closing the ;; stream. (ignore-errors* - (force-output *hunchentoot-stream*)) + (finish-output *hunchentoot-stream*)) (ignore-errors* (close *hunchentoot-stream* :abort t)))))) From bknr at bknr.net Mon Feb 7 17:27:24 2011 From: bknr at bknr.net (BKNR Commits) Date: Mon, 07 Feb 2011 18:27:24 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/drakma/ Message-ID: Revision: 4642 Author: hans URL: http://bknr.net/trac/changeset/4642 support Range: header to retrieve partial resources U trunk/thirdparty/drakma/doc/index.html U trunk/thirdparty/drakma/request.lisp Modified: trunk/thirdparty/drakma/doc/index.html =================================================================== --- trunk/thirdparty/drakma/doc/index.html 2011-02-05 07:45:59 UTC (rev 4641) +++ trunk/thirdparty/drakma/doc/index.html 2011-02-07 17:27:23 UTC (rev 4642) @@ -731,7 +731,55 @@ -


[Function]
http-request uri &key protocol method force-ssl parameters form-data content content-length content-type cookie-jar basic-authorization user-agent accept proxy proxy-basic-authorization additional-headers redirect redirect-methods auto-referer keep-alive close external-format-out external-format-in force-binary want-stream stream connection-timeout read-timeout write-timeout deadline
=> body-or-stream, status-code, headers, uri, stream, must-close, reason-phrase
+

+
+ + + + + + + + + + + + + + +
[Function]
http-request uri &key  + + protocol + method + force-ssl + parameters + form-data + content + content-length + content-type + cookie-jar + basic-authorization + user-agent + accept + range + proxy + proxy-basic-authorization + additional-headers + redirect + redirect-methods + auto-referer + keep-alive + close + external-format-out + external-format-in + force-binary + want-stream + stream + connection-timeout + read-timeout + write-timeout + deadline +
=> body-or-stream, status-code, headers, uri, stream, must-close, reason-phrase


Sends an HTTP request to a web server and returns its reply. @@ -935,6 +983,10 @@ it can be a string which is used directly. accept, if not NIL, is the 'Accept' header sent - the default is "*/*". +range optionally +specifies a subrange of the resource to be requested. It must be +specified as list of two integers which indicate the start and +(inclusive) end offset of the requested range, in bytes

If proxy is not NIL, it should be a string denoting Modified: trunk/thirdparty/drakma/request.lisp =================================================================== --- trunk/thirdparty/drakma/request.lisp 2011-02-05 07:45:59 UTC (rev 4641) +++ trunk/thirdparty/drakma/request.lisp 2011-02-07 17:27:23 UTC (rev 4642) @@ -190,6 +190,7 @@ basic-authorization (user-agent :drakma) (accept "*/*") + range proxy proxy-basic-authorization additional-headers @@ -314,9 +315,15 @@ which denote the current version of Drakma or, in the latter four cases, a fixed string corresponding to a more or less recent \(as of August 2006) version of the corresponding browser. Or it can -be a string which is used directly. ACCEPT, if not NIL, is the -`Accept' header sent. +be a string which is used directly. +ACCEPT, if not NIL, specifies the contents of the `Accept' header +sent. + +RANGE optionally specifies a subrange of the resource to be requested. +It must be specified as list of two integers which indicate the start +and (inclusive) end offset of the requested range, in bytes. + If PROXY is not NIL, it should be a string denoting a proxy server through which the request should be sent. Or it can be a list of two values - a string denoting the proxy server and an @@ -404,6 +411,12 @@ (parameter-error "CLOSE and KEEP-ALIVE must not be both true.")) (when (and form-data (not (eq method :post))) (parameter-error "FORM-DATA makes only sense with POST requests.")) + (when range + (unless (and (listp range) + (integerp (first range)) + (integerp (second range)) + (<= (first range) (second range))) + (parameter-error "RANGE parameter must be specified as list of two integers, with the second larger or equal to the first"))) ;; convert PROXY argument to canonical form (when proxy (when (atom proxy) @@ -558,6 +571,8 @@ (second proxy-basic-authorization))))) (when accept (write-header "Accept" "~A" accept)) + (when range + (write-header "Range" "bytes ~A-~A" (first range) (second range))) (when cookie-jar ;; write all cookies in one fell swoop, so even Sun's ;; web server has a chance to get it From bknr at bknr.net Mon Feb 7 17:42:05 2011 From: bknr at bknr.net (BKNR Commits) Date: Mon, 07 Feb 2011 18:42:05 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/ Message-ID: Revision: 4643 Author: hans URL: http://bknr.net/trac/changeset/4643 Numerous changes. Please note that startup has changed: (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242)) Please test Hunchentoot and report problems: (hunchentoot-test:test-hunchentoot "http://localhost:4242") Summary of changes: Overhaul error and return code handling. Improve behavior for internal errors. Support Range: header in static file handler. Use generic functions instead of closures in core functionality: acceptor-server-name, acceptor-remove-session, acceptor-dispatch-request, acceptor-handle-return-code I attempted to document all changes, but please report if there are any missing bits. _U trunk/thirdparty/hunchentoot/ U trunk/thirdparty/hunchentoot/acceptor.lisp U trunk/thirdparty/hunchentoot/doc/index.xml U trunk/thirdparty/hunchentoot/easy-handlers.lisp U trunk/thirdparty/hunchentoot/headers.lisp U trunk/thirdparty/hunchentoot/misc.lisp U trunk/thirdparty/hunchentoot/packages.lisp U trunk/thirdparty/hunchentoot/request.lisp U trunk/thirdparty/hunchentoot/session.lisp U trunk/thirdparty/hunchentoot/specials.lisp _U trunk/thirdparty/hunchentoot/test/ U trunk/thirdparty/hunchentoot/test/script-engine.lisp U trunk/thirdparty/hunchentoot/test/script.lisp U trunk/thirdparty/hunchentoot/test/test-handlers.lisp U trunk/thirdparty/hunchentoot/util.lisp Change set too large, please see URL above From bknr at bknr.net Wed Feb 9 17:07:09 2011 From: bknr at bknr.net (BKNR Commits) Date: Wed, 09 Feb 2011 18:07:09 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/ Message-ID: Revision: 4644 Author: hans URL: http://bknr.net/trac/changeset/4644 Add skeleton file tree to be served by Hunchentoot in its default configuration. Make error pages customizable through files. Add new :document-root argument to acceptor to specify where files should be served from. U trunk/thirdparty/hunchentoot/acceptor.lisp U trunk/thirdparty/hunchentoot/doc/index.xml U trunk/thirdparty/hunchentoot/easy-handlers.lisp U trunk/thirdparty/hunchentoot/misc.lisp A trunk/thirdparty/hunchentoot/www/ A trunk/thirdparty/hunchentoot/www/errors/ A trunk/thirdparty/hunchentoot/www/errors/404.html A trunk/thirdparty/hunchentoot/www/img/ A trunk/thirdparty/hunchentoot/www/img/made-with-lisp-logo.jpg A trunk/thirdparty/hunchentoot/www/index.html Modified: trunk/thirdparty/hunchentoot/acceptor.lisp =================================================================== --- trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-07 17:42:05 UTC (rev 4643) +++ trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-09 17:07:08 UTC (rev 4644) @@ -29,6 +29,10 @@ (in-package :hunchentoot) +(eval-when (:load-toplevel) + (defun default-document-directory (&optional sub-directory) + (asdf:system-relative-pathname :hunchentoot (format nil "www/~@[~A~]" sub-directory)))) + (defclass acceptor () ((port :initarg :port :reader acceptor-port @@ -124,7 +128,20 @@ :documentation "Pathname of the server error log file which is used to log informational, warning and error messages in a free-text -format intended for human inspection")) +format intended for human inspection") + (error-template-directory :initarg :error-template-directory + :accessor acceptor-error-template-directory + :documentation "Directory pathname that + contains error message template files for server-generated error + messages. Files must be named .html with + representing the HTTP return code that the file applies to, + i.e. 404.html would be used as the content for a HTTP 404 Not found + response.") + (document-root :initarg :document-root + :accessor acceptor-document-root + :documentation "Directory pathname that points to +files that are served by the acceptor if no more specific +acceptor-dispatch-request method handles the request.")) (:default-initargs :address nil :port 80 @@ -139,7 +156,9 @@ :read-timeout *default-connection-timeout* :write-timeout *default-connection-timeout* :access-log-pathname nil - :message-log-pathname nil) + :message-log-pathname nil + :document-root (load-time-value (default-document-directory)) + :error-template-directory (load-time-value (default-document-directory "errors/"))) (:documentation "To create a Hunchentoot webserver, you make an instance of this class and use the generic function START to start it \(and STOP to stop it). Use the :PORT initarg if you don't want to @@ -457,7 +476,12 @@ (defmethod acceptor-dispatch-request ((acceptor acceptor) request) "Detault implementation of the request dispatch method, generates a +http-not-found+ error+." (declare (ignore request)) - (setf (return-code *reply*) +http-not-found+)) + (if (acceptor-document-root acceptor) + (handle-static-file (merge-pathnames (if (equal (script-name*) "/") + "index.html" + (subseq (script-name*) 1)) + (acceptor-document-root acceptor))) + (setf (return-code *reply*) +http-not-found+))) (defmethod handle-request ((*acceptor* acceptor) (*request* request)) "Standard method for request handling. Calls the request dispatcher @@ -493,41 +517,72 @@ client. For other return codes, the content can be ignored and/or processed, depending on the requirements of the acceptor class. Note that the CONTENT argument can be NIL if the handler wants to - send the data to the client stream itself.")) + send the data to the client stream itself. + If an ERROR-TEMPLATE-DIRECTORY is set in the current acceptor and + the directory contains a file corresponding to HTTP-RETURN-CODE, + that file is sent to the client after variable substitution. + Variables are referenced by ${}. Currently, only + the ${script-name} variable is supported which contains the current + URL relative to the server's base URL.")) + (defmethod acceptor-handle-return-code ((acceptor acceptor) http-return-code content) "Default function to generate error message sent to the client." - (flet ((cooked-message (format &rest arguments) - (setf (content-type*) "text/html; charset=iso-8859-1") - (format nil "~D ~A

~:*~A

~?


~A

" - http-return-code (reason-phrase http-return-code) - format (mapcar (lambda (arg) - (if (stringp arg) - (escape-for-html arg) - arg)) - arguments) - (address-string)))) - (case http-return-code - ((#.+http-internal-server-error+ - #.+http-ok+) - content) - ((#.+http-moved-temporarily+ - #.+http-moved-permanently+) - (cooked-message "The document has moved here" (header-out :location))) - ((#.+http-authorization-required+) - (cooked-message "The server could not verify that you are authorized to access the document requested. ~ + (labels + ((cooked-message (format &rest arguments) + (setf (content-type*) "text/html; charset=iso-8859-1") + (format nil "~D ~A

~:*~A

~?


~A

" + http-return-code (reason-phrase http-return-code) + format (mapcar (lambda (arg) + (if (stringp arg) + (escape-for-html arg) + arg)) + arguments) + (address-string))) + (substitute-request-context-variables (string) + (cl-ppcre:regex-replace-all "(?i)\\$\\{([a-z0-9-_]+)\\}" + string + (lambda (target-string start end match-start match-end reg-starts reg-ends) + (declare (ignore start end match-start match-end)) + (let ((variable (intern (string-upcase (subseq target-string + (aref reg-starts 0) + (aref reg-ends 0))) + :keyword))) + (case variable + (:script-name (script-name*)) + (otherwise (string variable))))))) + (file-contents (file) + (let ((buf (make-string (file-length file)))) + (read-sequence buf file) + buf)) + (error-contents-from-template () + (let ((error-file-template-pathname (and (acceptor-error-template-directory acceptor) + (probe-file (make-pathname :name (princ-to-string http-return-code) + :type "html" + :defaults (acceptor-error-template-directory acceptor)))))) + (when error-file-template-pathname + (with-open-file (file error-file-template-pathname :if-does-not-exist nil :element-type 'character) + (when file + (substitute-request-context-variables (file-contents file)))))))) + (or (error-contents-from-template) + (case http-return-code + ((#.+http-moved-temporarily+ + #.+http-moved-permanently+) + (cooked-message "The document has moved here" (header-out :location))) + ((#.+http-authorization-required+) + (cooked-message "The server could not verify that you are authorized to access the document requested. ~ Either you supplied the wrong credentials \(e.g., bad password), or your browser doesn't ~ understand how to supply the credentials required.")) - ((#.+http-forbidden+) - (cooked-message "You don't have permission to access ~A on this server." - (script-name *request*))) - ((#.+http-not-found+) - (cooked-message "The requested URL ~A was not found on this server." - (script-name *request*))) - ((#.+http-bad-request+) - (cooked-message "Your browser sent a request that this server could not understand.")) - (otherwise - content)))) + ((#.+http-forbidden+) + (cooked-message "You don't have permission to access ~A on this server." + (script-name *request*))) + ((#.+http-not-found+) + (cooked-message "The requested URL ~A was not found on this server." + (script-name *request*))) + ((#.+http-bad-request+) + (cooked-message "Your browser sent a request that this server could not understand.")) + (otherwise + content))))) (defgeneric acceptor-remove-session (acceptor session) (:documentation Modified: trunk/thirdparty/hunchentoot/doc/index.xml =================================================================== --- trunk/thirdparty/hunchentoot/doc/index.xml 2011-02-07 17:42:05 UTC (rev 4643) +++ trunk/thirdparty/hunchentoot/doc/index.xml 2011-02-09 17:07:08 UTC (rev 4644) @@ -475,10 +475,10 @@ - + acceptor - request-dispatcher + (or pathname null) @@ -531,6 +531,13 @@ + + acceptor + + request-dispatcher + + + These are accessors for various slots of ACCEPTOR objects. See the docstrings of these slots for more information and @@ -685,6 +692,32 @@ + + acceptor http-return-code content + + This function is called after the request's handler has been + invoked, before starting to send any output to the client. It + converts the HTTP return code that has been determined as the + result of the handler invocation into a content body sent to + the user. The content generated by the handler is passed to + this function as CONTENT argument. For + positive return codes (i.e. ``200 OK''), the CONTENT is + typically just sent to the client. For other return codes, + the content can be ignored and/or processed, depending on the + requirements of the acceptor class. Note that the + CONTENT argument can be NIL if the + handler wants to send the data to the client stream itself. + + If an ERROR-TEMPLATE-DIRECTORY is set in the current acceptor + and the directory contains a file corresponding to + HTTP-RETURN-CODE, that file is sent to + the client after variable substitution. Variables are + referenced by ${<variable-name>}. Currently, only the + ${script-name} variable is supported which contains the + current URL relative to the server's base URL. + + + Modified: trunk/thirdparty/hunchentoot/easy-handlers.lisp =================================================================== --- trunk/thirdparty/hunchentoot/easy-handlers.lisp 2011-02-07 17:42:05 UTC (rev 4643) +++ trunk/thirdparty/hunchentoot/easy-handlers.lisp 2011-02-09 17:07:08 UTC (rev 4644) @@ -29,7 +29,7 @@ (in-package :hunchentoot) -(defvar *dispatch-table* (list 'dispatch-easy-handlers 'default-dispatcher) +(defvar *dispatch-table* (list 'dispatch-easy-handlers) "A global list of dispatch functions.") (defvar *easy-handler-alist* nil @@ -339,4 +339,4 @@ (loop for dispatcher in *dispatch-table* for action = (funcall dispatcher request) when action return (funcall action) - finally (setf (return-code *reply*) +http-not-found+))) + finally (call-next-method))) Modified: trunk/thirdparty/hunchentoot/misc.lisp =================================================================== --- trunk/thirdparty/hunchentoot/misc.lisp 2011-02-07 17:42:05 UTC (rev 4643) +++ trunk/thirdparty/hunchentoot/misc.lisp 2011-02-09 17:07:08 UTC (rev 4644) @@ -145,28 +145,29 @@ bytes-to-send (1+ (- end start)))) bytes-to-send)) -(defun handle-static-file (path &optional content-type) +(defun handle-static-file (pathname &optional content-type) "A function which acts like a Hunchentoot handler for the file -denoted by PATH. Sends a content type header corresponding to +denoted by PATHNAME. 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)) + (when (or (wild-pathname-p pathname) + (not (fad:file-exists-p pathname)) + (fad:directory-exists-p pathname)) ;; file does not exist (setf (return-code*) +http-not-found+) (abort-request-handler)) - (let ((time (or (file-write-date path) (get-universal-time))) + (let ((time (or (file-write-date pathname) + (get-universal-time))) bytes-to-send) - (setf (content-type*) (or content-type - (mime-type path) - "application/octet-stream")) (handle-if-modified-since time) - (with-open-file (file path - :direction :input - :element-type 'octet - :if-does-not-exist nil) - (setf (header-out :content-range) (format nil "bytes 0-~D/*" (file-length file)) + (with-open-file (file pathname + :direction :input + :element-type 'octet + :if-does-not-exist nil) + (setf (content-type*) (or content-type + (mime-type pathname) + "application/octet-stream") + (header-out :content-range) (format nil "bytes 0-~D/*" (file-length file)) (header-out :last-modified) (rfc-1123-date time) bytes-to-send (maybe-handle-range-header file) (content-length*) bytes-to-send) Added: trunk/thirdparty/hunchentoot/www/errors/404.html =================================================================== --- trunk/thirdparty/hunchentoot/www/errors/404.html (rev 0) +++ trunk/thirdparty/hunchentoot/www/errors/404.html 2011-02-09 17:07:08 UTC (rev 4644) @@ -0,0 +1,9 @@ + + + Not found + + + Resource ${script-name} not found. + + + Added: trunk/thirdparty/hunchentoot/www/img/made-with-lisp-logo.jpg =================================================================== (Binary files differ) Property changes on: trunk/thirdparty/hunchentoot/www/img/made-with-lisp-logo.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/thirdparty/hunchentoot/www/index.html =================================================================== --- trunk/thirdparty/hunchentoot/www/index.html (rev 0) +++ trunk/thirdparty/hunchentoot/www/index.html 2011-02-09 17:07:08 UTC (rev 4644) @@ -0,0 +1,17 @@ + + + Welcome to Hunchentoot! + + +

Welcome

+

+ When you're reading this message, Hunchentoot has been properly installed. +

+

+ Please read the documentation. +

+

+ +

+ + From bknr at bknr.net Thu Feb 10 17:22:01 2011 From: bknr at bknr.net (BKNR Commits) Date: Thu, 10 Feb 2011 18:22:01 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/ Message-ID: Revision: 4645 Author: hans URL: http://bknr.net/trac/changeset/4645 Patch from Dan Weinreb: limit the maximum number of request handler threads that a taskmaster may create. Support a new SOFT argument to the STOP function that makes Hunchentoot wait until all currently outstanding requests have been processed before returning. Add a favicon.ico to the standard file tree. Refactorings in the START-OUTPUT function to separate out the actual header sending from the request processing part. The new SEND-RESPONSE function does the I/O part of sending the response header (and possibly content) and also does the logging. Used by the thread count limiting code to send a 503 message if no more threads can be created. U trunk/thirdparty/hunchentoot/acceptor.lisp U trunk/thirdparty/hunchentoot/compat.lisp U trunk/thirdparty/hunchentoot/headers.lisp U trunk/thirdparty/hunchentoot/taskmaster.lisp U trunk/thirdparty/hunchentoot/util.lisp A trunk/thirdparty/hunchentoot/www/favicon.ico Change set too large, please see URL above From bknr at bknr.net Thu Feb 10 19:33:05 2011 From: bknr at bknr.net (BKNR Commits) Date: Thu, 10 Feb 2011 20:33:05 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/ Message-ID: Revision: 4646 Author: hans URL: http://bknr.net/trac/changeset/4646 fixes for lispworks U trunk/thirdparty/hunchentoot/acceptor.lisp U trunk/thirdparty/hunchentoot/lispworks.lisp Modified: trunk/thirdparty/hunchentoot/acceptor.lisp =================================================================== --- trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-10 17:22:00 UTC (rev 4645) +++ trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-10 19:33:05 UTC (rev 4646) @@ -29,7 +29,7 @@ (in-package :hunchentoot) -(eval-when (:load-toplevel) +(eval-when (:load-toplevel :compile-toplevel :execute) (defun default-document-directory (&optional sub-directory) (asdf:system-relative-pathname :hunchentoot (format nil "www/~@[~A~]" sub-directory)))) Modified: trunk/thirdparty/hunchentoot/lispworks.lisp =================================================================== --- trunk/thirdparty/hunchentoot/lispworks.lisp 2011-02-10 17:22:00 UTC (rev 4645) +++ trunk/thirdparty/hunchentoot/lispworks.lisp 2011-02-10 19:33:05 UTC (rev 4646) @@ -122,3 +122,12 @@ (editor:setup-indent "handler-case*" 1 2 4) +(defun make-condition-variable (&key name) + (declare (ignore name)) + (mp:make-condition-variable)) + +(defun condition-variable-signal (condition-variable) + (mp:condition-variable-signal condition-variable)) + +(defun condition-variable-wait (condition-variable lock) + (mp:condition-variable-wait condition-variable lock)) From bknr at bknr.net Thu Feb 10 20:44:07 2011 From: bknr at bknr.net (BKNR Commits) Date: Thu, 10 Feb 2011 21:44:07 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/www/hunchentoot-doc.html Message-ID: Revision: 4647 Author: hans URL: http://bknr.net/trac/changeset/4647 add html version of documentation A trunk/thirdparty/hunchentoot/www/hunchentoot-doc.html Change set too large, please see URL above From bknr at bknr.net Thu Feb 10 21:14:39 2011 From: bknr at bknr.net (BKNR Commits) Date: Thu, 10 Feb 2011 22:14:39 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/doc/index.xml Message-ID: Revision: 4648 Author: hans URL: http://bknr.net/trac/changeset/4648 reindent documentation source U trunk/thirdparty/hunchentoot/doc/index.xml Change set too large, please see URL above From bknr at bknr.net Thu Feb 10 22:20:18 2011 From: bknr at bknr.net (BKNR Commits) Date: Thu, 10 Feb 2011 23:20:18 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/www/ Message-ID: Revision: 4649 Author: hans URL: http://bknr.net/trac/changeset/4649 add hunchentoot.gif for html doc A trunk/thirdparty/hunchentoot/www/hunchentoot.gif U trunk/thirdparty/hunchentoot/www/index.html Added: trunk/thirdparty/hunchentoot/www/hunchentoot.gif =================================================================== --- trunk/thirdparty/hunchentoot/www/hunchentoot.gif (rev 0) +++ trunk/thirdparty/hunchentoot/www/hunchentoot.gif 2011-02-10 22:20:18 UTC (rev 4649) @@ -0,0 +1 @@ +link ../doc/hunchentoot.gif \ No newline at end of file Property changes on: trunk/thirdparty/hunchentoot/www/hunchentoot.gif ___________________________________________________________________ Added: svn:special + * Modified: trunk/thirdparty/hunchentoot/www/index.html =================================================================== --- trunk/thirdparty/hunchentoot/www/index.html 2011-02-10 21:14:39 UTC (rev 4648) +++ trunk/thirdparty/hunchentoot/www/index.html 2011-02-10 22:20:18 UTC (rev 4649) @@ -8,7 +8,7 @@ When you're reading this message, Hunchentoot has been properly installed.

- Please read the documentation. + Please read the documentation.

From bknr at bknr.net Fri Feb 11 10:10:17 2011 From: bknr at bknr.net (BKNR Commits) Date: Fri, 11 Feb 2011 11:10:17 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/ Message-ID: Revision: 4650 Author: hans URL: http://bknr.net/trac/changeset/4650 Further status message generation improvements Provide more substitution variables (${error} and ${backtrace} in particular) Add simple (and ugly) internal server error template Rename ACCEPTOR-HANDLE-RETURN-CODE to ACCEPTOR-STATUS-MESSAGE, make it return the HTML message, remove CONTENT argument to simplify things Update documentation U trunk/thirdparty/hunchentoot/acceptor.lisp U trunk/thirdparty/hunchentoot/doc/index.xml U trunk/thirdparty/hunchentoot/headers.lisp U trunk/thirdparty/hunchentoot/request.lisp U trunk/thirdparty/hunchentoot/taskmaster.lisp U trunk/thirdparty/hunchentoot/test/test-handlers.lisp A trunk/thirdparty/hunchentoot/www/errors/500.html Modified: trunk/thirdparty/hunchentoot/acceptor.lisp =================================================================== --- trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-10 22:20:18 UTC (rev 4649) +++ trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-11 10:10:17 UTC (rev 4650) @@ -543,84 +543,110 @@ (with-debugger (acceptor-dispatch-request *acceptor* *request*)))) -(defgeneric acceptor-handle-return-code (acceptor http-return-code content) +(defgeneric acceptor-status-message (acceptor http-status-code &key &allow-other-keys) (:documentation "This function is called after the request's handler has been - invoked, before starting to send any output to the client. It - converts the HTTP return code that has been determined as the - result of the handler invocation into a content body sent to the - user. The content generated by the handler is passed to this - function as CONTENT argument. For positive return - codes (i.e. ``200 OK''), the CONTENT is typically just sent to the - client. For other return codes, the content can be ignored and/or - processed, depending on the requirements of the acceptor class. - Note that the CONTENT argument can be NIL if the handler wants to - send the data to the client stream itself. + invoked to convert the HTTP-STATUS-CODE to a HTML message to be + displayed to the user. If this function returns a string, that + string is sent to the client instead of the content produced by the + handler, if any. If an ERROR-TEMPLATE-DIRECTORY is set in the current acceptor and - the directory contains a file corresponding to HTTP-RETURN-CODE, - that file is sent to the client after variable substitution. - Variables are referenced by ${}. Currently, only - the ${script-name} variable is supported which contains the current - URL relative to the server's base URL.")) + the directory contains a file corresponding to HTTP-STATUS-CODE + named .html, that file is sent to the client after variable + substitution. Variables are referenced by ${}. -(defmethod acceptor-handle-return-code ((acceptor acceptor) http-return-code content) + Additional keyword arguments may be provided which are made + available to the templating logic as substitution variables. These + variables can be interpolated into error message templates in, + which contains the current URL relative to the server and without + GET parameters. + + In addition to the variables corresponding to keyword arguments, + the script-name, lisp-implementation-type, + lisp-implementation-version and hunchentoot-version variables are + available.")) + +(defun make-cooked-message (http-status-code &key error backtrace) + (labels ((cooked-message (format &rest arguments) + (setf (content-type*) "text/html; charset=iso-8859-1") + (format nil "~D ~A

~:*~A

~?


~A

" + http-status-code (reason-phrase http-status-code) + format (mapcar (lambda (arg) + (if (stringp arg) + (escape-for-html arg) + arg)) + arguments) + (address-string)))) + (case http-status-code + ((#.+http-moved-temporarily+ + #.+http-moved-permanently+) + (cooked-message "The document has moved here" (header-out :location))) + ((#.+http-authorization-required+) + (cooked-message "The server could not verify that you are authorized to access the document requested. ~ + Either you supplied the wrong credentials \(e.g., bad password), or your browser doesn't ~ + understand how to supply the credentials required.")) + ((#.+http-forbidden+) + (cooked-message "You don't have permission to access ~A on this server." + (script-name *request*))) + ((#.+http-not-found+) + (cooked-message "The requested URL ~A was not found on this server." + (script-name *request*))) + ((#.+http-bad-request+) + (cooked-message "Your browser sent a request that this server could not understand.")) + ((#.+http-internal-server-error+) + (if *show-lisp-errors-p* + (cooked-message "
~A~@[~%~%Backtrace:~%~%~A~]
" + (escape-for-html (princ-to-string error)) + (when *show-lisp-backtraces-p* + (escape-for-html (princ-to-string backtrace)))) + (cooked-message "An error has occured")))))) + +(defmethod acceptor-status-message ((acceptor t) http-status-code &rest args &key &allow-other-keys) + (apply 'make-cooked-message http-status-code args)) + +(defmethod acceptor-status-message :around ((acceptor acceptor) http-status-code &rest args &key &allow-other-keys) + (handler-case + (call-next-method) + (error (e) + (log-message* :error "error ~A during error processing, sending cooked message to client" e) + (apply 'make-cooked-message http-status-code args)))) + +(defmethod acceptor-status-message ((acceptor acceptor) http-status-code &rest properties &key &allow-other-keys) "Default function to generate error message sent to the client." (labels - ((cooked-message (format &rest arguments) - (setf (content-type*) "text/html; charset=iso-8859-1") - (format nil "~D ~A

~:*~A

~?


~A

" - http-return-code (reason-phrase http-return-code) - format (mapcar (lambda (arg) - (if (stringp arg) - (escape-for-html arg) - arg)) - arguments) - (address-string))) - (substitute-request-context-variables (string) - (cl-ppcre:regex-replace-all "(?i)\\$\\{([a-z0-9-_]+)\\}" - string - (lambda (target-string start end match-start match-end reg-starts reg-ends) - (declare (ignore start end match-start match-end)) - (let ((variable (intern (string-upcase (subseq target-string - (aref reg-starts 0) - (aref reg-ends 0))) - :keyword))) - (case variable - (:script-name (script-name*)) - (otherwise (string variable))))))) + ((substitute-request-context-variables (string) + (let ((properties (append `(:script-name ,(script-name*) + :lisp-implementation-type ,(lisp-implementation-type) + :lisp-implementation-version ,(lisp-implementation-version) + :hunchentoot-version ,*hunchentoot-version*) + properties))) + (cl-ppcre:regex-replace-all "(?i)\\$\\{([a-z0-9-_]+)\\}" + string + (lambda (target-string start end match-start match-end reg-starts reg-ends) + (declare (ignore start end match-start match-end)) + (let ((variable-name (intern (string-upcase (subseq target-string + (aref reg-starts 0) + (aref reg-ends 0))) + :keyword))) + (escape-for-html (princ-to-string (getf properties variable-name variable-name)))))))) (file-contents (file) (let ((buf (make-string (file-length file)))) (read-sequence buf file) buf)) (error-contents-from-template () (let ((error-file-template-pathname (and (acceptor-error-template-directory acceptor) - (probe-file (make-pathname :name (princ-to-string http-return-code) + (probe-file (make-pathname :name (princ-to-string http-status-code) :type "html" :defaults (acceptor-error-template-directory acceptor)))))) (when error-file-template-pathname (with-open-file (file error-file-template-pathname :if-does-not-exist nil :element-type 'character) (when file (substitute-request-context-variables (file-contents file)))))))) - (or (error-contents-from-template) - (case http-return-code - ((#.+http-moved-temporarily+ - #.+http-moved-permanently+) - (cooked-message "The document has moved here" (header-out :location))) - ((#.+http-authorization-required+) - (cooked-message "The server could not verify that you are authorized to access the document requested. ~ - Either you supplied the wrong credentials \(e.g., bad password), or your browser doesn't ~ - understand how to supply the credentials required.")) - ((#.+http-forbidden+) - (cooked-message "You don't have permission to access ~A on this server." - (script-name *request*))) - ((#.+http-not-found+) - (cooked-message "The requested URL ~A was not found on this server." - (script-name *request*))) - ((#.+http-bad-request+) - (cooked-message "Your browser sent a request that this server could not understand.")) - (otherwise - content))))) + (or (unless (< 300 http-status-code) + (call-next-method)) ; don't ever try template for positive return codes + (error-contents-from-template) ; try template + (call-next-method)))) ; fall back to cooked message (defgeneric acceptor-remove-session (acceptor session) (:documentation Modified: trunk/thirdparty/hunchentoot/doc/index.xml =================================================================== --- trunk/thirdparty/hunchentoot/doc/index.xml 2011-02-10 22:20:18 UTC (rev 4649) +++ trunk/thirdparty/hunchentoot/doc/index.xml 2011-02-11 10:10:17 UTC (rev 4650) @@ -704,29 +704,31 @@ - + acceptor http-return-code content This function is called after the request's handler has been - invoked, before starting to send any output to the client. It - converts the HTTP return code that has been determined as the - result of the handler invocation into a content body sent to - the user. The content generated by the handler is passed to - this function as CONTENT argument. For - positive return codes (i.e. ``200 OK''), the CONTENT is - typically just sent to the client. For other return codes, - the content can be ignored and/or processed, depending on the - requirements of the acceptor class. Note that the - CONTENT argument can be NIL if the - handler wants to send the data to the client stream itself. + invoked to convert the HTTP-STATUS-CODE + to a HTML message to be displayed to the user. If this + function returns a string, that string is sent to the client + instead of the content produced by the handler, if any. - If an ERROR-TEMPLATE-DIRECTORY is set in the current acceptor - and the directory contains a file corresponding to - HTTP-RETURN-CODE, that file is sent to - the client after variable substitution. Variables are - referenced by ${<variable-name>}. Currently, only the - ${script-name} variable is supported which contains the - current URL relative to the server's base URL. + If an ERROR-TEMPLATE-DIRECTORY is set in the current + acceptor and the directory contains a file corresponding to + HTTP-STATUS-CODE named <code>.html, that file is sent + to the client after variable substitution. Variables are + referenced by ${<variable-name>}. + + Additional keyword arguments may be provided which are made + available to the templating logic as substitution variables. + These variables can be interpolated into error message + templates in, which contains the current URL relative to the + server and without GET parameters. + + In addition to the variables corresponding to keyword + arguments, the script-name, lisp-implementation-type, + lisp-implementation-version and hunchentoot-version + variables are available. Modified: trunk/thirdparty/hunchentoot/headers.lisp =================================================================== --- trunk/thirdparty/hunchentoot/headers.lisp 2011-02-10 22:20:18 UTC (rev 4649) +++ trunk/thirdparty/hunchentoot/headers.lisp 2011-02-11 10:10:17 UTC (rev 4650) @@ -145,9 +145,9 @@ (defun send-response (acceptor stream status-code &key headers cookies content) "Send a HTTP response to the STREAM and log the event in ACCEPTOR. - STATUS-CODE is the HTTP status code used in the response. If - CONTENT-LENGTH, HEADERS and COOKIES are used to create the response - header. If CONTENT is provided, it is sent as the response body. + STATUS-CODE is the HTTP status code used in the response. HEADERS + and COOKIES are used to create the response header. If CONTENT is + provided, it is sent as the response body. If *HEADER-STREAM* is not NIL, the response headers are written to that stream when they are written to the client. @@ -160,8 +160,7 @@ (setf (cdr (assoc :content-length headers)) (content-length*)) (push (cons :content-length (content-length*)) headers))) ;; access log message - (acceptor-log-access acceptor - :return-code status-code) + (acceptor-log-access acceptor :return-code status-code) ;; Read post data to clear stream - Force binary mode to avoid OCTETS-TO-STRING overhead. (raw-post-data :force-binary t) (let* ((client-header-stream (flex:make-flexi-stream stream :external-format :iso-8859-1)) @@ -180,7 +179,8 @@ (format header-stream "~C~C" #\Return #\Linefeed)) ;; now optional content (when content - (write-sequence content stream)) + (write-sequence content stream) + (finish-output stream)) stream) (defun send-headers () Modified: trunk/thirdparty/hunchentoot/request.lisp =================================================================== --- trunk/thirdparty/hunchentoot/request.lisp 2011-02-10 22:20:18 UTC (rev 4649) +++ trunk/thirdparty/hunchentoot/request.lisp 2011-02-11 10:10:17 UTC (rev 4650) @@ -224,12 +224,10 @@ (log-message* *lisp-errors-log-level* "~A~@[~%~A~]" error (when *log-lisp-backtraces-p* backtrace))) (start-output +http-internal-server-error+ - (if *show-lisp-errors-p* - (format nil "
~A~@[~%~%Backtrace:~%~%~A~]
" - (escape-for-html (princ-to-string error)) - (when *show-lisp-backtraces-p* - (escape-for-html (princ-to-string backtrace)))) - "An error has occured")))) + (acceptor-status-message *acceptor* + +http-internal-server-error+ + :error (princ-to-string error) + :backtrace (princ-to-string backtrace))))) (multiple-value-bind (body error backtrace) ;; skip dispatch if bad request (when (eql (return-code *reply*) +http-ok+) @@ -242,9 +240,9 @@ (handler-case (with-debugger (start-output (return-code *reply*) - (acceptor-handle-return-code *acceptor* - (return-code *reply*) - body))) + (or (acceptor-status-message *acceptor* + (return-code *reply*)) + body))) (error (e) ;; error occured while writing to the client. attempt to report. (report-error-to-client e))))))) Modified: trunk/thirdparty/hunchentoot/taskmaster.lisp =================================================================== --- trunk/thirdparty/hunchentoot/taskmaster.lisp 2011-02-10 22:20:18 UTC (rev 4649) +++ trunk/thirdparty/hunchentoot/taskmaster.lisp 2011-02-11 10:10:17 UTC (rev 4650) @@ -322,8 +322,7 @@ (send-response acceptor (initialize-connection-stream acceptor (make-socket-stream socket acceptor)) +http-service-unavailable+ - :content "Service unavailable

Service unavailable

Please try later." - :headers '(("Content-Type" . "text/html"))))) + :content (acceptor-status-message acceptor +http-service-unavailable+)))) #-:lispworks (defun client-as-string (socket) Modified: trunk/thirdparty/hunchentoot/test/test-handlers.lisp =================================================================== --- trunk/thirdparty/hunchentoot/test/test-handlers.lisp 2011-02-10 22:20:18 UTC (rev 4649) +++ trunk/thirdparty/hunchentoot/test/test-handlers.lisp 2011-02-11 10:10:17 UTC (rev 4650) @@ -135,9 +135,9 @@ (defun oops () (with-html - (log-message :error "Oops \(error log level).") - (log-message :warning "Oops \(warning log level).") - (log-message :info "Oops \(info log level).") + (log-message* :error "Oops \(error log level).") + (log-message* :warning "Oops \(warning log level).") + (log-message* :info "Oops \(info log level).") (error "Errors were triggered on purpose. Check your error log.") (:html (:body "You should never see this sentence...")))) Added: trunk/thirdparty/hunchentoot/www/errors/500.html =================================================================== --- trunk/thirdparty/hunchentoot/www/errors/500.html (rev 0) +++ trunk/thirdparty/hunchentoot/www/errors/500.html 2011-02-11 10:10:17 UTC (rev 4650) @@ -0,0 +1,18 @@ + + + Internal Server Error + + +

Internal Server Error

+ An error occured while processing your ${script-name} request. +
+

Error Message

+
${error}
+

Backtrace

+
${backtrace}
+
+Hunchentoot ${hunchentoot-version} running on ${lisp-implementation-type} ${lisp-implementation-version} +
+ + + From bknr at bknr.net Tue Feb 15 16:58:54 2011 From: bknr at bknr.net (BKNR Commits) Date: Tue, 15 Feb 2011 17:58:54 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/packages.lisp Message-ID: Revision: 4651 Author: hans URL: http://bknr.net/trac/changeset/4651 Fix some exports, thanks to Andrey Moskvitin U trunk/thirdparty/hunchentoot/packages.lisp Modified: trunk/thirdparty/hunchentoot/packages.lisp =================================================================== --- trunk/thirdparty/hunchentoot/packages.lisp 2011-02-11 10:10:17 UTC (rev 4650) +++ trunk/thirdparty/hunchentoot/packages.lisp 2011-02-15 16:58:53 UTC (rev 4651) @@ -29,245 +29,249 @@ (in-package :cl-user) -(defpackage "HUNCHENTOOT" - (:nicknames "TBNL") +(defpackage #:HUNCHENTOOT + (:nicknames #:TBNL) (:use :cl :cl-ppcre :chunga :flexi-streams :url-rewrite) - (:shadow "DEFCONSTANT" - "URL-ENCODE") + (:shadow #:DEFCONSTANT + #:URL-ENCODE) ;; see ASDF system definition (:import-from :hunchentoot-asd :*hunchentoot-version*) #+:lispworks - (:import-from :lw "WITH-UNIQUE-NAMES" "WHEN-LET") - (:export "*ACCEPTOR*" - "*ACCESS-LOG-PATHNAME*" - "*APPROVED-RETURN-CODES*" - "*CATCH-ERRORS-P*" + (:import-from :lw #:WITH-UNIQUE-NAMES #:WHEN-LET) + (:export #:*ACCEPTOR* + #:*ACCESS-LOG-PATHNAME* + #:*APPROVED-RETURN-CODES* + #:*CATCH-ERRORS-P* #+:lispworks - "*CLEANUP-FUNCTION*" + #:*CLEANUP-FUNCTION* #+:lispworks - "*CLEANUP-INTERVAL*" - "*CONTENT-TYPES-FOR-URL-REWRITE*" - "*DEFAULT-CONNECTION-TIMEOUT*" - "*DEFAULT-CONTENT-TYPE*" - "*DEFAULT-HANDLER*" - "*DISPATCH-TABLE*" - "*FILE-UPLOAD-HOOK*" - "*HANDLE-HTTP-ERRORS-P*" - "*HEADER-STREAM*" - "*HTTP-ERROR-HANDLER*" - "*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT*" - "*LISP-ERRORS-LOG-LEVEL*" - "*LISP-WARNINGS-LOG-LEVEL*" - "*LISTENER*" - "*LOG-LISP-BACKTRACES-P*" - "*LOG-LISP-ERRORS-P*" - "*LOG-LISP-WARNINGS-P*" - "*MESSAGE-LOG-PATHNAME*" - "*METHODS-FOR-POST-PARAMETERS*" - "*REPLY*" - "*REQUEST*" - "*REWRITE-FOR-SESSION-URLS*" - "*SESSION*" - "*SESSION-GC-FREQUENCY*" - "*SESSION-MAX-TIME*" - "*SESSION-REMOVAL-HOOK*" - "*SESSION-SECRET*" - "*SHOW-LISP-BACKTRACES-P*" - "*SHOW-LISP-ERRORS-P*" - "*TMP-DIRECTORY*" - "*USE-REMOTE-ADDR-FOR-SESSIONS*" - "*USE-USER-AGENT-FOR-SESSIONS*" - "+HTTP-ACCEPTED+" - "+HTTP-AUTHORIZATION-REQUIRED+" - "+HTTP-BAD-GATEWAY+" - "+HTTP-BAD-REQUEST+" - "+HTTP-CONFLICT+" - "+HTTP-CONTINUE+" - "+HTTP-CREATED+" - "+HTTP-EXPECTATION-FAILED+" - "+HTTP-FAILED-DEPENDENCY+" - "+HTTP-FORBIDDEN+" - "+HTTP-GATEWAY-TIME-OUT+" - "+HTTP-GONE+" - "+HTTP-INTERNAL-SERVER-ERROR+" - "+HTTP-LENGTH-REQUIRED+" - "+HTTP-METHOD-NOT-ALLOWED+" - "+HTTP-MOVED-PERMANENTLY+" - "+HTTP-MOVED-TEMPORARILY+" - "+HTTP-MULTI-STATUS+" - "+HTTP-MULTIPLE-CHOICES+" - "+HTTP-NO-CONTENT+" - "+HTTP-NON-AUTHORITATIVE-INFORMATION+" - "+HTTP-NOT-ACCEPTABLE+" - "+HTTP-NOT-FOUND+" - "+HTTP-NOT-IMPLEMENTED+" - "+HTTP-NOT-MODIFIED+" - "+HTTP-OK+" - "+HTTP-PARTIAL-CONTENT+" - "+HTTP-PAYMENT-REQUIRED+" - "+HTTP-PRECONDITION-FAILED+" - "+HTTP-PROXY-AUTHENTICATION-REQUIRED+" - "+HTTP-REQUEST-ENTITY-TOO-LARGE+" - "+HTTP-REQUEST-TIME-OUT+" - "+HTTP-REQUEST-URI-TOO-LARGE+" - "+HTTP-REQUESTED-RANGE-NOT-SATISFIABLE+" - "+HTTP-RESET-CONTENT+" - "+HTTP-SEE-OTHER+" - "+HTTP-SERVICE-UNAVAILABLE+" - "+HTTP-SWITCHING-PROTOCOLS+" - "+HTTP-TEMPORARY-REDIRECT+" - "+HTTP-UNSUPPORTED-MEDIA-TYPE+" - "+HTTP-USE-PROXY+" - "+HTTP-VERSION-NOT-SUPPORTED+" - "ABORT-REQUEST-HANDLER" - "ACCEPTOR" - "ACCEPTOR-ACCESS-LOG-PATHNAME" - "ACCEPTOR-ADDRESS" - "ACCEPT-CONNECTIONS" - "ACCEPTOR-REQUEST-DISPATCHER" - "ACCEPTOR-INPUT-CHUNKING-P" - "ACCEPTOR-LOG-ACCESS" - "ACCEPTOR-LOG-MESSAGE" - "ACCEPTOR-MESSAGE-LOG-PATHNAME" - "ACCEPTOR-NAME" - "ACCEPTOR-OUTPUT-CHUNKING-P" - "ACCEPTOR-PERSISTENT-CONNECTIONS-P" - "ACCEPTOR-PORT" - "ACCEPTOR-READ-TIMEOUT" - "ACCEPTOR-REPLY-CLASS" - "ACCEPTOR-REQUEST-CLASS" - "ACCEPTOR-SSL-P" - #-:hunchentoot-no-ssl "ACCEPTOR-SSL-CERTIFICATE-FILE" - #-:hunchentoot-no-ssl "ACCEPTOR-SSL-PRIVATEKEY-FILE" - #-:hunchentoot-no-ssl "ACCEPTOR-SSL-PRIVATEKEY-PASSWORD" - "ACCEPTOR-WRITE-TIMEOUT" - "AUTHORIZATION" - "AUX-REQUEST-VALUE" - "CONTENT-LENGTH" - "CONTENT-LENGTH*" - "CONTENT-TYPE" - "CONTENT-TYPE*" - "COOKIE-DOMAIN" - "COOKIE-EXPIRES" - "COOKIE-HTTP-ONLY" - "COOKIE-IN" - "COOKIE-NAME" - "COOKIE-OUT" - "COOKIE-PATH" - "COOKIE-SECURE" - "COOKIE-VALUE" - "COOKIES-IN" - "COOKIES-IN*" - "COOKIES-OUT" - "COOKIES-OUT*" - "CREATE-FOLDER-DISPATCHER-AND-HANDLER" - "CREATE-PREFIX-DISPATCHER" - "CREATE-REGEX-DISPATCHER" - "CREATE-STATIC-FILE-DISPATCHER-AND-HANDLER" - "DEFAULT-DISPATCHER" - "DEFINE-EASY-HANDLER" - "DELETE-AUX-REQUEST-VALUE" - "DELETE-SESSION-VALUE" - "DISPATCH-EASY-HANDLERS" - "EASY-ACCEPTOR" - "ESCAPE-FOR-HTML" - "EXECUTE-ACCEPTOR" - "GET-PARAMETER" - "GET-PARAMETERS" - "GET-PARAMETERS*" - "HANDLE-INCOMING-CONNECTION" - "HANDLE-IF-MODIFIED-SINCE" - "HANDLE-REQUEST" - "HANDLE-STATIC-FILE" - "HEADER-IN" - "HEADER-IN*" - "HEADER-OUT" - "HEADERS-IN" - "HEADERS-IN*" - "HEADERS-OUT" - "HEADERS-OUT*" - "HOST" - "HTTP-TOKEN-P" - "HUNCHENTOOT-CONDITION" - "HUNCHENTOOT-ERROR" - "HUNCHENTOOT-WARNING" - "INITIALIZE-CONNECTION-STREAM" - "LOG-MESSAGE*" - "MAYBE-INVOKE-DEBUGGER" - "MIME-TYPE" - "NEXT-SESSION-ID" - "NO-CACHE" - "ONE-THREAD-PER-CONNECTION-TASKMASTER" - "PARAMETER" - "PARAMETER-ERROR" - "POST-PARAMETER" - "POST-PARAMETERS" - "POST-PARAMETERS*" - "PROCESS-CONNECTION" - "PROCESS-REQUEST" - "QUERY-STRING" - "QUERY-STRING*" - "RAW-POST-DATA" - "REAL-REMOTE-ADDR" - "REASON-PHRASE" - "RECOMPUTE-REQUEST-PARAMETERS" - "REDIRECT" - "REFERER" - "REMOTE-ADDR" - "REMOTE-ADDR*" - "REMOTE-PORT" - "REMOTE-PORT*" - "REMOVE-SESSION" - "REPLY" - "REPLY-EXTERNAL-FORMAT" - "REPLY-EXTERNAL-FORMAT*" - "REQUEST" - "REQUEST-ACCEPTOR" - "REQUEST-METHOD" - "REQUEST-METHOD*" - "REQUEST-URI" - "REQUEST-URI*" - "REQUIRE-AUTHORIZATION" - "RESET-CONNECTION-STREAM" - "RESET-SESSIONS" - "RESET-SESSION-SECRET" - "RETURN-CODE" - "RETURN-CODE*" - "RFC-1123-DATE" - "SCRIPT-NAME" - "SCRIPT-NAME*" - "SEND-HEADERS" - "SERVER-PROTOCOL" - "SERVER-PROTOCOL*" - "SESSION" - "SESSION-COOKIE-NAME" - "SESSION-COOKIE-VALUE" - "SESSION-CREATED" - "SESSION-DB" - "SESSION-DB-LOCK" - "SESSION-GC" - "SESSION-ID" - "SESSION-MAX-TIME" - "SESSION-REMOTE-ADDR" - "SESSION-START" - "SESSION-TOO-OLD-P" - "SESSION-USER-AGENT" - "SESSION-VALUE" - "SESSION-VERIFY" - "SET-COOKIE" - "SET-COOKIE*" - "SHUTDOWN" - "SINGLE-THREADED-TASKMASTER" - #-:hunchentoot-no-ssl "SSL-ACCEPTOR" - "SSL-P" - "START" - "START-LISTENING" - "START-SESSION" - "STOP" - "TASKMASTER" - "TASKMASTER-ACCEPTOR" - "URL-DECODE" - "URL-ENCODE" - "USER-AGENT" - "WITHIN-REQUEST-P")) + #:*CLEANUP-INTERVAL* + #:*CONTENT-TYPES-FOR-URL-REWRITE* + #:*DEFAULT-CONNECTION-TIMEOUT* + #:*DEFAULT-CONTENT-TYPE* + #:*DEFAULT-HANDLER* + #:*DISPATCH-TABLE* + #:*FILE-UPLOAD-HOOK* + #:*HANDLE-HTTP-ERRORS-P* + #:*HEADER-STREAM* + #:*HTTP-ERROR-HANDLER* + #:*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT* + #:*LISP-ERRORS-LOG-LEVEL* + #:*LISP-WARNINGS-LOG-LEVEL* + #:*LISTENER* + #:*LOG-LISP-BACKTRACES-P* + #:*LOG-LISP-ERRORS-P* + #:*LOG-LISP-WARNINGS-P* + #:*MESSAGE-LOG-PATHNAME* + #:*METHODS-FOR-POST-PARAMETERS* + #:*REPLY* + #:*REQUEST* + #:*REWRITE-FOR-SESSION-URLS* + #:*SESSION* + #:*SESSION-GC-FREQUENCY* + #:*SESSION-MAX-TIME* + #:*SESSION-REMOVAL-HOOK* + #:*SESSION-SECRET* + #:*SHOW-LISP-BACKTRACES-P* + #:*SHOW-LISP-ERRORS-P* + #:*TMP-DIRECTORY* + #:*USE-REMOTE-ADDR-FOR-SESSIONS* + #:*USE-USER-AGENT-FOR-SESSIONS* + #:+HTTP-ACCEPTED+ + #:+HTTP-AUTHORIZATION-REQUIRED+ + #:+HTTP-BAD-GATEWAY+ + #:+HTTP-BAD-REQUEST+ + #:+HTTP-CONFLICT+ + #:+HTTP-CONTINUE+ + #:+HTTP-CREATED+ + #:+HTTP-EXPECTATION-FAILED+ + #:+HTTP-FAILED-DEPENDENCY+ + #:+HTTP-FORBIDDEN+ + #:+HTTP-GATEWAY-TIME-OUT+ + #:+HTTP-GONE+ + #:+HTTP-INTERNAL-SERVER-ERROR+ + #:+HTTP-LENGTH-REQUIRED+ + #:+HTTP-METHOD-NOT-ALLOWED+ + #:+HTTP-MOVED-PERMANENTLY+ + #:+HTTP-MOVED-TEMPORARILY+ + #:+HTTP-MULTI-STATUS+ + #:+HTTP-MULTIPLE-CHOICES+ + #:+HTTP-NO-CONTENT+ + #:+HTTP-NON-AUTHORITATIVE-INFORMATION+ + #:+HTTP-NOT-ACCEPTABLE+ + #:+HTTP-NOT-FOUND+ + #:+HTTP-NOT-IMPLEMENTED+ + #:+HTTP-NOT-MODIFIED+ + #:+HTTP-OK+ + #:+HTTP-PARTIAL-CONTENT+ + #:+HTTP-PAYMENT-REQUIRED+ + #:+HTTP-PRECONDITION-FAILED+ + #:+HTTP-PROXY-AUTHENTICATION-REQUIRED+ + #:+HTTP-REQUEST-ENTITY-TOO-LARGE+ + #:+HTTP-REQUEST-TIME-OUT+ + #:+HTTP-REQUEST-URI-TOO-LARGE+ + #:+HTTP-REQUESTED-RANGE-NOT-SATISFIABLE+ + #:+HTTP-RESET-CONTENT+ + #:+HTTP-SEE-OTHER+ + #:+HTTP-SERVICE-UNAVAILABLE+ + #:+HTTP-SWITCHING-PROTOCOLS+ + #:+HTTP-TEMPORARY-REDIRECT+ + #:+HTTP-UNSUPPORTED-MEDIA-TYPE+ + #:+HTTP-USE-PROXY+ + #:+HTTP-VERSION-NOT-SUPPORTED+ + #:ABORT-REQUEST-HANDLER + #:ACCEPT-CONNECTIONS + #:ACCEPTOR + #:ACCEPTOR-ACCESS-LOG-PATHNAME + #:ACCEPTOR-ADDRESS + #:ACCEPTOR-DISPATCH-REQUEST + #:ACCEPTOR-INPUT-CHUNKING-P + #:ACCEPTOR-LOG-ACCESS + #:ACCEPTOR-LOG-MESSAGE + #:ACCEPTOR-MESSAGE-LOG-PATHNAME + #:ACCEPTOR-NAME + #:ACCEPTOR-OUTPUT-CHUNKING-P + #:ACCEPTOR-PERSISTENT-CONNECTIONS-P + #:ACCEPTOR-PORT + #:ACCEPTOR-READ-TIMEOUT + #:ACCEPTOR-REPLY-CLASS + #:ACCEPTOR-REQUEST-CLASS + #:ACCEPTOR-SSL-P + #-:hunchentoot-no-ssl #:ACCEPTOR-SSL-CERTIFICATE-FILE + #-:hunchentoot-no-ssl #:ACCEPTOR-SSL-PRIVATEKEY-FILE + #-:hunchentoot-no-ssl #:ACCEPTOR-SSL-PRIVATEKEY-PASSWORD + #:ACCEPTOR-WRITE-TIMEOUT + #:AUTHORIZATION + #:AUX-REQUEST-VALUE + #:CONTENT-LENGTH + #:CONTENT-LENGTH* + #:CONTENT-TYPE + #:CONTENT-TYPE* + #:COOKIE-DOMAIN + #:COOKIE-EXPIRES + #:COOKIE-HTTP-ONLY + #:COOKIE-IN + #:COOKIE-NAME + #:COOKIE-OUT + #:COOKIE-PATH + #:COOKIE-SECURE + #:COOKIE-VALUE + #:COOKIES-IN + #:COOKIES-IN* + #:COOKIES-OUT + #:COOKIES-OUT* + #:CREATE-FOLDER-DISPATCHER-AND-HANDLER + #:CREATE-PREFIX-DISPATCHER + #:CREATE-REGEX-DISPATCHER + #:CREATE-STATIC-FILE-DISPATCHER-AND-HANDLER + #:DEFAULT-DOCUMENT-DIRECTORY + #:DEFINE-EASY-HANDLER + #:DELETE-AUX-REQUEST-VALUE + #:DELETE-SESSION-VALUE + #:DISPATCH-EASY-HANDLERS + #:EASY-ACCEPTOR + #:ESCAPE-FOR-HTML + #:EXECUTE-ACCEPTOR + #:GET-PARAMETER + #:GET-PARAMETERS + #:GET-PARAMETERS* + #:HANDLE-INCOMING-CONNECTION + #:HANDLE-IF-MODIFIED-SINCE + #:HANDLE-REQUEST + #:HANDLE-STATIC-FILE + #:HEADER-IN + #:HEADER-IN* + #:HEADER-OUT + #:HEADERS-IN + #:HEADERS-IN* + #:HEADERS-OUT + #:HEADERS-OUT* + #:HOST + #:HTTP-TOKEN-P + #:HUNCHENTOOT-CONDITION + #:HUNCHENTOOT-ERROR + #:HUNCHENTOOT-WARNING + #:INITIALIZE-CONNECTION-STREAM + #:LOG-MESSAGE* + #:MAYBE-INVOKE-DEBUGGER + #:MIME-TYPE + #:NEXT-SESSION-ID + #:NO-CACHE + #:ONE-THREAD-PER-CONNECTION-TASKMASTER + #:PARAMETER + #:PARAMETER-ERROR + #:POST-PARAMETER + #:POST-PARAMETERS + #:POST-PARAMETERS* + #:PROCESS-CONNECTION + #:PROCESS-REQUEST + #:QUERY-STRING + #:QUERY-STRING* + #:RAW-POST-DATA + #:REAL-REMOTE-ADDR + #:REASON-PHRASE + #:RECOMPUTE-REQUEST-PARAMETERS + #:REDIRECT + #:REFERER + #:REMOTE-ADDR + #:REMOTE-ADDR* + #:REMOTE-PORT + #:REMOTE-PORT* + #:REMOVE-SESSION + #:REPLY + #:REPLY-EXTERNAL-FORMAT + #:REPLY-EXTERNAL-FORMAT* + #:REQUEST + #:REQUEST-ACCEPTOR + #:REQUEST-METHOD + #:REQUEST-METHOD* + #:REQUEST-URI + #:REQUEST-URI* + #:REQUIRE-AUTHORIZATION + #:RESET-CONNECTION-STREAM + #:RESET-SESSIONS + #:RESET-SESSION-SECRET + #:RETURN-CODE + #:RETURN-CODE* + #:RFC-1123-DATE + #:SCRIPT-NAME + #:SCRIPT-NAME* + #:SEND-HEADERS + #:SERVER-PROTOCOL + #:SERVER-PROTOCOL* + #:SESSION + #:SESSION-COOKIE-NAME + #:SESSION-COOKIE-VALUE + #:SESSION-CREATED + #:SESSION-DB + #:SESSION-DB-LOCK + #:SESSION-GC + #:SESSION-ID + #:SESSION-MAX-TIME + #:SESSION-REMOTE-ADDR + #:SESSION-START + #:SESSION-TOO-OLD-P + #:SESSION-USER-AGENT + #:SESSION-VALUE + #:SESSION-VERIFY + #:SET-COOKIE + #:SET-COOKIE* + #:SHUTDOWN + #:SINGLE-THREADED-TASKMASTER + #-:hunchentoot-no-ssl #:SSL-ACCEPTOR + #:SSL-P + #:START + #:START-LISTENING + #:START-SESSION + #:STOP + #:TASKMASTER + #:TASKMASTER-ACCEPTOR + #:URL-DECODE + #:URL-ENCODE + #:USER-AGENT + #:WITHIN-REQUEST-P)) +(defpackage :simple-hunchentoot + (:use #:cl) + (:export #:start-server + #:stop-server)) \ No newline at end of file From bknr at bknr.net Tue Feb 15 16:59:44 2011 From: bknr at bknr.net (BKNR Commits) Date: Tue, 15 Feb 2011 17:59:44 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/packages.lisp Message-ID: Revision: 4652 Author: hans URL: http://bknr.net/trac/changeset/4652 Remove bogus export, thanks to Gordon Sims for reporting. U trunk/thirdparty/hunchentoot/packages.lisp Modified: trunk/thirdparty/hunchentoot/packages.lisp =================================================================== --- trunk/thirdparty/hunchentoot/packages.lisp 2011-02-15 16:58:53 UTC (rev 4651) +++ trunk/thirdparty/hunchentoot/packages.lisp 2011-02-15 16:59:44 UTC (rev 4652) @@ -58,7 +58,6 @@ #:*HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT* #:*LISP-ERRORS-LOG-LEVEL* #:*LISP-WARNINGS-LOG-LEVEL* - #:*LISTENER* #:*LOG-LISP-BACKTRACES-P* #:*LOG-LISP-ERRORS-P* #:*LOG-LISP-WARNINGS-P* From bknr at bknr.net Tue Feb 15 21:45:08 2011 From: bknr at bknr.net (BKNR Commits) Date: Tue, 15 Feb 2011 22:45:08 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/doc/index.xml Message-ID: Revision: 4653 Author: hans URL: http://bknr.net/trac/changeset/4653 Mention RESTAS web framework in documentation U trunk/thirdparty/hunchentoot/doc/index.xml Modified: trunk/thirdparty/hunchentoot/doc/index.xml =================================================================== --- trunk/thirdparty/hunchentoot/doc/index.xml 2011-02-15 16:59:44 UTC (rev 4652) +++ trunk/thirdparty/hunchentoot/doc/index.xml 2011-02-15 21:45:07 UTC (rev 4653) @@ -339,6 +339,10 @@ CL-WEBDAV is a WebDAV server based on Hunchentoot. +
  • + RESTAS is a web + framework based on Hunchentoot. +
  • From bknr at bknr.net Tue Feb 15 21:45:25 2011 From: bknr at bknr.net (BKNR Commits) Date: Tue, 15 Feb 2011 22:45:25 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/packages.lisp Message-ID: Revision: 4654 Author: hans URL: http://bknr.net/trac/changeset/4654 Export ACCEPTOR-STATUS-MESSAGE U trunk/thirdparty/hunchentoot/packages.lisp Modified: trunk/thirdparty/hunchentoot/packages.lisp =================================================================== --- trunk/thirdparty/hunchentoot/packages.lisp 2011-02-15 21:45:07 UTC (rev 4653) +++ trunk/thirdparty/hunchentoot/packages.lisp 2011-02-15 21:45:25 UTC (rev 4654) @@ -139,6 +139,7 @@ #-:hunchentoot-no-ssl #:ACCEPTOR-SSL-CERTIFICATE-FILE #-:hunchentoot-no-ssl #:ACCEPTOR-SSL-PRIVATEKEY-FILE #-:hunchentoot-no-ssl #:ACCEPTOR-SSL-PRIVATEKEY-PASSWORD + #:ACCEPTOR-STATUS-MESSAGE #:ACCEPTOR-WRITE-TIMEOUT #:AUTHORIZATION #:AUX-REQUEST-VALUE From bknr at bknr.net Wed Feb 16 11:47:44 2011 From: bknr at bknr.net (BKNR Commits) Date: Wed, 16 Feb 2011 12:47:44 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/ Message-ID: Revision: 4655 Author: hans URL: http://bknr.net/trac/changeset/4655 Automatically set the charset= attribute in the Content-Type: header when a string has been returned by the handler. With this change, it is sufficient to change *HUNCHENTOOT-DEFAULT-EXTERNAL-FORMAT* to the desired default charset used for responses. U trunk/thirdparty/hunchentoot/headers.lisp U trunk/thirdparty/hunchentoot/specials.lisp Modified: trunk/thirdparty/hunchentoot/headers.lisp =================================================================== --- trunk/thirdparty/hunchentoot/headers.lisp 2011-02-15 21:45:25 UTC (rev 4654) +++ trunk/thirdparty/hunchentoot/headers.lisp 2011-02-16 11:47:44 UTC (rev 4655) @@ -53,6 +53,16 @@ (:method (key value stream) (write-header-line key (princ-to-string value) stream))) +(defun maybe-add-charset-to-content-type-header (content-type external-format) + "Given the contents of a CONTENT-TYPE header, add a charset= + attribute describing the given EXTERNAL-FORMAT if no charset= + attribute is already present and the content type is a text content + type. Returns the augmented content type." + (if (and (cl-ppcre:scan "(?i)^text" content-type) + (not (cl-ppcre:scan "(?i);\\s*charset=" content-type))) + (format nil "~A; charset=~(~A~)" content-type (flex:external-format-name external-format)) + content-type)) + (defun start-output (return-code &optional (content nil content-provided-p)) "Sends all headers and maybe the content body to *HUNCHENTOOT-STREAM*. Returns immediately and does nothing if called @@ -115,7 +125,9 @@ (setq content (maybe-rewrite-urls-for-session content))) (when (stringp content) ;; if the content is a string, convert it to the proper external format - (setf content (string-to-octets content :external-format (reply-external-format*)))) + (setf content (string-to-octets content :external-format (reply-external-format*)) + (content-type*) (maybe-add-charset-to-content-type-header (content-type*) + (reply-external-format*)))) (when content ;; whenever we know what we're going to send out as content, set ;; the Content-Length header properly; maybe the user specified Modified: trunk/thirdparty/hunchentoot/specials.lisp =================================================================== --- trunk/thirdparty/hunchentoot/specials.lisp 2011-02-15 21:45:25 UTC (rev 4654) +++ trunk/thirdparty/hunchentoot/specials.lisp 2011-02-16 11:47:44 UTC (rev 4655) @@ -114,11 +114,11 @@ "The three-character names of the twelve months - needed for cookie date format.") -(defvar *rewrite-for-session-urls* t +(defparameter *rewrite-for-session-urls* t "Whether HTML pages should possibly be rewritten for cookie-less session-management.") -(defvar *content-types-for-url-rewrite* +(defparameter *content-types-for-url-rewrite* '("text/html" "application/xhtml+xml") "The content types for which url-rewriting is OK. See *REWRITE-FOR-SESSION-URLS*.") @@ -154,20 +154,20 @@ (defvar *session-db* nil "The default \(global) session database.") -(defvar *session-max-time* #.(* 30 60) +(defparameter *session-max-time* #.(* 30 60) "The default time \(in seconds) after which a session times out.") -(defvar *session-gc-frequency* 50 +(defparameter *session-gc-frequency* 50 "A session GC \(see function SESSION-GC) will happen every *SESSION-GC-FREQUENCY* requests \(counting only requests which create a new session) if this variable is not NIL. See SESSION-CREATED.") -(defvar *use-user-agent-for-sessions* t +(defparameter *use-user-agent-for-sessions* t "Whether the 'User-Agent' header should be encoded into the session string. If this value is true, a session will cease to be accessible if the client sends a different 'User-Agent' header.") -(defvar *use-remote-addr-for-sessions* nil +(defparameter *use-remote-addr-for-sessions* nil "Whether the client's remote IP \(as returned by REAL-REMOTE-ADDR) should be encoded into the session string. If this value is true, a session will cease to be accessible if the client's remote IP changes. @@ -175,39 +175,42 @@ This might for example be an issue if the client uses a proxy server which doesn't send correct 'X_FORWARDED_FOR' headers.") -(defvar *default-content-type* "text/html; charset=iso-8859-1" - "The default content-type header which is returned to the client.") +(defparameter *default-content-type* "text/html" + "The default content-type header which is returned to the client. +If this is text content type, the character set used for encoding the +response will automatically be added to the content type in a +``charset'' attribute.") -(defvar *methods-for-post-parameters* '(:post) +(defparameter *methods-for-post-parameters* '(:post) "A list of the request method types \(as keywords) for which Hunchentoot will try to compute POST-PARAMETERS.") -(defvar *header-stream* nil +(defparameter *header-stream* nil "If this variable is not NIL, it should be bound to a stream to which incoming and outgoing headers will be written for debugging purposes.") -(defvar *show-lisp-errors-p* nil +(defparameter *show-lisp-errors-p* nil "Whether Lisp errors in request handlers should be shown in HTML output.") -(defvar *show-lisp-backtraces-p* t +(defparameter *show-lisp-backtraces-p* t "Whether Lisp errors shown in HTML output should contain backtrace information.") -(defvar *log-lisp-errors-p* t +(defparameter *log-lisp-errors-p* t "Whether Lisp errors in request handlers should be logged.") -(defvar *log-lisp-backtraces-p* t +(defparameter *log-lisp-backtraces-p* t "Whether Lisp backtraces should be logged. Only has an effect if *LOG-LISP-ERRORS-P* is true as well.") -(defvar *log-lisp-warnings-p* t +(defparameter *log-lisp-warnings-p* t "Whether Lisp warnings in request handlers should be logged.") -(defvar *lisp-errors-log-level* :error +(defparameter *lisp-errors-log-level* :error "Log level for Lisp errors. Should be one of :ERROR \(the default), :WARNING, or :INFO.") -(defvar *lisp-warnings-log-level* :warning +(defparameter *lisp-warnings-log-level* :warning "Log level for Lisp warnings. Should be one of :ERROR, :WARNING \(the default), or :INFO.") @@ -219,7 +222,7 @@ "A global lock to prevent concurrent access to the log file used by the ACCEPTOR-LOG-ACCESS function.") -(defvar *catch-errors-p* t +(defparameter *catch-errors-p* t "Whether Hunchentoot should catch and log errors \(or rather invoke the debugger).") @@ -243,7 +246,7 @@ #+:openmcl "http://openmcl.clozure.com/" "A link to the website of the underlying Lisp implementation.") -(defvar *tmp-directory* +(defparameter *tmp-directory* #+(or :win32 :mswindows) "c:\\hunchentoot-temp\\" #-(or :win32 :mswindows) "/tmp/hunchentoot/" "Directory for temporary files created by MAKE-TMP-FILE-NAME.") @@ -261,13 +264,13 @@ "A FLEXI-STREAMS external format used internally for logging and to encode cookie values.") -(defvar *hunchentoot-default-external-format* +latin-1+ +(defparameter *hunchentoot-default-external-format* +utf-8+ "The external format used to compute the REQUEST object.") (defconstant +buffer-length+ 8192 "Length of buffers used for internal purposes.") -(defvar *default-connection-timeout* 20 +(defparameter *default-connection-timeout* 20 "The default connection timeout used when an acceptor is reading from and writing to a socket stream.") @@ -292,7 +295,7 @@ ;; see ;; and -(defvar *hyperdoc-base-uri* "http://weitz.de/hunchentoot/") +(defparameter *hyperdoc-base-uri* "http://weitz.de/hunchentoot/") (let ((exported-symbols-alist (loop for symbol being the external-symbols of :hunchentoot From bknr at bknr.net Wed Feb 16 12:11:26 2011 From: bknr at bknr.net (BKNR Commits) Date: Wed, 16 Feb 2011 13:11:26 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/packages.lisp Message-ID: Revision: 4656 Author: hans URL: http://bknr.net/trac/changeset/4656 export acceptor-error-template-directory U trunk/thirdparty/hunchentoot/packages.lisp Modified: trunk/thirdparty/hunchentoot/packages.lisp =================================================================== --- trunk/thirdparty/hunchentoot/packages.lisp 2011-02-16 11:47:44 UTC (rev 4655) +++ trunk/thirdparty/hunchentoot/packages.lisp 2011-02-16 12:11:26 UTC (rev 4656) @@ -124,6 +124,7 @@ #:ACCEPTOR-ACCESS-LOG-PATHNAME #:ACCEPTOR-ADDRESS #:ACCEPTOR-DISPATCH-REQUEST + #:ACCEPTOR-ERROR-TEMPLATE-DIRECTORY #:ACCEPTOR-INPUT-CHUNKING-P #:ACCEPTOR-LOG-ACCESS #:ACCEPTOR-LOG-MESSAGE From bknr at bknr.net Wed Feb 16 12:24:35 2011 From: bknr at bknr.net (BKNR Commits) Date: Wed, 16 Feb 2011 13:24:35 +0100 Subject: [bknr-cvs] hans changed trunk/thirdparty/hunchentoot/acceptor.lisp Message-ID: Revision: 4657 Author: hans URL: http://bknr.net/trac/changeset/4657 set content-type to text/html when sending error page from file U trunk/thirdparty/hunchentoot/acceptor.lisp Modified: trunk/thirdparty/hunchentoot/acceptor.lisp =================================================================== --- trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-16 12:11:26 UTC (rev 4656) +++ trunk/thirdparty/hunchentoot/acceptor.lisp 2011-02-16 12:24:35 UTC (rev 4657) @@ -642,6 +642,7 @@ (when error-file-template-pathname (with-open-file (file error-file-template-pathname :if-does-not-exist nil :element-type 'character) (when file + (setf (content-type*) "text/html") (substitute-request-context-variables (file-contents file)))))))) (or (unless (< 300 http-status-code) (call-next-method)) ; don't ever try template for positive return codes