#341 URL args in form action are sent for GET forms

open-accepted
Russell Gold
None
5
2014-08-28
2005-12-29
Nathan Jakubiak
No

For the following html page and HttpUnit test,
HttpUnit does not replace the URL arguments
(arg=replaced) that are in the form action with the
arguments generated by the form inputs. It leaves
them in the request, so that when the request is
submitted, the request url is http://toad/cgi-bin/bar?
arg=replaced&foo=a. Both IE and Firefox submit the
URL as http://toad/cgi-bin/bar?foo=a.

HTML page:

<FORM NAME=Bethsheba METHOD=GET ACTION=/cgi-bin/bar?
arg=replaced>
<INPUT TYPE=TEXT NAME=foo>
<INPUT TYPE=SUBMIT>
</FORM>
<br>
<!--JavaScript submit: <a
href="javascript:document.Bethsheba.submit()">go</a>--
>

HttpUnit Test:

import com.meterware.httpunit.*;
import junit.framework.*;

public class HttpUnitTest6 extends TestCase {

public HttpUnitTest6() {
super(null);
}

protected void setUp() throws Exception {
super.setUp();
ClientProperties.getDefaultProperties
().setAutoRefresh(true);
ClientProperties.getDefaultProperties
().setAutoRedirect(true);
}

protected void tearDown() throws Exception {
super.tearDown();
}

public void testHttpUnit() throws Exception {
WebConversation wc = new WebConversation();

WebRequest req = new GetMethodWebRequest
("http://www.myserver.com/test.html");
WebResponse resp = wc.getResponse(req);

WebForm form = resp.getFormWithName
("Bethsheba");
form.getScriptableObject().set("foo", "a");
resp = form.submit();
System.out.println("url: " + resp.getURL());
}

public static junit.framework.Test suite() {
return new junit.framework.TestSuite
(HttpUnitTest6.class);
}

public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
}

Discussion

1 2 > >> (Page 1 of 2)
  • Wolfgang Fahl
    Wolfgang Fahl
    2008-04-19

    Logged In: YES
    user_id=1220573
    Originator: NO

    Dear Nathan,

    thank you for the bug report and the excellent JUnit test describing it.
    I've added you contribution to the subversion repository and have set the test and this bug to pending while we are
    waiting for a patch.
    It would be great if you'd contribute a patch for this.

    I'm looking forward to your participation.

    Yours
    Wolfgang

     
  • Wolfgang Fahl
    Wolfgang Fahl
    2008-04-19

    • assigned_to: nobody --> wolfgang_fahl
    • status: open --> pending-accepted
     
  • Wolfgang Fahl
    Wolfgang Fahl
    2008-04-19

    Logged In: YES
    user_id=1220573
    Originator: NO

    If you have a fix for this, I would be very happy to incorporate
    it. Please include a test case or instructions for duplicating
    the problem.

     
  • Logged In: YES
    user_id=1400709
    Originator: YES

    As far as I know I never fixed this on my side and I don't have time to provide a fix. Sorry!

     
    • status: pending-accepted --> open-accepted
     
  • Russell Gold
    Russell Gold
    2008-04-24

    Logged In: YES
    user_id=37920
    Originator: NO

    A test case would be good enough. We can fix it if we have that.

     
  • Wolfgang Fahl
    Wolfgang Fahl
    2008-04-29

    • assigned_to: wolfgang_fahl --> russgold
    • status: open-accepted --> pending-accepted
     
  • Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending-accepted --> closed-accepted
     
    • status: closed-accepted --> open-accepted
     
1 2 > >> (Page 1 of 2)