i think i found a bug: i m sending an http post request:
<http method="post" url="${loginUrl}">
<http-param name="user"><template>${user}</template></http-param> ...
the url is returning 302 redirect. the webharvest redirects but uses a get method instead of post, so the request fails (the server wants post...).
I've fixed that by changing line 191 in HttpClientManager.java:
old:
method = new GetMethod(newURI);
new:
if ( "post".equalsIgnoreCase(methodType) ) {
method = createPostMethod(newURI, params);
} else {
method = createGetMethod(newURI, params, charset);
}
is that right? who should i send this fix to?
thanks
yair
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Interesting question :) I cannot remember now, but there are 3 possible answers:
first version of HttpClient that was used in Web-Harvest didn't have setFollowRedirects method
it did have it, but for some reason it didn't work well
somehow I missed that HttpClient have that handy method
Anyway, thanks for the post. I'll surely check how it is impemented inside HttpClient, and I also must collect a number of real-life redirection cases to check if it works well.
If you have some URLs please send me to include them.
Regards, Vladimir.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi all
i think i found a bug: i m sending an http post request:
<http method="post" url="${loginUrl}">
<http-param name="user"><template>${user}</template></http-param> ...
the url is returning 302 redirect. the webharvest redirects but uses a get method instead of post, so the request fails (the server wants post...).
I've fixed that by changing line 191 in HttpClientManager.java:
old:
method = new GetMethod(newURI);
new:
if ( "post".equalsIgnoreCase(methodType) ) {
method = createPostMethod(newURI, params);
} else {
method = createGetMethod(newURI, params, charset);
}
is that right? who should i send this fix to?
thanks
yair
Thanks Yair, will be fixed in next release.
Speaking of re-directs, I see the following in HttpClientManager:
Why not just use method.setFollowRedirects(true)?
Interesting question :) I cannot remember now, but there are 3 possible answers:
Anyway, thanks for the post. I'll surely check how it is impemented inside HttpClient, and I also must collect a number of real-life redirection cases to check if it works well.
If you have some URLs please send me to include them.
Regards, Vladimir.