Dolda2000 GitWeb
/
jsvc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a7c50bd
)
Fixed faulty cache response.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 13 Oct 2009 19:10:02 +0000
(21:10 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 13 Oct 2009 19:10:02 +0000
(21:10 +0200)
src/dolda/jsvc/util/Cache.java
patch
|
blob
|
blame
|
history
diff --git
a/src/dolda/jsvc/util/Cache.java
b/src/dolda/jsvc/util/Cache.java
index
6fd7d7a
..
0021336
100644
(file)
--- 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. */
/* 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;
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) {
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));
}
}
req.outheaders().put("Last-Modified", Http.fmtdate(mdate));