Skip to content

Commit

Permalink
fixed Clack.Handler.Hunchentoot to output headers even when body is p…
Browse files Browse the repository at this point in the history
…athname.
  • Loading branch information
fukamachi committed Mar 16, 2012
1 parent f972b4b commit d32e203
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/core/handler/hunchentoot.lisp
Expand Up @@ -58,21 +58,21 @@ If no acceptor given, try to stop `*acceptor*' by default."
"Convert Response from Clack application into a string
before pass to Hunchentoot."
(destructuring-bind (status headers body) res
(setf (return-code*) status)
(loop for (k v) on headers by #'cddr
with hash = (make-hash-table :test #'eq)
if (gethash k hash)
do (setf (gethash k hash)
(format nil "~:[~;~:*~A, ~]~A" (gethash k hash) v))
else do (setf (gethash k hash) v)
finally
(loop for k being the hash-keys in hash
using (hash-value v)
do (setf (header-out k) v)))
(etypecase body
(pathname
(hunchentoot:handle-static-file body (getf headers :content-type)))
(list
(setf (return-code*) status)
(loop for (k v) on headers by #'cddr
with hash = (make-hash-table :test #'eq)
if (gethash k hash)
do (setf (gethash k hash)
(format nil "~:[~;~:*~A, ~]~A" (gethash k hash) v))
else do (setf (gethash k hash) v)
finally
(loop for k being the hash-keys in hash
using (hash-value v)
do (setf (header-out k) v)))
(with-output-to-string (s)
(format s "~{~A~^~%~}" body))))))

Expand Down

0 comments on commit d32e203

Please sign in to comment.