X-Git-Url: http://dolda2000.com/gitweb/?p=jsvc.git;a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Futil%2FCache.java;h=00213365331e7f2809ba85e1ea351fe70f0a9c55;hp=6fd7d7a8d6e58edce06b4f53c54689f7ed796244;hb=ffbaba013fa57247890912e54e4e1e085482720d;hpb=a7c50bd905f146c3a28c991e72f43bc9079f3ed8 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));