Not possible to set socket lingering on with a socket linger time of 0
----------------------------------------------------------------------

                 Key: HTTPCLIENT-599
                 URL: http://issues.apache.org/jira/browse/HTTPCLIENT-599
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 3.0.1
         Environment: Windows XP, Sun JVM 1.5.0_07
            Reporter: Neil Ferguson


In version 3.0.1 of the Commons HTTP Client it is not possible to set socket 
lingering on, but with a socket linger time of 0. This may not appear to make 
much sense, but (certainly with the Sun JVM) this is used to force abortive 
connection release (see: 
http://java.sun.com/j2se/1.5.0/docs/guide/net/articles/connection_release.html).
 

In the org.apache.commons.httpclient.HttpConnection.open() method the following 
code is what prevents this:

if (linger > 0) {
    socket.setSoLinger(linger > 0, linger);
}

I have changed this to:

if (linger >= 0) {
    socket.setSoLinger(linger >= 0, linger);
}

However this changes the meaning of the http.socket.linger parameter, so this 
may not be the preferred solution. Perhaps turning socket lingering on and off 
needs to be configured independently of the socket linger time.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to