From f678cda5149d5d7567432bdd0f1a42c49a5fefbf Mon Sep 17 00:00:00 2001 From: theli Date: Tue, 10 May 2005 09:22:14 +0000 Subject: [PATCH] *) correcting bug in transparent proxy support git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@99 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpd.java | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/source/de/anomic/http/httpd.java b/source/de/anomic/http/httpd.java index 7cd4bc2ad..5409b1d71 100644 --- a/source/de/anomic/http/httpd.java +++ b/source/de/anomic/http/httpd.java @@ -204,17 +204,24 @@ public final class httpd implements serverHandler { private void transparentProxyHandling(httpHeader header) { if (!(httpdProxyHandler.isTransparentProxy && header.containsKey("HOST"))) return; - String dstHost, dstHostSocket = (String) header.get("HOST"); - - int idx = dstHostSocket.indexOf(":"); - dstHost = (idx != -1) ? dstHostSocket.substring(0,idx).trim() : dstHostSocket.trim(); - - try { - InetAddress dstHostAddress = InetAddress.getByName(dstHost); - if (!(dstHostAddress.isAnyLocalAddress() || dstHostAddress.isLoopbackAddress())) { - this.prop.setProperty("HOST",dstHostSocket); - } - } catch (Exception e) { } + try { + String dstHost, dstHostSocket = (String) header.get("HOST"); + + int idx = dstHostSocket.indexOf(":"); + dstHost = (idx != -1) ? dstHostSocket.substring(0,idx).trim() : dstHostSocket.trim(); + Integer dstPort = (idx != -1) ? Integer.valueOf(dstHostSocket.substring(idx+1)) : new Integer(80); + + if (dstPort.intValue() == 80) { + if (dstHost.endsWith(".yacy")) { + this.prop.setProperty("HOST",dstHostSocket); + } else { + InetAddress dstHostAddress = InetAddress.getByName(dstHost); + if (!(dstHostAddress.isAnyLocalAddress() || dstHostAddress.isLoopbackAddress())) { + this.prop.setProperty("HOST",dstHostSocket); + } + } + } + } catch (Exception e) {} } public Boolean GET(String arg) throws IOException {