hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius Davies" <juliusdav...@gmail.com>
Subject Re: https now works, but http doesnt?!?!
Date Sat, 02 Dec 2006 18:38:26 GMT
Hi, Jake,

Sounds frustrating!

On 12/2/06, Jake C <buddhabuddy@hotmail.com> wrote:
> I tried all of that.
> I call "client.setState(new HttpState());" before my transactions and
> removed the synchronized blocks.
> I checked the forms I'm posting to on both servers, and they are identical
> except for the __VIEWSTATE value.

You checked the HTML forms?  Are they are both using "method=POST" ?
And so in HttpClient you're creating the
"application/x-www-form-urlencoded" RequestEntity and adding it to
your PostMethod.

> I print out the URI and the parameters I'm adding. If I paste the URI into
> the web browser then add the parameters manually
> (<URI>?<Name1>=<Value1>&<Name2>=<Value2>&...) it
works just fine!

When you do that (paste a URI into a browser) then you're doing a GET
request, not a POST request.  You have to actually click on the
"submit" button of a method=POST form do actually do a post.

> I printed out the Headers:
> header[0]:User-Agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
> .NET CLR 1.1.4322)
> header[1]:Host=<host>:8080
> header[2]:Content-Length=110
> header[3]:Content-Type=application/x-www-form-urlencoded

Are these the headers your browser sent?  Or that HttpClient sent?

> The content length is exactly the right length for all my parameters and
> values, with a = between the name and value, and an & between each pair.
> The Method is a PostMethod, and my URI is correct. What the heck is going
> on? Is there another level of debugging I can turn on to help track this
> down?
> This is EXTREMELY frustrating! Why should it work for https and not for
> http? What could possible be the difference between the two?
> Here is the rest of the information I'm printing out:
> method=org.apache.commons.httpclient.methods.PostMethod
> URI=http://<host>:8080/<app>/
> path=/<app>/
> query=null
> reason=Method not allowed
> status=405, Method not allowed
> location=null
> contentType=Content-Type: text/html
> All of this is identical for the https situation except for the URI, which
> says https and has no port specified.

Yeah, that doesn't make sense.  Another angle to try and learn more
information is to try "telnetting" to your HTTP server and just typing
in the headers and content manually:

telnet <host> 8080
POST /<app>/ HTTP/1.1
host: <host>




Julius Davies

To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

View raw message