From ffbaba013fa57247890912e54e4e1e085482720d Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Tue, 13 Oct 2009 21:10:02 +0200 Subject: [PATCH] Fixed faulty cache response. --- src/dolda/jsvc/util/Cache.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dolda/jsvc/util/Cache.java b/src/dolda/jsvc/util/Cache.java index 6fd7d7a..0021336 100644 --- a/src/dolda/jsvc/util/Cache.java +++ b/src/dolda/jsvc/util/Cache.java @@ -8,7 +8,7 @@ public class Cache { /* Since the HTTP time format is (reasonably enough) precise * only to seconds, any extra milliseconds must be trimmed * off, or the mtime will almost certainly not match. */ - Date mdate = new Date((mtime / 1000) * 1000); + final Date mdate = new Date((mtime / 1000) * 1000); String ims = req.inheaders().get("If-Modified-Since"); if(ims != null) { Date cldate; @@ -18,9 +18,13 @@ public class Cache { throw(Restarts.stdresponse(400, "The If-Modified-Since header is not parseable.")); } if(mdate.compareTo(cldate) <= 0) { - req.status(304); - req.outheaders().put("Content-Length", "0"); - throw(Restarts.done()); + throw(new RequestRestart() { + public void respond(Request req) { + req.status(304); + req.outheaders().put("Content-Length", "0"); + req.outheaders().put("Last-Modified", Http.fmtdate(mdate)); + } + }); } } req.outheaders().put("Last-Modified", Http.fmtdate(mdate)); -- 2.11.0