Menu

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

open-accepted
None
5
2014-12-15
2005-12-29
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

  • 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.

     
  • Nathan Jakubiak

    Nathan Jakubiak - 2008-04-21

    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!

     
  • Nathan Jakubiak

    Nathan Jakubiak - 2008-04-21
    • 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
     
  • SourceForge Robot

    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).

     
  • SourceForge Robot

    • status: pending-accepted --> closed-accepted
     
  • Nathan Jakubiak

    Nathan Jakubiak - 2008-05-14
    • status: closed-accepted --> open-accepted
     
  • Nathan Jakubiak

    Nathan Jakubiak - 2008-05-14

    Logged In: YES
    user_id=1400709
    Originator: YES

    I already attached the test case. Simply put the HTML code in my original comments on a web server, and access it using the JUnit test case I included in my original comments. Is there more information that you need for the test case?

     
  • Wolfgang Fahl

    Wolfgang Fahl - 2008-05-15

    Logged In: YES
    user_id=1220573
    Originator: NO

    Dear Nathan,

    the comment list on this Bug reports gets a bit confusing at this time.
    I tried to communicat that the test case was successfully added to the subversion repository by me.
    Both Russell and you are than asking to add the testcase which seems to a miss understanding. Again - the testcase is there
    and it has been set to pending since it clearly shows that httpunit does not do what is expected as outlined in your bugreport.

    The next step naturally is to solve the problem by changing the httpunit software. If you got a patch for this that would be just great.

    Yours
    Wolfgang

     
  • Wolfgang Fahl

    Wolfgang Fahl - 2008-05-15
    • status: open-accepted --> pending-accepted
     
  • Wolfgang Fahl

    Wolfgang Fahl - 2008-05-15

    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.

     
  • Nathan Jakubiak

    Nathan Jakubiak - 2008-05-15

    Logged In: YES
    user_id=1400709
    Originator: YES

    You're right, it did get a bit confusing. :) I don't have a fix for this, and am unable to provide one at this time. So I'll leave it to someone else to do. Sorry for the confusion!

     
  • Nathan Jakubiak

    Nathan Jakubiak - 2008-05-15
    • status: pending-accepted --> open-accepted
     

Log in to post a comment.