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 |