hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: receiveResponseHeader() halting
Date Wed, 13 May 2009 13:18:12 GMT
On Wed, May 13, 2009 at 03:13:06PM +0200, Alexander M??ller wrote:
> >>> On 13.05.2009 at 14:50, in message <20090513125036.GA2363@ok2cons2.nine.ch>,
Oleg Kalnichevski <olegk@apache.org> wrote:
> > 
> > Most likely the AbstractSessionInputBuffer#fillBuffer() blocks because the
> > server is expecting more input and therefore not sending any response back.
> > This is the reason why I suspected either Content-Length or Transfer-Encoding
> > request headers to be wrong due to incorrect handling of the hop-by-hop
> > headers. 
> 
> I am using a GET request, so there are no such headers. Basically I am getting the same
result with this code
> 
>   HttpRequest req=new BasicHttpRequest("GET", "/");
> 
>   Socket socket=new Socket("localhost", 80);
> 
>   DefaultHttpClientConnection con=new DefaultHttpClientConnection();
>   con.bind(socket, new BasicHttpParams());
>   con.sendRequestHeader(req);
>   con.receiveResponseHeader();
> 
> 
> Once I replace sendRequestHeader() with
> 
>   socket.getOutputStream().write("GET / HTTP/1.0\r\n\r\n".getBytes());
> 
> it works.
> 
> So what could be missing?
> 
> 

Protocol version, for instance. HttpCore uses HTTP/1.1 per default.

Oleg

> > 
> > There is no black magic inside HttpRequestExecutor. It merely implements
> > client-side HTTP protocol handling logic on top of the basic
> > HttpClientConnection transport. See for yourself:
> > 
> > http://hc.apache.org/httpcomponents-core/httpcore/xref/org/apache/http/protoc 
> > ol/HttpRequestExecutor.html
> > 
> > What is the reason for your unwillingness to use HttpRequestExecutor?
> 
> What would be the advantage of it over sendRequestHeader() and receiveResponseHeader(),
in particular with a Reverse Proxy where one basically only tunnels through status codes?
> 
> Apart from context parameters the sending processe seems to be rather similar, I might
debug it through the receiving to see what might differs.
> 
> 
> Thanks again Oleg,
> Alexander
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 

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


Mime
View raw message