Skip to content

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

removed cookie handling in httpc: - no need to do cookie handling in proxy, this was switched off so far - no need for cookies in crawler, this was switched on (by mistake) This fix was needed for a case where a web server flooded the crawler with cookies and caused a complete blocking of the httpc.

orbiterdb3a06dd8132
diff --git a/source/de/anomic/http/httpClient.java b/source/de/anomic/http/httpClient.java
index 8f7e21104..ecae456ac 100644
--- a/source/de/anomic/http/httpClient.java
+++ b/source/de/anomic/http/httpClient.java
@@ -165,7 +165,7 @@ public class httpClient {
private httpRemoteProxyConfig proxyConfig = null;
private boolean useGlobalProxyConfig = true;
private boolean followRedirects = true;
- private boolean ignoreCookies = false;
+ //private boolean ignoreCookies = true;
/**
* creates a new JakartaCommonsHttpClient with given timeout using global remoteProxyConfig
@@ -241,19 +241,6 @@ public class httpClient {
followRedirects = follow;
}
- /**
- * <p>by default Cookies are accepted and used autmatically</p>
- *
- * <q cite="http://hc.apache.org/httpclient-3.x/cookies.html">HttpClient supports automatic management of cookies, including allowing the server to set cookies and
- * automatically return them to the server when required.</q>
- * <cite>HttpClient Cookie Guide</cite>
- *
- * @param ignoreCookies
- */
- public void setIgnoreCookies(final boolean ignoreCookies) {
- this.ignoreCookies = ignoreCookies;
- }
-
/*
* (non-Javadoc)
* @see de.anomic.http.HttpClient#getUserAgent()
@@ -272,6 +259,7 @@ public class httpClient {
public httpResponse GET(final String uri) throws IOException {
final HttpMethod get = new GetMethod(uri);
get.setFollowRedirects(followRedirects);
+ get.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
return execute(get);
}
@@ -286,6 +274,7 @@ public class httpClient {
assert uri != null : "precondition violated: uri != null";
final HttpMethod head = new HeadMethod(uri);
head.setFollowRedirects(followRedirects);
+ head.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
return execute(head);
}
@@ -374,6 +363,7 @@ public class httpClient {
hostConfig.setHost(host, port);
final HttpMethod connect = new ConnectMethod(hostConfig);
connect.setFollowRedirects(false); // there are no redirects possible for CONNECT commands as far as I know.
+ connect.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
return execute(connect);
}
@@ -437,7 +427,6 @@ public class httpClient {
*/
private httpResponse execute(final HttpMethod method) throws IOException {
assert method != null : "precondition violated: method != null";
- checkIgnoreCookies(method);
setHeader(method);
final httpRemoteProxyConfig hostProxyConfig = setProxy(method);
@@ -518,16 +507,6 @@ public class httpClient {
}
}
- /**
- * @param method
- */
- private void checkIgnoreCookies(final HttpMethod method) {
- // ignore cookies
- if(ignoreCookies) {
- method.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
- }
- }
-
/**
* @param method
* @return
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java
index 6c6488c02..1f1b52ca3 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/httpdProxyHandler.java
@@ -1055,7 +1055,6 @@ public final class httpdProxyHandler {
final httpClient client = new httpClient(timeout, requestHeader);
client.setFollowRedirects(false);
// cookies are handled by the user's browser
- client.setIgnoreCookies(true);
client.setProxy(httpRemoteProxyConfig.getProxyConfigForURI(connectHost));
return client;
}