Skip to content

Commit

Permalink
no caching in browser of dynamic web pages sent by YaCy http
Browse files Browse the repository at this point in the history
this may prevent unnecessary IO caused by cache storage of the browser

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7207 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Sep 29, 2010
1 parent 41a93ff commit c60aed4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion source/de/anomic/http/server/HTTPDFileHandler.java
Expand Up @@ -274,6 +274,9 @@ public static void doResponse(final Properties conProp, final RequestHeader requ
if (authorization != null && authorization.length() == 0) authorization = null;
final String adminAccountBase64MD5 = switchboard.getConfig(HTTPDemon.ADMIN_ACCOUNT_B64MD5, "");

// cache settings
boolean nocache = path.contains("?") || body != null;

// a bad patch to map the /xml/ path to /api/
if (path.startsWith("/xml/")) {
path = "/api/" + path.substring(5);
Expand Down Expand Up @@ -388,6 +391,8 @@ public static void doResponse(final Properties conProp, final RequestHeader requ
}
}
}

if (args != null) nocache = true;

// we are finished with parsing
// the result of value hand-over is in args and argc
Expand Down Expand Up @@ -504,7 +509,6 @@ public static void doResponse(final Properties conProp, final RequestHeader requ
//We need tp here
servletProperties templatePatterns = null;
Date targetDate;
boolean nocache = false;

if ((targetClass != null) && (path.endsWith("png"))) {
// call an image-servlet to produce an on-the-fly - generated image
Expand Down
5 changes: 3 additions & 2 deletions source/de/anomic/http/server/HTTPDemon.java
Expand Up @@ -1188,8 +1188,9 @@ public static final void sendRespondHeader(
headers.put(HeaderFramework.LAST_MODIFIED, HeaderFramework.formatRFC1123(moddate));

if (nocache) {
if (httpVersion.toUpperCase().equals(HeaderFramework.HTTP_VERSION_1_1)) headers.put(HeaderFramework.CACHE_CONTROL, "no-cache");
else headers.put(HeaderFramework.PRAGMA, "no-cache");
headers.put(HeaderFramework.CACHE_CONTROL, "no-cache");
headers.put(HeaderFramework.CACHE_CONTROL, "no-store");
headers.put(HeaderFramework.PRAGMA, "no-cache");
}

if (contentType == null) contentType = "text/html; charset=UTF-8";
Expand Down

0 comments on commit c60aed4

Please sign in to comment.