*) correcting bug in transparent proxy support

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@99 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent a5fec449c8
commit f678cda514

@ -204,17 +204,24 @@ public final class httpd implements serverHandler {
private void transparentProxyHandling(httpHeader header) {
if (!(httpdProxyHandler.isTransparentProxy && header.containsKey("HOST"))) return;
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);
try {
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) { }
}
}
} catch (Exception e) {}
}
public Boolean GET(String arg) throws IOException {

Loading…
Cancel
Save