HttpComponents HttpClient
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1155

CachingHttpClient should have similar behavior as AbstractHttpClient when executing with ResponseHandler

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2, 4.2 Beta1
    • Fix Version/s: 4.1.3, 4.2 Beta1
    • Component/s: HttpCache
    • Labels:

      Description

      When calling execute on the AbstractHttpClient with a ResponseHandler, the AbstractHttpClient will attempt to Consume the Entity and close any open connections before returning. This behavior is not currently in the CachingHttpClient.

      This can lead to connection leaks when switching to CachingHttpClient, becuase the responsibility to fully consume the entity is now on the ResponseHandler instead on the HttpClient.

      Here is the code that does the existing 'auto-close' behavior: "org.apache.http.impl.client.AbstractHttpClient.java" lines 1080-1111

        Activity

        James Miller created issue -
        Hide
        James Miller added a comment -

        Patch to add 'auto-consume' to cachinghttpclient

        Show
        James Miller added a comment - Patch to add 'auto-consume' to cachinghttpclient
        James Miller made changes -
        Field Original Value New Value
        Attachment httpclient-1155.patch [ 12508395 ]
        Oleg Kalnichevski committed 1222845 (4 files)
        Reviews: none

        HTTPCLIENT-1155: CachingHttpClient fails to ensure that the response content gets fully consumed when using a ResponseHandler, which can potentially lead to connection leaks
        Contributed by James Miller <jamesmiller01 at gmail dot com>

        Hide
        Oleg Kalnichevski added a comment -

        Patch committed to SVN trunk and 4.1.x branch. Many thanks for contributing it, James

        Oleg

        Show
        Oleg Kalnichevski added a comment - Patch committed to SVN trunk and 4.1.x branch. Many thanks for contributing it, James Oleg
        Oleg Kalnichevski made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 4.1.3 [ 12317840 ]
        Fix Version/s 4.2 Alpha2 [ 12318879 ]
        Resolution Fixed [ 1 ]
        Oleg Kalnichevski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            James Miller
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development