From 468ea3a95aa82824559da26f623b2f201983388b Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 11 Oct 2009 11:34:44 +0200 Subject: Introduce a *MODE* variable that distinguishes between static and dynamic mode. Ignore-this: fada9480007419d11bed4ab86bb06c48 darcs-hash:dd4ba6d22a835ec8db31a88de184186429733563 --- globals.lisp | 4 ++++ journal.lisp | 30 +++++++++++++++++------------- utils.lisp | 3 ++- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/globals.lisp b/globals.lisp index e832646..67d78b7 100644 --- a/globals.lisp +++ b/globals.lisp @@ -81,3 +81,7 @@ (defparameter *if-modified-since* nil) (defparameter *wsse* nil) (defparameter *wsse-key* nil) + +(defparameter *mode* :http ;either :HTTP or :FILE + "Whether we are serving stuff dynamically over HTTP or storing it into + files for later static service.") diff --git a/journal.lisp b/journal.lisp index b84e1a7..317f87a 100755 --- a/journal.lisp +++ b/journal.lisp @@ -55,9 +55,10 @@ (defun show-comment-feed () #.(locally-enable-sql-reader-syntax) (revalidate-cache-or-die "application/atom+xml; charset=UTF-8") - (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) - (http-add-header "Content-Language" "de") - (http-send-headers "application/atom+xml; charset=UTF-8") + (when (eq *mode* :http) + (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) + (http-add-header "Content-Language" "de") + (http-send-headers "application/atom+xml; charset=UTF-8")) (flet ((atom-time (time) (format-date nil @@ -128,9 +129,10 @@ (defun show-atom-entry () #.(locally-enable-sql-reader-syntax) (revalidate-cache-or-die "application/atom+xml; charset=UTF-8") - (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) - (http-add-header "Content-Language" "de") - (http-send-headers "application/atom+xml; charset=UTF-8") + (when (eq *mode* :http) + (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) + (http-add-header "Content-Language" "de") + (http-send-headers "application/atom+xml; charset=UTF-8")) (with-xml-output (*standard-output* :encoding "utf-8") (show-atom-entry-xml (find-entry *post-number*) :full-content t :include-edit-links t))) @@ -184,9 +186,10 @@ (defun show-atom-feed (&key include-edit-links full-content) #.(locally-enable-sql-reader-syntax) (revalidate-cache-or-die "application/atom+xml; charset=UTF-8") - (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) - (http-add-header "Content-Language" "de") - (http-send-headers "application/atom+xml; charset=UTF-8") + (when (eq *mode* :http) + (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) + (http-add-header "Content-Language" "de") + (http-send-headers "application/atom+xml; charset=UTF-8")) (flet ((atom-time (time) (format-date nil @@ -413,10 +416,11 @@ ;; termination, which makes generating a Last-Modified header ;; feel slower to the end user rather than faster. ;; - (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) - (http-add-header "Content-Language" "de") - (http-add-header "Cache-Control" "public") - (http-send-headers "text/html; charset=UTF-8") + (when (eq *mode* :http) + (http-add-header "Last-Modified" (http-timestamp (compute-journal-last-modified-date))) + (http-add-header "Content-Language" "de") + (http-add-header "Cache-Control" "public") + (http-send-headers "text/html; charset=UTF-8")) (