*) bugfix for handling of ResourceInfo object in proxy

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2512 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent ff4362b02d
commit a5ed86105b

@ -415,9 +415,17 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
// decide wether to use a cache entry or connect to the network
File cacheFile = cacheManager.getCachePath(url);
httpHeader cachedResponseHeader = null;
ResourceInfo cachedResInfo = (ResourceInfo) cacheManager.loadResourceInfo(url);
httpHeader cachedResponseHeader = (cachedResInfo == null)?null:cachedResInfo.getResponseHeader();
boolean cacheExists = ((cacheFile.isFile()) && (cachedResponseHeader != null));
if (cachedResInfo != null) {
// set the new request header (needed by function shallUseCacheForProxy)
cachedResInfo.setRequestHeader(requestHeader);
// get the cached response header
cachedResponseHeader = cachedResInfo.getResponseHeader();
}
boolean cacheExists = cacheFile.isFile() && (cachedResponseHeader != null);
// why are files unzipped upon arrival? why not zip all files in cache?
// This follows from the following premises
@ -457,12 +465,10 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
if (yacyCore.getOnlineMode() == 0) {
if (cacheExists) {
fulfillRequestFromCache(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond);
}
else {
} else {
httpd.sendRespondError(conProp,respond,4,404,null,"URL not availabe in Cache",null);
}
}
else if (cacheExists && cacheEntry.shallUseCacheForProxy()) {
} else if (cacheExists && cacheEntry.shallUseCacheForProxy()) {
fulfillRequestFromCache(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond);
} else {
fulfillRequestFromWeb(conProp,url,ext,requestHeader,cachedResponseHeader,cacheFile,respond);

@ -149,6 +149,10 @@ public class ResourceInfo implements IResourceInfo {
return this.urlHash;
}
public void setRequestHeader(httpHeader reqestHeader) {
this.requestHeader = reqestHeader;
}
/**
* @see de.anomic.plasma.cache.IResourceInfo#shallIndexCacheForCrawler()
*/

Loading…
Cancel
Save