Hi Josh,

I think, actually, you've found a bug, based on a quick review of the code.
Could you please open a JIRA issue for this?

https://issues.apache.org/jira/browse/HTTPCLIENT

Thanks,
Jon

On Wed, Jun 6, 2012 at 4:01 PM, Joshua Spiewak <[email protected]> wrote:

> Hi all,
>
> I'd like to be able to use CachingHttpClient to cache 204 and 404
> responses.
>
> From my reading of rfc2616 section 13.4 [0], I see a list of response codes
> that MAY be stored. These correspond to the codes that
> ResponseCachingPolicy checks. However, the last paragraph of the section
> states that other status codes MUST NOT be returned *unless* there are
> cache-control directives. In my case, I am setting Cache-Control:
> max-age=xxxx and as such I would expect the response to be cached.
>
> The return statement of ResponseCachingPolicy.isResponseCacheable looks
> like it was meant to take into account explicit cache control directives,
> but I think that return is only ever reached when cacheable is set to true,
> and is essentially not used.
>
> Would it be possible to enhance ResponseCachingPolicy to handle this? If
> not, would it be possible to make the choice of response caching policy
> configurable/extensible/pluggable?
>
> Thanks!
>
>    -- Josh
>
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4
>

Reply via email to