hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wang, Xinju" <wan...@ugs.com>
Subject RE: Weblogic returns response after the headers are written
Date Sat, 05 Feb 2005 23:02:46 GMT
Oleg,

Thanks for your prompt reply! I was looking into 2.0's documents so I
never saw this.

To answer your question, I didn't set the content length myself. It's
set by my base class HttpRequestBodyMethodBase. I just call
setRequestBody(String) to set the body.

I did some more debugging. The server is sending back a 401 right after
all the headers are received. When the request body is flushed next,
Weblogic thinks it's a whole new request but it's only XML request body.
A 404 is sent back and the connection is closed. Tomcat and WebSphere
will ignore the request body safely.

While this is more like a Weblogic problem, I'm wondering if
HttpMethodBase.writeRequest should check the response status code after
flushing headers. By doing this, it doesn't have to send the request
body if the server already send a final response like 401. This is
mentioned in HTTP 1.1 spec section 8.2.3.

Thanks,
Xinju
 

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Saturday, February 05, 2005 3:23 AM
To: HttpClient Project
Subject: Re: Weblogic returns response after the headers are written

Xinju,

The reason for flushing headers prior to sending the request body is the
so called 'expect: continue' handshake. For details see

http://jakarta.apache.org/commons/httpclient/3.0/performance.html#Expect
-continue%20handshake

Do you correctly set the value of the 'content-length' request header?

Oleg


On Fri, 2005-02-04 at 20:12 -0600, Wang, Xinju wrote:
> Hi,
> 
> I'm using HttpClient 2.0.2 on WindowsXP with Sun JDK 1.4.2_02. I 
> extends HttpRequestBodyMethodBase to create my custom HTTP method with
a body.
> When I send my request to Weblogic 7.1 or 8.1, Weblogic sends me 
> response right after the headers are written. When the request body is

> sent next, Weblogic returns a 404 since it's not a valid URL.
> 
> I stepped into HttpMethodBase.writeRequest(HttpState state, 
> HttpConnection conn). The headers are written first:
>         writeRequestLine(state, conn);
>         writeRequestHeaders(state, conn);
>         conn.writeLine(); // close head
>         // make sure the status line and headers have been sent
>         conn.flushRequestOutputStream();
> 		......
> 
> Reqeust body is written later:
>         writeRequestBody(state, conn);
>         // make sure the entire request body has been sent
>         conn.flushRequestOutputStream();
> 
> I find out that if I comment out the first 
> conn.flushRequestOutputStream(), I get correct response every time. 
> This might very well be a Weblogic problem. I'm trying to understand 
> why Weblogic considers the request is done when the stream is flushed 
> and why the stream needs to be flushed twice.
> 
> Thank you,
> Xinju
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> httpclient-dev-help@jakarta.apache.org
> 


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


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


Mime
View raw message