From 2b916bc2df0da575bdd70b6bda69d5c99296fc0d Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 14 Apr 2005 16:27:37 +0000 Subject: [PATCH] Only set response to 304 not modified if no cookies were set. Apache will not set cookies in a 304 response. --- src/helma/framework/ResponseTrans.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/helma/framework/ResponseTrans.java b/src/helma/framework/ResponseTrans.java index fcca786e..2dacaac9 100644 --- a/src/helma/framework/ResponseTrans.java +++ b/src/helma/framework/ResponseTrans.java @@ -520,8 +520,8 @@ public final class ResponseTrans implements Serializable { } } - // if etag is not set, calc MD5 digest and check it - if ((etag == null) && (lastModified == -1) && (redir == null)) { + // if etag is not set, calc MD5 digest and check it, but only if not a redirect + if (etag == null && lastModified == -1 && redir == null) { try { digest = MessageDigest.getInstance("MD5"); @@ -531,7 +531,8 @@ public final class ResponseTrans implements Serializable { etag = "\"" + new String(Base64.encode(b)) + "\""; - if ((reqtrans != null) && reqtrans.hasETag(etag)) { + // only set response to 304 not modified if no cookies were set + if (reqtrans != null && reqtrans.hasETag(etag) && countCookies() == 0) { response = new byte[0]; notModified = true; }