From 7d8af6b41aec84a032286ff750aaff53418847d2 Mon Sep 17 00:00:00 2001 From: theli Date: Fri, 19 Aug 2005 08:23:12 +0000 Subject: [PATCH] *) Bugfix for heise newsletter Problem See: http://www.yacy-forum.de/viewtopic.php?p=7836#7836 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@559 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpc.java | 2 +- source/de/anomic/http/httpdProxyHandler.java | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.java index 20f4d474d..2220ac9e4 100644 --- a/source/de/anomic/http/httpc.java +++ b/source/de/anomic/http/httpc.java @@ -421,7 +421,7 @@ public final class httpc { // creating a socket address InetSocketAddress address = new InetSocketAddress(hostip, port); - // trying to establis a connection to the address + // trying to establish a connection to the address this.socket.connect(address,timeout); // registering the socket diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java index 11afbc479..52200956d 100644 --- a/source/de/anomic/http/httpdProxyHandler.java +++ b/source/de/anomic/http/httpdProxyHandler.java @@ -459,7 +459,6 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt if (httpVer.equals("HTTP/0.9") || httpVer.equals("HTTP/1.0")) { conProp.setProperty(httpd.CONNECTION_PROP_PERSISTENT,"close"); } else { - res.responseHeader.put(httpHeader.TRANSFER_ENCODING, "chunked"); chunkedOut = new httpChunkedOutputStream(respond); } res.responseHeader.remove(httpHeader.CONTENT_LENGTH); @@ -518,13 +517,17 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt String[] resStatus = res.status.split(" "); // sending the respond header back to the client + if (chunkedOut != null) { + res.responseHeader.put(httpHeader.TRANSFER_ENCODING, "chunked"); + } + httpd.sendRespondHeader( conProp, respond, httpVer, Integer.parseInt((resStatus.length > 0) ? resStatus[0]:"503"), (resStatus.length > 1) ? resStatus[1] : null, - res.responseHeader); + res.responseHeader); String storeError; if ((storeError = cacheEntry.shallStoreCacheForProxy()) == null) { @@ -678,6 +681,9 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt // we respond on the request by using the cache, the cache is fresh try { + // remove hop by hop headers + this.removeHopByHopHeaders(cachedResponseHeader); + // replace date field in old header by actual date, this is according to RFC cachedResponseHeader.put(httpHeader.DATE, httpc.dateString(httpc.nowDate())); @@ -770,7 +776,14 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt // special headers inserted by squid headers.remove(httpHeader.X_CACHE); - headers.remove(httpHeader.X_CACHE_LOOKUP); + headers.remove(httpHeader.X_CACHE_LOOKUP); + + // remove transfer encoding header + headers.remove(httpHeader.TRANSFER_ENCODING); + + //removing yacy status headers + headers.remove(httpHeader.X_YACY_KEEP_ALIVE_REQUEST_COUNT); + headers.remove(httpHeader.X_YACY_ORIGINAL_REQUEST_LINE); } private void forceConnectionClose() {