hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <o.kalnichev...@dplanet.ch>
Subject [PATCH]: Minor bugs in the HttpConnection
Date Thu, 13 Feb 2003 22:44:57 GMT
Jeff, Mike, Odi

How about this for a starter?

Cheers

Oleg

PS: I'll be off-line for a few days (gonna be boarding in Davos)   


On Thu, 2003-02-13 at 20:58, Jeffrey Dever wrote:
> >
> >
> >
> >Firstly, there's end of stream check missing, but it's just a minor bug
> >
> >    ch = inputStream.read();
> >    if (ch == -1) {
> >      break;
> >    }
> >    if (ch == '\n') {
> >      break;
> >    } else {
> >      buf.append('\r');
> >    }
> >  
> >
> Deja vu.  Didn't I already fix that in HttpConnection, which now reads:
>          int ch = inputStream.read();
>         while (ch >= 0) {
>             if (ch == '\r') {
>                 ch = inputStream.read();
>                 if (ch == '\n') {
>                     break;
>                 } else {
>                     buf.append('\r');
>                 }
>             }
>             buf.append((char) ch);
>             ch = inputStream.read();
>         }
> 
> >Secondly, I am a bit unhappy with this line
> >
> >  buf.append((char) ch);
> >
> You are right.  We should be using a byte[] here as the buffer instead 
> of a StringBuffer.   Then call the correct string conversion routine as 
> you stated.  This is only buffering one line of headers here, so its 
> good from a performance perspective.
> 
> >Bottom line. Let's tackle problems step by step through a series of
> >small patches and if we see that wire logging cannot be made
> >comprehensive, so be it.
> >
> >Personally I am a strong believer in making things work 100% or not
> >making them at all. I'd rather remove wire logging all together, or
> >restrict it to exclusively dealing with request/response headers, rather
> >than having it occasionally spit out some bits and pieces. 
> >  
> >
> Like I said, if we split the wire logging responsibilities into headers 
> and bodies, I think that we could be a lot more flexible.  Lets face it, 
> the information in a header is completely different than the data in a 
> body, including the content encoding.  HttpClient already handles these 
> sperately by reading the headers completely, and then passing the body 
> to the client as an output stream.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
> 

Mime
View raw message