hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Johnson <e...@tibco.com>
Subject Re: [PATCH] close on input streams handled properly - redux
Date Thu, 05 Dec 2002 15:06:41 GMT
Ryan Hoegg wrote:
Small informal spelling patch:

- insureConnectionRelease()
+ ensureConnectionRelease()



I hate it when I do that!  I have adjusted the spelling, insure --> ensure.

Michael Becke wrote:
I believe it is possible for _readResponseBody() to return a non null 
stream that is just the socket inputStream without any wrappers.  Below 
is the case I'm referring to:

        } else if(canResponseHaveBody(statusLine.getStatusCode())
                && !getName().equals(ConnectMethod.NAME)){
            result = is;


Can someone correct me if I'm wrong, but shouldn't this response be 
wrapped in an AutoCloseInputStream?  That is to say, the only way to 
determine the end of the response is to look for the last sent data, 
which will occur only when the socket is being closed, and thus the 
connection should be closed?

On further review, I suspect my latest changes will handle proxied 
connections incorrectly.  Alas, there are apparently no test cases for 
these, and I am unfamiliar with how they work.  If I read section 5.3 of 
RFC 2817 correctly, and understand all else properly the above code 
should change to this:

        } else if(canResponseHaveBody(statusLine.getStatusCode()) ) {
            if (getName().equals(ConnectMethod.NAME) ) {
                // this stream will not be used by the ConnectMethod, 
but returning non-null
                // insures that the connection will not be released to 
the connection manager
                // when execute finishes, and the subsequent call to 
execute on the proxied
                // method will work on the same connection.
                return is;
            else {
                // when the end of the stream is encountered, the 
connection should be closed.
                return new AutoCloseInputStream(is, m_responseWatcher);

It is, of course, a tad ugly that there should be method specific code 
here.  I would hope, rather, that the ConnectMethod() would override a 
well documented function to do the right thing.  Perhaps something for 
another day, or for someone else!

Have I got everything?

I apologize to the group that my submissions have been less than 
perfect, and appreciate your assistance in helping me work through these 


View raw message