This is an automated email from the ASF dual-hosted git repository.
snagel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nutch.git
The following commit(s) were added to refs/heads/master by this push:
new 9d42fcf NUTCH-2432 Protocol httpclient to disable cookies if
http.enable.cookie.header is false (contributed by Markus Jelsma)
9d42fcf is described below
commit 9d42fcfcd74977319cd27b1d92b0c87aac79cdf3
Author: Sebastian Nagel <[email protected]>
AuthorDate: Mon Jul 2 16:53:04 2018 +0200
NUTCH-2432 Protocol httpclient to disable cookies if
http.enable.cookie.header is false
(contributed by Markus Jelsma)
---
.../java/org/apache/nutch/protocol/httpclient/HttpResponse.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java
b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java
index 863a02b..05b9e2a 100644
---
a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java
+++
b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java
@@ -88,8 +88,13 @@ public class HttpResponse implements Response {
}
params.makeLenient();
params.setContentCharset("UTF-8");
- params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
- params.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
+
+ if (http.isCookieEnabled()) {
+ params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
+ params.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
+ } else {
+ params.setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
+ }
// XXX (ab) not sure about this... the default is to retry 3 times; if
// XXX the request body was sent the method is not retried, so there is
// XXX little danger in retrying...