From f9522a230784fbea7d9e9daaa835dfd81e145c60 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Tue, 15 Mar 2011 21:33:08 +0100 Subject: Fix feed content type. --- mulkcms.lisp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mulkcms.lisp b/mulkcms.lisp index b6d5e61..9662b06 100644 --- a/mulkcms.lisp +++ b/mulkcms.lisp @@ -78,7 +78,7 @@ nil) -(defun call-with-cache (path last-update thunk) +(defun call-with-cache (path last-update content-type thunk) (let* ((chars (requested-characteristics)) (charstring (prin1-to-string chars)) (charbytes (flexi-streams:string-to-octets @@ -97,6 +97,8 @@ charhashnum path :row))) + (when content-type + (setf (hunchentoot:content-type*) content-type)) (if (and cached-data (simple-date:time< last-update (second cached-data))) (first cached-data) (let ((generated-content (funcall thunk))) @@ -109,8 +111,9 @@ generated-content)))) -(defmacro with-cache ((path last-update) &body body) - `(call-with-cache ,path ,last-update (lambda () ,@body))) +(defmacro with-cache ((path last-update &optional content-type) &body body) + `(call-with-cache ,path ,last-update ,content-type + (lambda () ,@body))) (defun find-canonical-article-alias (article) @@ -435,7 +438,13 @@ :test #'string=) (lambda () (with-db - (with-cache (path (query "SELECT max(date) FROM article_revisions" :single)) + (with-cache (path + (query "SELECT max(date) FROM article_revisions" :single) + (if (member path '("feed" "feed/" + "journal/feed" "journal/feed") + :test #'string=) + "application/atom+xml; charset=utf-8" + "text/html; charset=utf-8")) (let* (#+portable-mulkcms (articles (find-journal-articles)) #+portable-mulkcms -- cgit v1.2.3