diff --git a/source/net/yacy/http/ProxyHandler.java b/source/net/yacy/http/ProxyHandler.java index b55754b92..871bcf162 100644 --- a/source/net/yacy/http/ProxyHandler.java +++ b/source/net/yacy/http/ProxyHandler.java @@ -219,19 +219,22 @@ public class ProxyHandler extends AbstractRemoteHandler implements Handler { } else { // no caching /*if (log.isFine()) log.logFine(reqID +" "+ url.toString() + " not cached." + - " StoreError=" + ((storeError==null)?"None":storeError) + - " StoreHTCache=" + storeHTCache + - " SupportError=" + supportError);*/ - convertHeaderToJetty(clientresponse, response); - response.setStatus(statusCode); - - client.writeTo(response.getOutputStream()); + " StoreError=" + ((storeError==null)?"None":storeError) + + " StoreHTCache=" + storeHTCache + + " SupportError=" + supportError);*/ + convertHeaderToJetty(clientresponse, response); + response.setStatus(statusCode); + + if (statusCode == HttpServletResponse.SC_OK) { // continue to serve header to client e.g. HttpStatus = 302 (while skiping content) + client.writeTo(response.getOutputStream()); // may throw exception on httpStatus=302 while gzip encoded inputstream + } + + } + } catch (final SocketException se) { + throw new ServletException("Socket Exception: " + se.getMessage()); + } finally { + client.finish(); } - } catch(final SocketException se) { - throw new ServletException("Socket Exception: " + se.getMessage()); - } finally { - client.finish(); - } // we handled this request, break out of handler chain logProxyAccess(request); diff --git a/source/net/yacy/server/http/HTTPDProxyHandler.java b/source/net/yacy/server/http/HTTPDProxyHandler.java index bdcc2b734..3463a0552 100644 --- a/source/net/yacy/server/http/HTTPDProxyHandler.java +++ b/source/net/yacy/server/http/HTTPDProxyHandler.java @@ -66,6 +66,7 @@ import java.util.logging.FileHandler; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.Logger; +import javax.servlet.http.HttpServletResponse; import net.yacy.cora.document.id.DigestURL; import net.yacy.cora.protocol.ClientIdentification; @@ -572,8 +573,9 @@ public final class HTTPDProxyHandler { " StoreHTCache=" + storeHTCache + " SupportError=" + supportError); -// FileUtils.copy(res.getDataAsStream(), outStream); - client.writeTo(outStream); + if (statusCode == HttpServletResponse.SC_OK) { // continue to serve header to client e.g. HttpStatus = 302 (while skiping content) + client.writeTo(outStream); // may throw exception on httpStatus=302 while gzip encoded inputstream + } conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_MISS"); }