You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Slavik Markovich <Sl...@orange.co.il> on 2003/04/21 14:57:52 UTC

Buffered output to socket

Hi all,

This is probably a known issue (but I haven't found the answer for it yet).
I'm using httpclient to post data to a remote server but as far as I can see (using ethereal) the client is writing every line to the wire without buffering.
After examining the code, I can see that the HttpConnection class is using the output stream received from the socket directly.
Is there a reason for the direct writing?
This is a problem for me 'cause the remote server sets a very low timeout and returns a bad request response after receiving the request line (without any other header line or request body).

Can I easily add a buffered behavior to the http client?

10x



----------------------------------------------------------------------------------------------------------------
This message contains information that may be confidential or privileged.
If you are not the intended recipient, you may not use, copy or disclose
to anyone any of the information in this message. If you have received
this message and are not the intended recipient, kindly notify the sender
and delete this message from your computer.


Re: Buffered output to socket

Posted by Oleg Kalnichevski <o....@dplanet.ch>.
Slavik,
What may be the reasons for output buffering other than working around
some weird timeout settings? 

The HttpConnection class can be easily tweaked to perform output
buffering. However, I (personally) see no compelling reasons for folding
such modifications into the main code tree. 

The problem can be cleanly solved by turning HttpConnection into an
interface, which would allow for extending standard HTTP connection
behavior without having to fork HttpClient. Such a radical change cannot
take place before 2.0 release, though. It may take a while until we get
there. If you are not willing (or can't) simply change your HTTP server
settings to something saner, you'll have to maintain your own HttpClient
fork

Folks, any different opinions on the issue? 

Oleg   



On Mon, 2003-04-21 at 14:57, Slavik Markovich wrote:
> Hi all,
> 
> This is probably a known issue (but I haven't found the answer for it yet).
> I'm using httpclient to post data to a remote server but as far as I can see (using ethereal) the client is writing every line to the wire without buffering.
> After examining the code, I can see that the HttpConnection class is using the output stream received from the socket directly.
> Is there a reason for the direct writing?
> This is a problem for me 'cause the remote server sets a very low timeout and returns a bad request response after receiving the request line (without any other header line or request body).
> 
> Can I easily add a buffered behavior to the http client?
> 
> 10x
> 
> 
> 
> ----------------------------------------------------------------------------------------------------------------
> This message contains information that may be confidential or privileged.
> If you are not the intended recipient, you may not use, copy or disclose
> to anyone any of the information in this message. If you have received
> this message and are not the intended recipient, kindly notify the sender
> and delete this message from your computer.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>