From 3df5c7a6cff781afc9374ef4de6edbe704988d04 Mon Sep 17 00:00:00 2001 From: theli Date: Thu, 1 Sep 2005 11:34:32 +0000 Subject: [PATCH] *) Displaying an proxy error page instead of a white page if the server has closed the connection before yacy was able to receive the http response line See: http://www.yacy-forum.de/viewtopic.php?p=8866#8866 http://www.yacy-forum.de/viewtopic.php?t=704 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@630 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpdProxyHandler.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java index 938b332dc..608f6646f 100644 --- a/source/de/anomic/http/httpdProxyHandler.java +++ b/source/de/anomic/http/httpdProxyHandler.java @@ -478,9 +478,17 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt // send request res = remote.GET(remotePath, requestHeader); conProp.put(httpd.CONNECTION_PROP_CLIENT_REQUEST_HEADER,requestHeader); - long contentLength = res.responseHeader.contentLength(); + + // request has been placed and result has been returned. work off response + String[] resStatus = res.status.split(" "); + + // determine if it's an internal error of the httpc + if (res.responseHeader.size() == 0) { + throw new Exception((resStatus.length > 1) ? resStatus[1] : "Internal httpc error"); + } // if the content length is not set we have to use chunked transfer encoding + long contentLength = res.responseHeader.contentLength(); if (contentLength < 0) { // according to http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html // a 204,304 message must not contain a message body. @@ -546,9 +554,6 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt // remove hop by hop headers this.removeHopByHopHeaders(res.responseHeader); - // request has been placed and result has been returned. work off response - String[] resStatus = res.status.split(" "); - // sending the respond header back to the client if (chunkedOut != null) { res.responseHeader.put(httpHeader.TRANSFER_ENCODING, "chunked");