[
https://issues.apache.org/jira/browse/HTTPCLIENT-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286750#comment-13286750
]
Jon Moore commented on HTTPCLIENT-1198:
---------------------------------------
Ok, I'm looking into this now, and fixing this should be straightforward, once
we can agree on the behavior. I think, for a cache miss, the CachingHttpClient
should just let the underlying HttpClient take care of setting all the context
variables. For a pure cache hit, I think we want:
HTTP_TARGET_HOST : taken from the incoming request
HTTP_CONNECTION : not set
HTTP_PROXY_HOST : not set
HTTP_REQ_SENT : set to true once we know we're going to return a cached
response (?)
HTTP_REQUEST : incoming request
HTTP_RESPONSE : set to the response generated by the cache
The only muddy part for me is what to do for a cache validation, where I have a
stale entry but am sending a conditional request to validate. I think this is
exactly as above, except:
HTTP_REQ_SENT : set by underlying client once conditional request has been sent
HTTP_REQUEST : validation request, set by underlying client
HTTP_RESPONSE : actual origin response (possibly a 304), set by underlying
client
The other options for request/response are to use the incoming request to the
cache and the validated cache response, but my inclination is that we should
set these to the actual requests and responses issued to/from the origin
server. However, I could see good arguments either way. Thoughts?
> HttpHost is not set in HttpContext in CachingHttpClient
> -------------------------------------------------------
>
> Key: HTTPCLIENT-1198
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1198
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: Cache, HttpClient
> Affects Versions: 4.1.3, 4.2 Final
> Reporter: Ilirjan Papa
> Assignee: Jon Moore
>
> The HttpHost cames back as null, causing a NullPointerException when using
> CachingHttpClient.
> HttpHost actualHost =
> (HttpHost)requestContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
> The host should be set in the HttpContext.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]