[
https://issues.apache.org/jira/browse/NUTCH-2280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15374030#comment-15374030
]
ASF GitHub Bot commented on NUTCH-2280:
---------------------------------------
Github user lewismc commented on a diff in the pull request:
https://github.com/apache/nutch/pull/134#discussion_r70545476
--- Diff:
src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpFormAuthentication.java
---
@@ -135,6 +143,26 @@ public boolean getFollowRedirects() {
}
}
}
+
+ /**
+ * @throws NoSuchFieldException
+ * @throws SecurityException
+ * @throws IllegalArgumentException
+ * @throws IllegalAccessException
+ */
+ private void setCookieParams(HttpFormAuthConfigurer formConfigurer,
+ HttpMethodParams params)
+ throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {
+ // NUTCH-2280 - set the HttpClient cookie policy
+ if (formConfigurer.getCookiePolicy() != null) {
+ String policy = formConfigurer.getCookiePolicy();
+ Object p =
FieldUtils.readDeclaredStaticField(CookiePolicy.class, policy);
+ if(null != p) {
+ LOGGER.debug("reflection of cookie value: " +
p.toString());
--- End diff --
Code formatting. 2 space indents please.
> HTTP Post form authentication CookiePolicy configuration
> --------------------------------------------------------
>
> Key: NUTCH-2280
> URL: https://issues.apache.org/jira/browse/NUTCH-2280
> Project: Nutch
> Issue Type: New Feature
> Components: protocol
> Affects Versions: 1.11
> Reporter: Steve Yao
> Priority: Minor
> Labels: authentication
> Attachments: NUTCH-2280.YAO.160705.patch.txt,
> NUTCH-2280.YAO.160712.patch.txt
>
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> The protocol-httpclient plugin supports HTTP form authentication with form
> values post back to the assigned login URL and store the session cookie for
> following content retrieving.
> The httpclient default CookiePolicy setting is in use. This default setting
> will reject cookie has domain set starting as ".", for example
> domain=".domain.com". This kind of domain value could be accepted by most web
> browsers.
> I suggest to add an configurable option in conf/httpclient-auth.xml:
> {code:xml}<credentials authMethod="formMethod" ...>
> ...
> <loginCookie>
> <policy>DEFAULT | BROWSER_COMPATIBILITY | NETSCAPE RFC_2109 |
> RFC_2965</policy>
> </loginCookie>
> </credentials>{code}
> Then, the httpclient could take this Cookie policy value.
> I am working on a patch for this feature. But before i implement the
> configuration format change, i would like to hear any other suggestions or
> comments.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)