Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) direct access to requestheader of htCache.Entry removed to make it more http independent

theliffbf416e76d3
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java
index c318aced4..d6315ed1a 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/httpdProxyHandler.java
@@ -630,7 +630,7 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
String storeError = cacheEntry.shallStoreCacheForProxy();
boolean storeHTCache = cacheEntry.profile().storeHTCache();
- boolean isSupportedContent = plasmaParser.supportedContent(plasmaParser.PARSER_MODE_PROXY,cacheEntry.url(),cacheEntry.responseHeader().mime());
+ boolean isSupportedContent = plasmaParser.supportedContent(plasmaParser.PARSER_MODE_PROXY,cacheEntry.url(),cacheEntry.getMimeType());
if (
/*
* Now we store the response into the htcache directory if
diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java
index a1f79c61a..c0b40bca4 100644
--- a/source/de/anomic/plasma/plasmaHTCache.java
+++ b/source/de/anomic/plasma/plasmaHTCache.java
@@ -842,14 +842,33 @@ public final class plasmaHTCache {
return this.cacheArray;
}
- public httpHeader requestHeader() {
- return this.requestHeader;
- }
+// public httpHeader requestHeader() {
+// return this.requestHeader;
+// }
public httpHeader responseHeader() {
return this.responseHeader;
}
+ public String getMimeType() {
+ return (this.responseHeader == null) ? null : this.responseHeader.mime();
+ }
+
+ public Date ifModifiedSince() {
+ return (this.requestHeader == null) ? null : this.requestHeader.ifModifiedSince();
+ }
+
+ public boolean requestWithCookie() {
+ return (this.requestHeader == null) ? false : this.requestHeader.containsKey(httpHeader.COOKIE);
+ }
+
+ public boolean requestProhibitsIndexing() {
+ return (this.requestHeader == null)
+ ? false
+ : this.requestHeader.containsKey(httpHeader.X_YACY_INDEX_CONTROL) &&
+ ((String)this.requestHeader.get(httpHeader.X_YACY_INDEX_CONTROL)).toUpperCase().equals("NO-INDEX");
+ }
+
/*
public boolean update() {
return ((status == CACHE_FILL) || (status == CACHE_STALE_RELOAD_GOOD));
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 29ebb5b4f..555b04e0a 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -813,8 +813,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
*
* Testing if the content type is supported by the available parsers
* ========================================================================= */
- boolean isSupportedContent = (entry.responseHeader() != null) &&
- plasmaParser.supportedContent(entry.url(),entry.responseHeader().mime());
+ boolean isSupportedContent = plasmaParser.supportedContent(entry.url(),entry.getMimeType());
/* =========================================================================
* INDEX CONTROL HEADER
@@ -823,13 +822,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
* yacy to index the response returned as answer to a request
* ========================================================================= */
boolean doIndexing = true;
- if (entry.requestHeader() != null) {
- if (
- (entry.requestHeader().containsKey(httpHeader.X_YACY_INDEX_CONTROL)) &&
- (((String) entry.requestHeader().get(httpHeader.X_YACY_INDEX_CONTROL)).toUpperCase().equals("NO-INDEX"))
- ) {
+ if (entry.requestProhibitsIndexing()) {
doIndexing = false;
- }
}
/* =========================================================================
@@ -896,8 +890,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
enQueue(this.sbQueue.newEntry(
entry.url(),
indexURL.urlHash(entry.referrerURL()),
- entry.requestHeader().ifModifiedSince(),
- entry.requestHeader().containsKey(httpHeader.COOKIE),
+ entry.ifModifiedSince(),
+ entry.requestWithCookie(),
entry.initiator(),
entry.depth(),
entry.profile().handle(),