Skip to content

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

*) Correcting problems if the port number was set to -1, e.g. because of the usage of function URL.getPort()

theli944485289651
diff --git a/source/de/anomic/http/httpc.java b/source/de/anomic/http/httpc.java
index f127b796a..593b6f819 100644
--- a/source/de/anomic/http/httpc.java
+++ b/source/de/anomic/http/httpc.java
@@ -384,6 +384,11 @@ public final class httpc {
*/
void init(String server, int port, int timeout, boolean ssl,
String remoteProxyHost, int remoteProxyPort) throws IOException {
+
+ if (port == -1) {
+ port = (ssl)? 443 : 80;
+ }
+
this.init(remoteProxyHost, remoteProxyPort, timeout, ssl);
this.remoteProxyUse = true;
this.savedRemoteHost = server + ((port == 80) ? "" : (":" + port));
@@ -410,6 +415,10 @@ public final class httpc {
this.savedRemoteHost = server;
try {
+ if (port == -1) {
+ port = (ssl)? 443 : 80;
+ }
+
this.host = server + ((port == 80) ? "" : (":" + port));
String hostip;
if ((server.equals("localhost")) || (server.equals("127.0.0.1")) || (server.startsWith("192.168.")) || (server.startsWith("10."))) {