RE: Problem submitting forms over SSL

<[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <ABF4E02DA33A6F4BAC41122C7086C8990C2C65@bromail01.internal.gxs.com>
I am not sure if this will help you out at all, but I think httpunit
doesn't 
include some headers on all of its requests, and maybe apache is looking
for specific headers.  I just ran into a problem where httpunit was not
including the "Referer" header in a request so I manually set it (using
WebClient.setHeaderField) and my test worked.

I came to this conclusion by running both a browser and http unit
through an http recorder and comparing the output.  The browser
representing what the headers should look like and httpunit being what
the headers are.

You may give that a shot.

Rob

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Seth
Russell
Sent: Thursday, March 30, 2006 4:56 PM
To: [email protected]
Subject: Re: [Httpunit-develop] Problem submitting forms over SSL

I did some further testing, and I discovered that my code also works
with SSL sites and form submission over SSL (I tried an on-line banking
website), just not my applications.

My applications have been in use for about 2 years and used by hundreds
of people with different browsers...

Perhaps it is my architecture? I have a firewall, a load balancer, a
reverse proxy, and then finally the application server.

I tried running the tests from the clients perspective (going through
the whole stack), and also from the server - only connecting to the
application server - still with the same results. Does httpunit have
issues with apache 1.3.x?

One item to note: I don't ever get any exceptions thrown - every thing
seems to be working, but I just don't get the full response from the
server.

seth

Seth Russell wrote:

>I am attempting to write some httpunit tests of a ssl web application
>that I have. My applications are using ssl certs from Thawte.
>
>I have tested my code on sites such as google and it works just fine.
>However, when I attempt to submit forms on my applications, I only get
>the original URL - or a 302 response with no location header. One
>application, the form submits to another URL, and on one application,
>the application redirects the browser upon successful authentication. I
>have tried both the 1.4.2_10 and the 1.5.0_06 Sun JDKs (linux) and get
>the same response. I am using httpunit 1.6.2.
>
>My applications do not use javascript.
>
>Has any one had similar problems to what I am having?
>
>Here is the output I get:
>
><output original url>
>Reponse Message: OK
>Response Code: 200
>head field: CONTENT-TYPE: text/html; charset=ISO-8859-1
>head field: TRANSFER-ENCODING: chunked
>head field: X-POWERED-BY: PHP/5.0.3
>head field: SERVER: Apache/1.3.33 (Unix) PHP/5.0.3 DAV/1.0.3
>mod_ssl/2.8.22 OpenSSL/0.9.6m
>head field: DATE: Thu, 30 Mar 2006 16:47:49 GMT
>
>
>cp.isAcceptCookies(): true
>cp.isAcceptGzip(): true
>cp.isAutoRedirect(): true
>cp.isAutoRefresh() : false
>cp.isIframeSupported(): true
>b0 : Submit with =LOGIN
><output original url>
>Reponse Message: Found
>Response Code: 302
>head field: EXPIRES: Thu, 19 Nov 1981 08:52:00 GMT
>head field: SERVER: Apache/1.3.33 (Unix) mod_ssl/2.8.24 OpenSSL/0.9.7a
>head field: DATE: Thu, 30 Mar 2006 16:53:02 GMT
>Total Elapsed time in miliseconds: 2831
>BUILD SUCCESSFUL (total time: 4 seconds)
>
>
>Here is my sample code:
>package httpunit_test;
>
>import com.meterware.httpunit.*;
>
>public class Main
>{
>
>    /** Creates a new instance of Main */
>    public Main()
>    {
>    }
>
>    public static void main(String[] args)
>    {
>        long start;
>        long end;
>
>        WebConversation wc = new WebConversation();
>        try
>        {
>            ClientProperties cp =
ClientProperties.getDefaultProperties();
>            System.out.println("cp.isAcceptCookies(): " +
>cp.isAcceptCookies());
>            System.out.println("cp.isAcceptGzip(): " +
cp.isAcceptGzip());
>            System.out.println("cp.isAutoRedirect(): " +
>cp.isAutoRedirect());
>            System.out.println("cp.isAutoRefresh() : " +
>cp.isAutoRefresh());
>            System.out.println("cp.isIframeSupported(): " +
>cp.isIframeSupported());
>
>
>            start = System.currentTimeMillis();
>//            WebResponse wr =
>wc.getResponse("https://server.host.domain/prd/app/index.php");
>//            WebResponse wr =
>wc.getResponse("https://sub.server.host.domain/anotherapp/");
>            WebResponse wr = wc.getResponse("http://www.google.com/");
>            WebForm form = wr.getForms()[0];
>            form.setParameter("q", "httpunit");
>            //form.setParameter("useremail", "[email protected]");
>            //form.setParameter("password", "mypassword");
>
>            SubmitButton barr[] = form.getSubmitButtons();
>
>            for(int i=0; i < barr.length; i++)
>                System.out.println("b" + i + " : " + barr[i]);
>
>            WebRequest req = form.getRequest(barr[0]);
>            WebResponse wr_good = wc.sendRequest(req);
>
>            System.out.println(wr_good.getURL());
>
>
>            System.out.println("Reponse Message: " +
>wr_good.getResponseMessage());
>            System.out.println("Response Code: " +
>wr_good.getResponseCode());
>            String headerFields[] = wr_good.getHeaderFieldNames();
>
>            for (int i=0; i < headerFields.length; i++)
>                System.out.println("head field: " + headerFields[i] +
":
>" + wr_good.getHeaderField(headerFields[i]));
>
>            String result = wr_good.getText();
>            end = System.currentTimeMillis();
>            System.out.println("Total Elapsed time in miliseconds: " +
>(end - start));
>
>            String cookies[] = wc.getCookieNames();
>            for (int i=0; i < cookies.length; i++)
>                System.out.println("cookie value: " + cookies[i]);
>
>            System.out.println(result);
>        }
>        catch (Exception e)
>        {
>            e.printStackTrace();
>        }
>    }
>}
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
>that extends applications into web and mobile media. Attend the live
webcast
>and join the prime developer group breaking into this new coding
territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=12164
2
>_______________________________________________
>Httpunit-develop mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/httpunit-develop
>  
>


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.