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

Heuristic caching does not work for URIs with a query string

    XMLWordPrintableJSON

Details

    Description

      When enabling heuristic caching and setting a default lifetime, the responses from the server I am requesting from are not being stored in the cache.

      In org.apache.http.impl.client.cache.ResponseCachingPolicy, line 250 determines if the URI contains a query string:

      request.getRequestLine().getUri().contains("?")
      

      A few lines below, it then checks to see if the response contains cache headers:

      else if (!isExplicitlyCacheable(response))
      

      As I am attempting to cache a response that I know does not contain cache headers, the response should succeed in being cached. However, it fails the isExplictlyCachable() check, and thus returns false to the overall isResponseCachable() method. The isExplicitlyCachable() method is checked later on in the stack, so perhaps it can be safely removed here?

      Attachments

        Activity

          People

            Unassigned Unassigned
            chalford Charlie Halford
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: