diff --git a/htroot/Network.java b/htroot/Network.java index 42099c1d4..a1cb1a607 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -498,29 +498,29 @@ public class Network { */ private static String parseLocationInUserAgent(final String userAgent) { final String location; - + final int firstOpenParenthesis = userAgent.indexOf('('); final int lastSemicolon = userAgent.lastIndexOf(';'); final int firstClosedParenthesis = userAgent.indexOf(')'); - - if(lastSemicolon > 0) { - // ; Location) - location = (firstClosedParenthesis > 0) ? userAgent.substring(lastSemicolon, firstClosedParenthesis).trim() - : userAgent.substring(lastSemicolon + 1).trim(); + + if (lastSemicolon > 0) { + // ; Location ) + location = (firstClosedParenthesis > 0) ? userAgent.substring(lastSemicolon + 1, firstClosedParenthesis) + .trim() : userAgent.substring(lastSemicolon + 1).trim(); } else { - if(firstOpenParenthesis > 0) { - if(firstClosedParenthesis > 0) { - // (Location) - location = userAgent.substring(firstOpenParenthesis, firstClosedParenthesis).trim(); + if (firstOpenParenthesis > 0) { + if (firstClosedParenthesis > 0) { + // ( Location ) + location = userAgent.substring(firstOpenParenthesis + 1, firstClosedParenthesis).trim(); } else { // ( Location - location = userAgent.substring(firstOpenParenthesis).trim(); + location = userAgent.substring(firstOpenParenthesis + 1).trim(); } } else { location = ""; } } - + return location; } } \ No newline at end of file diff --git a/source/de/anomic/http/HttpFactory.java b/source/de/anomic/http/HttpFactory.java index 7e8b01af6..69e6935c9 100644 --- a/source/de/anomic/http/HttpFactory.java +++ b/source/de/anomic/http/HttpFactory.java @@ -50,8 +50,8 @@ public class HttpFactory { /** * generates a new HttpClient object with given header and timeout * - * @param header - * @param timeout + * @param header used for all HTTP-requests (unless another one is set) + * @param timeout in milliseconds * @return */ public static HttpClient newClient(httpHeader header, int timeout) { diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index fc1599a24..92087b757 100644 --- a/source/de/anomic/yacy/yacyClient.java +++ b/source/de/anomic/yacy/yacyClient.java @@ -248,7 +248,7 @@ public final class yacyClient { * @throws IOException */ private static byte[] wput(final String url, String vhost, final Map post) throws IOException { - HttpClient client = HttpFactory.newClient(null, 12000); + HttpClient client = HttpFactory.newClient(null, 3600000); // abort after 1 hour client.setProxy(proxyConfig()); // address vhost