[jira] [Commented] (NUTCH-827) HTTP POST Authentication
[ https://issues.apache.org/jira/browse/NUTCH-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13471600#comment-13471600 ] Jasper van Veghel commented on NUTCH-827: - {code} +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); {code} If you turn on TRACE logging, you should see messages like that. HTTP POST Authentication Key: NUTCH-827 URL: https://issues.apache.org/jira/browse/NUTCH-827 Project: Nutch Issue Type: New Feature Components: fetcher Affects Versions: 1.1, nutchgora Reporter: Jasper van Veghel Priority: Minor Labels: authentication Fix For: 1.6 Attachments: nutch-http-cookies.patch I've created a patch against the trunk which adds support for very rudimentary POST-based authentication support. It takes a link from nutch-site.xml with a site to POST to and its respective parameters (username, password, etc.). It then checks upon every request whether any cookies have been initialized, and if none have, it fetches them from the given link. This isn't perfect but Works For Me (TM) as I generally only need to retrieve results from a single domain and so have no cookie overlap (i.e. if the domain cookies expire, all cookies disappear from the HttpClient and I can simply re-fetch them). A natural improvement would be to be able to specify one particular cookie to check the expiration-date against. If anyone is interested in this beside me I'd be glad to put some more effort into making this more universally applicable. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (NUTCH-827) HTTP POST Authentication
[ https://issues.apache.org/jira/browse/NUTCH-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13466701#comment-13466701 ] Jasper van Veghel commented on NUTCH-827: - Hi Max, I'm sorry, but I don't really use the patch anymore, so I wouldn't be able to tell you. We used it in conjunction with an internal SAP system that we needed to spider, so that's not a public source you could try it against. Why not write up your own quick script which lets you POST some data, sets a cookie, and then returns some specific piece of data only when that cookie is set? Good luck! Jasper HTTP POST Authentication Key: NUTCH-827 URL: https://issues.apache.org/jira/browse/NUTCH-827 Project: Nutch Issue Type: New Feature Components: fetcher Affects Versions: 1.1, nutchgora Reporter: Jasper van Veghel Priority: Minor Labels: authentication Fix For: 1.6 Attachments: nutch-http-cookies.patch I've created a patch against the trunk which adds support for very rudimentary POST-based authentication support. It takes a link from nutch-site.xml with a site to POST to and its respective parameters (username, password, etc.). It then checks upon every request whether any cookies have been initialized, and if none have, it fetches them from the given link. This isn't perfect but Works For Me (TM) as I generally only need to retrieve results from a single domain and so have no cookie overlap (i.e. if the domain cookies expire, all cookies disappear from the HttpClient and I can simply re-fetch them). A natural improvement would be to be able to specify one particular cookie to check the expiration-date against. If anyone is interested in this beside me I'd be glad to put some more effort into making this more universally applicable. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (NUTCH-827) HTTP POST Authentication
[ https://issues.apache.org/jira/browse/NUTCH-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13466741#comment-13466741 ] Jasper van Veghel commented on NUTCH-827: - Looks like a pretty sloppy mistake in the patch .. ;-) + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else { + Http.LOG.error(Unable to retrieve login page; code = + code); + } Change that to something like .. + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else if (code != 200) { + Http.LOG.error(Unable to retrieve login page; code = + code); + } And also change this .. + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one.); To something like this .. + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one., e); To see where the Exception is coming from. All it does after that LOG.error() is release the connection. So it shouldn't be throwing an Exception. HTTP POST Authentication Key: NUTCH-827 URL: https://issues.apache.org/jira/browse/NUTCH-827 Project: Nutch Issue Type: New Feature Components: fetcher Affects Versions: 1.1, nutchgora Reporter: Jasper van Veghel Priority: Minor Labels: authentication Fix For: 1.6 Attachments: nutch-http-cookies.patch I've created a patch against the trunk which adds support for very rudimentary POST-based authentication support. It takes a link from nutch-site.xml with a site to POST to and its respective parameters (username, password, etc.). It then checks upon every request whether any cookies have been initialized, and if none have, it fetches them from the given link. This isn't perfect but Works For Me (TM) as I generally only need to retrieve results from a single domain and so have no cookie overlap (i.e. if the domain cookies expire, all cookies disappear from the HttpClient and I can simply re-fetch them). A natural improvement would be to be able to specify one particular cookie to check the expiration-date against. If anyone is interested in this beside me I'd be glad to put some more effort into making this more universally applicable. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (NUTCH-827) HTTP POST Authentication
[ https://issues.apache.org/jira/browse/NUTCH-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13466741#comment-13466741 ] Jasper van Veghel edited comment on NUTCH-827 at 10/1/12 10:40 PM: --- Looks like a pretty sloppy mistake in the patch .. ;-) {code} + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else { + Http.LOG.error(Unable to retrieve login page; code = + code); + } {code} Change that to something like .. {code} + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else if (code != 200) { + Http.LOG.error(Unable to retrieve login page; code = + code); + } {code} And also change this .. {code} + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one.); {code} To something like this .. {code} + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one., e); {code} To see where the Exception is coming from. All it does after that LOG.error() is release the connection. So it shouldn't be throwing an Exception. was (Author: jaspervanveghel): Looks like a pretty sloppy mistake in the patch .. ;-) pre + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else { + Http.LOG.error(Unable to retrieve login page; code = + code); + } /pre Change that to something like .. pre + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else if (code != 200) { + Http.LOG.error(Unable to retrieve login page; code = + code); + } /pre And also change this .. pre + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one.); /pre To something like this .. pre + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one., e); /pre To see where the Exception is coming from. All it does after that LOG.error() is release the connection. So it shouldn't be throwing an Exception. HTTP POST Authentication Key: NUTCH-827 URL: https://issues.apache.org/jira/browse/NUTCH-827 Project: Nutch Issue Type: New Feature Components: fetcher Affects Versions: 1.1, nutchgora Reporter: Jasper van Veghel Priority: Minor Labels: authentication Fix For: 1.6 Attachments: nutch-http-cookies.patch I've created a patch against the trunk which adds support for very rudimentary POST-based authentication support. It takes a link from nutch-site.xml with a site to POST to and its respective parameters (username, password, etc.). It then checks upon every request whether any cookies have been initialized, and if none have, it fetches them from the given link. This isn't perfect but Works For Me (TM) as I generally only need to retrieve results from a single domain and so have no cookie overlap (i.e. if the domain cookies expire, all cookies disappear from the HttpClient and I can simply re-fetch them). A natural improvement would be to be able to specify one particular cookie to check the expiration-date against. If anyone is interested in this beside me I'd be glad to put some more effort into making this more universally applicable. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (NUTCH-827) HTTP POST Authentication
[ https://issues.apache.org/jira/browse/NUTCH-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13466741#comment-13466741 ] Jasper van Veghel edited comment on NUTCH-827 at 10/1/12 10:39 PM: --- Looks like a pretty sloppy mistake in the patch .. ;-) pre + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else { + Http.LOG.error(Unable to retrieve login page; code = + code); + } /pre Change that to something like .. pre + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else if (code != 200) { + Http.LOG.error(Unable to retrieve login page; code = + code); + } /pre And also change this .. pre + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one.); /pre To something like this .. pre + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one., e); /pre To see where the Exception is coming from. All it does after that LOG.error() is release the connection. So it shouldn't be throwing an Exception. was (Author: jaspervanveghel): Looks like a pretty sloppy mistake in the patch .. ;-) + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else { + Http.LOG.error(Unable to retrieve login page; code = + code); + } Change that to something like .. + if (code == 200 Http.LOG.isTraceEnabled()) { +Http.LOG.trace(url: + url + +; status code: + code + +; cookies received: + Http.getClient().getState().getCookies().length); + } else if (code != 200) { + Http.LOG.error(Unable to retrieve login page; code = + code); + } And also change this .. + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one.); To something like this .. + LOG.error(Cookie-based authentication failed; cookies will not be present for this request but an attempt to retrieve them will be made for the next one., e); To see where the Exception is coming from. All it does after that LOG.error() is release the connection. So it shouldn't be throwing an Exception. HTTP POST Authentication Key: NUTCH-827 URL: https://issues.apache.org/jira/browse/NUTCH-827 Project: Nutch Issue Type: New Feature Components: fetcher Affects Versions: 1.1, nutchgora Reporter: Jasper van Veghel Priority: Minor Labels: authentication Fix For: 1.6 Attachments: nutch-http-cookies.patch I've created a patch against the trunk which adds support for very rudimentary POST-based authentication support. It takes a link from nutch-site.xml with a site to POST to and its respective parameters (username, password, etc.). It then checks upon every request whether any cookies have been initialized, and if none have, it fetches them from the given link. This isn't perfect but Works For Me (TM) as I generally only need to retrieve results from a single domain and so have no cookie overlap (i.e. if the domain cookies expire, all cookies disappear from the HttpClient and I can simply re-fetch them). A natural improvement would be to be able to specify one particular cookie to check the expiration-date against. If anyone is interested in this beside me I'd be glad to put some more effort into making this more universally applicable. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (NUTCH-827) HTTP POST Authentication
[ https://issues.apache.org/jira/browse/NUTCH-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13464589#comment-13464589 ] Jasper van Veghel commented on NUTCH-827: - Hey guys, This has been some time back, but take a look at the patch: nutch-default.xml .. namehttp.cookie.login.page/name descriptionURL of the login page to derive the cookies from. Cookies will be stored upon initialization and re-initialized upon expiration. Any URL request attributes will be [..] POSTed to the page. [..]/description Apologies for the poor grammar in the original. ;-) Basically: - Whenever protocol-httpclient performs an HTTP request, it will first check if there are cookies stored in the cookie jar. - If there are cookies in the cookie jar AND none of the cookies have expired, it will do nothing. - If there are no cookies in the cookie jar OR at least one of the cookies has expired, it will .. - POST the URL / parameters provided in http.cookie.login.page property - In the process of which, the cookie jar should get filled with the cookies you need to perform subsequent (authenticated) requests The http.cookie.login.page property could contain something like http://abc/def?username=foopassword=bar; .. the 'username' and 'password' properties will them be POSTed to 'http://abc/def', which should result in cookies being added to the cookie jar which is used for each subsequent request. This isn't exactly a fool-proof solution (what if other requests generate expired cookies? what if the login fails? etc.), but for the project for which I wrote the patch, it suited our needs. Hope it helps! HTTP POST Authentication Key: NUTCH-827 URL: https://issues.apache.org/jira/browse/NUTCH-827 Project: Nutch Issue Type: New Feature Components: fetcher Affects Versions: 1.1, nutchgora Reporter: Jasper van Veghel Priority: Minor Labels: authentication Fix For: 1.6 Attachments: nutch-http-cookies.patch I've created a patch against the trunk which adds support for very rudimentary POST-based authentication support. It takes a link from nutch-site.xml with a site to POST to and its respective parameters (username, password, etc.). It then checks upon every request whether any cookies have been initialized, and if none have, it fetches them from the given link. This isn't perfect but Works For Me (TM) as I generally only need to retrieve results from a single domain and so have no cookie overlap (i.e. if the domain cookies expire, all cookies disappear from the HttpClient and I can simply re-fetch them). A natural improvement would be to be able to specify one particular cookie to check the expiration-date against. If anyone is interested in this beside me I'd be glad to put some more effort into making this more universally applicable. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Created: (NUTCH-827) HTTP POST Authentication
HTTP POST Authentication Key: NUTCH-827 URL: https://issues.apache.org/jira/browse/NUTCH-827 Project: Nutch Issue Type: New Feature Components: fetcher Affects Versions: 1.1, 2.0 Reporter: Jasper van Veghel Priority: Minor I've created a patch against the trunk which adds support for very rudimentary POST-based authentication support. It takes a link from nutch-site.xml with a site to POST to and its respective parameters (username, password, etc.). It then checks upon every request whether any cookies have been initialized, and if none have, it fetches them from the given link. This isn't perfect but Works For Me (TM) as I generally only need to retrieve results from a single domain and so have no cookie overlap (i.e. if the domain cookies expire, all cookies disappear from the HttpClient and I can simply re-fetch them). A natural improvement would be to be able to specify one particular cookie to check the expiration-date against. If anyone is interested in this beside me I'd be glad to put some more effort into making this more universally applicable. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.