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

httpClient incorrectly closing tunnelled connection right after tunnell established

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0 Beta 1
    • 2.0 Beta 1
    • HttpClient (classic)
    • None
    • Operating System: other
      Platform: Other
    • 19286

    Description

      Description:

      We are using httpClient to go through a proxy server using https protocol.
      After getting the 200 from proxy server ("CONENCT" request), the tunnelled
      connection is opened. As httpClient is going to do the actual "POST", in
      checking the connection is open (inside HttpMethodBase.processRequest), the
      HttpConnection method is calling isStale (). The isStale () method is trying
      to read 1 byte as means of verifying the connection is still open, when no
      bytes returned (byteRead = -1), it sets isStale to true and cause the
      connection to be closed.

      The code fragment is:

      if (inputStream.available() == 0) {
      LOG.debug ("inputStream.available() == 0");
      try {
      socket.setSoTimeout(1);
      int byteRead = inputStream.read();
      if (byteRead == -1)

      { // again - if the socket is reporting all data read, // probably stale LOG.debug ("setting isStale to true due to byteRead = " + byteRead); isStale = true; }

      else

      { inputStream.unread(byteRead); }

      } finally

      { socket.setSoTimeout(soTimeout); }

      }

      The relavant trace/debug log is (I added some more logs):

      2003/04/24 14:20:04:109 CDT [TRACE] HttpMethod - -enter
      HttpMethodBase.processRequest(HttpState, HttpConnection)
      2003/04/24 14:20:04:109 CDT [TRACE] HttpMethod - -Attempt number 1 to process
      request
      2003/04/24 14:20:04:109 CDT [DEBUG] HttpConnection - -inputStream.available()
      == 0
      2003/04/24 14:20:04:109 CDT [DEBUG] HttpConnection - -setting isStale to true
      due to byteRead = -1
      2003/04/24 14:20:04:109 CDT [DEBUG] HttpConnection - -Connection is stale,
      closing...
      2003/04/24 14:20:04:109 CDT [TRACE] HttpConnection - -enter HttpConnection.close
      ()
      2003/04/24 14:20:04:109 CDT [TRACE] HttpConnection - -enter
      HttpConnection.closeSockedAndStreams()

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--jsse.patch
          0.7 kB
          Michael Becke
        2. ASF.LICENSE.NOT.GRANTED--ntlm6.http
          89 kB
          Bin Chen
        3. ASF.LICENSE.NOT.GRANTED--test14.http
          295 kB
          Bin Chen
        4. ASF.LICENSE.NOT.GRANTED--test14.txt
          82 kB
          Bin Chen
        5. ASF.LICENSE.NOT.GRANTED--test5.clean
          35 kB
          Bin Chen

        Activity

          People

            Unassigned Unassigned
            bin.chen@sabre-holdings.com Bin Chen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: