Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Bugfix for name resolution in proxy mode See: http://www.yacy-forum.de/viewtopic.php?p=25241

theli1c8300fcecab
diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.java
index 02a80e4cd..ee37ab02e 100644
--- a/source/de/anomic/http/httpc.java
+++ b/source/de/anomic/http/httpc.java
@@ -622,21 +622,22 @@ public final class httpc {
this.adressed_host = server;
this.adressed_port = port;
this.target_virtual_host = vhost;
- InetAddress hostip;
-// if ((server.equals("localhost")) || (server.equals("127.0.0.1")) || (server.startsWith("192.168.")) || (server.startsWith("10."))) {
-// hostip = server;
-// } else {
- hostip = dnsResolve(server);
- if (hostip == null) throw new UnknownHostException(server);
-// }
-
+
// creating a socket
this.socket = (ssl)
? theSSLSockFactory.createSocket()
: new Socket();
// creating a socket address
- InetSocketAddress address = new InetSocketAddress(hostip, port);
+ InetSocketAddress address = null;
+ if (!this.remoteProxyUse) {
+ // only try to resolve the address if we are not using a proxy
+ InetAddress hostip = dnsResolve(server);
+ if (hostip == null) throw new UnknownHostException(server);
+ address = new InetSocketAddress(hostip, port);
+ } else {
+ address = new InetSocketAddress(server,port);
+ }
// trying to establish a connection to the address
this.socket.connect(address,timeout);
diff --git a/source/de/anomic/plasma/plasmaCrawlStacker.java b/source/de/anomic/plasma/plasmaCrawlStacker.java
index 42fef71d8..64cc22145 100644
--- a/source/de/anomic/plasma/plasmaCrawlStacker.java
+++ b/source/de/anomic/plasma/plasmaCrawlStacker.java
@@ -285,13 +285,16 @@ public final class plasmaCrawlStacker {
}
// check if ip is local ip address
- checkInterruption();
+ checkInterruption();
InetAddress hostAddress = httpc.dnsResolve(nexturl.getHost());
if (hostAddress == null) {
- reason = plasmaCrawlEURL.DENIED_UNKNOWN_HOST;
- this.log.logFine("Unknown host in URL '" + nexturlString + "'. " +
- "Stack processing time: " + (System.currentTimeMillis()-startTime) + "ms");
- return reason;
+ // if a http proxy is configured name resolution may not work
+ if (this.sb.remoteProxyConfig == null || !this.sb.remoteProxyConfig.useProxy()) {
+ reason = plasmaCrawlEURL.DENIED_UNKNOWN_HOST;
+ this.log.logFine("Unknown host in URL '" + nexturlString + "'. " +
+ "Stack processing time: " + (System.currentTimeMillis()-startTime) + "ms");
+ return reason;
+ }
} else if (hostAddress.isSiteLocalAddress()) {
reason = plasmaCrawlEURL.DENIED_PRIVATE_IP_ADDRESS;
this.log.logFine("Host in URL '" + nexturlString + "' has private IP address. " +