Hi Oleg,

I hear what you are saying. I think this can be accomplished in a different way though.

To ensure that the wire is always handed correctly we just need to be sure that HttpConnection inputStream and outputStream are never accessed directly. Instead they should only be used via getResponseInputStream() and getRequestOutputStream(). Below is an example from HttpConnection.readLine:

public String readLine() throws IOException, IllegalStateException {
LOG.trace("enter HttpConnection.readLine()");

assertOpen();
// using getResponseInputStream() will ensure that a wire stream is wrapped as necessary
return HttpParser.readLine(getResponseInputStream());
}

I think this accomplishes the same thing as what is there now. The same thing would go for all writes.

What do you think?

Mike

On Wednesday, February 12, 2003, at 02:16 AM, Oleg Kalnichevski wrote:

Hi Mike
This is exactly what I wanted to achieve. Here's the rationale

I believe that ideally only HttConnection should "know" how to read
bytes from and write to the underlying socket streams, how to convert
byte arrays to String and visa versa using HttpConstants, and how to
properly log incoming and outgoing data using WIRE_LOG.

The separation of header parsing logic into a helper class is a welcome
thing but it somehow has broken the above-stated concept. I attempted to
reconcile things by making HeaderParser use array of strings rather than
reading from a stream directly

I am perfectly aware that the patch which was intended to solve a very
specific problem with Multipart classes in fact evolved into a
monstrosity affecting every single important class in the HttClient

I am gong to commit Multipart related stuff as they represent only
incremental changes that nobody seems to object to, and resubmit wire
logging patch in a conciser, more comprehensible form

Cheers

Oleg


On Wed, 2003-02-12 at 05:15, Michael Becke wrote:
Hi Oleg,

I have not had a chance to look through the entire patch.  There is
quite a bit of code:)  So, I will just comment on the headers.

The modifications to the wire logging I made did not coexist well with
the changes introduced by your most recent patch. It's a bit of a
problem that response headers are now retrieved outside HttpConnection
class, which makes wire logging difficult.
Why is the HeaderParser no longer taking an input stream?  It seems
that the following code is doing the same thing as before, except that
the read line is happening outside of HeaderParser:

         ArrayList lines = new ArrayList();
         for (; ;) {
             String line = HttpConnection.readLine(in);
             if ((line == null) || (line.length() < 1)) {
                 break;
             }
             lines.add(line);
         }
         Header[] footers = HeaderParser.parseHeaders(
           (String[])lines.toArray(new String[lines.size()]));


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to