You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Joshua Spiewak <js...@gmail.com> on 2012/06/06 22:01:20 UTC

Response Cacheability & non-recognized status codes

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

Re: Response Cacheability & non-recognized status codes

Posted by Joshua Spiewak <js...@gmail.com>.
Thanks!
https://issues.apache.org/jira/browse/HTTPCLIENT-1202

    -- Josh


On Wed, Jun 6, 2012 at 4:08 PM, Jon Moore <jo...@apache.org> wrote:

> 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 <js...@gmail.com> 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
> >
>

Re: Response Cacheability & non-recognized status codes

Posted by Jon Moore <jo...@apache.org>.
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 <js...@gmail.com> 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
>