Revision: 4670 Author: hans URL: http://bknr.net/trac/changeset/4670
Set content-type and last-modified headers of served static files before handling if-modified-since, thanks to Wukix Inc. for reporting.
U trunk/thirdparty/hunchentoot/misc.lisp
Modified: trunk/thirdparty/hunchentoot/misc.lisp =================================================================== --- trunk/thirdparty/hunchentoot/misc.lisp 2011-08-16 07:47:58 UTC (rev 4669) +++ trunk/thirdparty/hunchentoot/misc.lisp 2011-08-29 05:42:50 UTC (rev 4670) @@ -159,16 +159,16 @@ (let ((time (or (file-write-date pathname) (get-universal-time))) bytes-to-send) + (setf (content-type*) (or content-type + (mime-type pathname) + "application/octet-stream") + (header-out :last-modified) (rfc-1123-date time)) (handle-if-modified-since time) (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) + (setf (header-out :content-range) (format nil "bytes 0-~D/*" (1- (file-length file))) bytes-to-send (maybe-handle-range-header file) (content-length*) bytes-to-send) (let ((out (send-headers))