hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Dever <jsde...@sympatico.ca>
Subject Re: Of Wire logging, of Men and the God ;-)
Date Thu, 13 Feb 2003 19:58:41 GMT
>
>
>
>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.


Mime
View raw message