Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-599

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.0.1
    • Fix Version/s: 4.0 Alpha 2
    • Component/s: HttpClient (classic)
    • Labels:
      None
    • Environment:
      Windows XP, Sun JVM 1.5.0_07

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              neilf Neil Ferguson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: