From: <th...@cy...> - 2002-09-23 13:29:38
|
Hi, I encountered another problem with HtmUnit, which seems to be a little tricky. In our app we use lots of redirects. So after submitting a form the page containing the form will redirect to the next page (after checking submitted form-parameters). In HtmlUnit the submit of the form-parameters via is POST is correct. But when it tries to follow the redirect, it somehow converts the POST parameters into GET parameters and appends them to the URL-string. That's not right behavior and our application can't handle that. Is there a possibility to switch that off or does anyone know a workaround? Let me know if there isn't, so that I can open a new feature request. Thanks, Thomas Bartz |
From: Mike B. <gar...@ya...> - 2002-09-23 13:57:25
|
> In HtmlUnit the submit of the > form-parameters via is POST is correct. But when it tries to > follow the redirect, it somehow converts the POST parameters > into GET parameters and appends them to the URL-string. That's > not right behavior and our application can't handle that. > Is there a possibility to switch that off or does anyone know a > workaround? You can disable automatic redirection handling with WebClient.setRedirectEnabled(false). It's certainly possible that I've made a mistake in the redirection handling but as far as I know, it is correct according to the HTTP/1.1 specification. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3 If you think that HtmlUnit is handling this incorrectly then please open a bug report. I'll need to know the exact status code being returned from the server as the redirection logic is different for different status codes. Since you mentioned the method switching from post to get, I assume that the status code you got was either a 302 or a 303. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca |
From: Thomas B. <th...@cy...> - 2002-09-24 17:14:20
|
Hello again,=20 thanks a lot for your quick answer.=20 Am Montag, 23. September 2002 15:57 schrieb Mike Bowler: > > In HtmlUnit the submit of the > > form-parameters via is POST is correct. But when it tries to > > follow the redirect, it somehow converts the POST parameters > > into GET parameters and appends them to the URL-string. That's > > not right behavior and our application can't handle that. > > Is there a possibility to switch that off or does anyone know a > > workaround? > > You can disable automatic redirection handling with > WebClient.setRedirectEnabled(false). Thats not exactly what I had in mind ;) > It's certainly possible that I've made a mistake in the redirection > handling but as far as I know, it is correct according to the HTTP/1.1 > specification. > > http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3 > > If you think that HtmlUnit is handling this incorrectly then please > open a bug report. I'll need to know the exact status code being > returned from the server as the redirection logic is different for > different status codes. > > Since you mentioned the method switching from post to get, I assume > that the status code you got was either a 302 or a 303. So after I got your mail I checked it all a little bit and found out the=20 following: The given status code was a 302 and the HTTP/1.1 specification= =20 doesn't really mention what to do with POST-Request-Parameters on a 302, = does=20 it? As far as I understand, it says to keep the original Request-URI for=20 future requests, not convert parameters for the redirect-URI. But maybe I= 'm=20 wrong with this, after reading the specifications a few times I was prett= y=20 puzzled how to understand it at all ;) However, I tried something different. I compared the behavior of an inter= net=20 browser (Mozilla) with the behavior of HtmlUnit. It is in fact so, that t= he=20 browser doesnt convert the original POST-Parameters into GET-Parameters w= hile=20 doing the redirect and HtmlUnit does. I tried this out with two simple=20 PHP-scripts. The first one contains a form, which points to itself (PHP_S= ELF=20 as action), but redirects to the second when the variable for the=20 submit-button is set. The second one just prints out the value of the=20 form-datas if accessible, like the vaue of the submit-button for instance= =2E So=20 with browser I don't get any output on the second page, like I get with=20 HtmlUnit.=20 Well, as I said, I'm not sure how it really is specified. But however it = is,=20 HtmlUnit does here something uncommon. The most user agents (IE, NS,=20 Opera...) handle it like described above and different from the HtmlUnit-= way. It's up to you if it's a bug in HtmlUnit or actually in all other clients= =2E In=20 case its not a bug, I'd like to see a possibility to configure browser-li= ke=20 behavior on redirects. Thanks for your help anyways.=20 Kind regards, Thomas --=20 Thomas Bartz th...@cy... G=E4rtnerstr. 28, 10245 Berlin; Tel.: 030 29005717 http://www.cyainhell.de |
From: Mike B. <mb...@Ga...> - 2002-09-25 01:06:27
|
I've read the http spec again and it isn't really clear what the correct behaviour is so I'm going to do what the common browsers do. I've changed redirect logic so that on a 302 or 303 status, if the method changes from post to get, the parameters will be thrown away for the second request. This code is now in cvs. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |
From: Harm de L. <ha...@ww...> - 2002-09-23 15:49:27
|
Hi there, I'm having the same problem. We use Lotus Domino as our webserver. I'm curious if somebody has a workaround or fix for this problem. Thanks, Harm de Laat Informatiefabriek The Netherlands. On Mon, Sep 23, 2002 at 03:29:23PM +0200, th...@cy... wrote: > Hi, > > I encountered another problem with HtmUnit, which seems to be a little > tricky. In our app we use lots of redirects. So after submitting a form > the page containing the form will redirect to the next page (after > checking submitted form-parameters). In HtmlUnit the submit of the > form-parameters via is POST is correct. But when it tries to follow the > redirect, it somehow converts the POST parameters into GET parameters > and appends them to the URL-string. That's not right behavior and our > application can't handle that. > Is there a possibility to switch that off or does anyone know a > workaround? > Let me know if there isn't, so that I can open a new feature request. > > Thanks, > Thomas Bartz > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > HtmlUnit-develop mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-develop -- Harm de Laat -- echo "tooL ed mroH" | rev | tr o a |