> i think i've found a problem in HttpClient that may be related to
> problems in the test case (TestMethods.java) with the java.sun.com url.
>
> i was having the same problems with hitting an apache web server on my
> local machine as i saw when trying to hit the java.sun.com url, which is
> why i starting digging through the code.
>
> anyway, the problem i found is HttpClient is determining whether or not
> to shutdown the socket's output by checking whether or not http 1.1. is
> being used, but it's checking to see if http 1.1 is being used before
> parsing the status line from the response, which tells the client
> whether http 1.1 should be used or not.  so, after it has shutdown the
> socket's output, then it tries to read the response.  this is what
> seemed to be causing my problems.
>
> i'm not so sure i've explained this very well, so here's a step by step
> of what is happening:
>
> 1) send request to server
> 2) look at http11 flag (default is false) to see if socket's output
> should be closed
> 3) if !http11, close output
> 4) read status line, which sets http11 flag.
>
> i changed it so that 4) happens right after 1), and my problems appeared
> to go away.  also, i could use the java.sun.com url in the test.
>
> attached is a patch.

That patch won't work except if you're talking to an HTTP/1.1 server.
An HTTP/1.0 server will wait until you close half of the connection before
sending a response, at least in that particular case.

I think it's always a good idea to start with an OPTIONS /.

Note : I don't get any failures with the TestMethods tests.

Remy

Reply via email to