hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michajlo Matijkiw (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HTTPCLIENT-1003) Handle conditional requests in cache
Date Mon, 04 Oct 2010 19:27:37 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michajlo Matijkiw updated HTTPCLIENT-1003:
------------------------------------------

    Attachment: add_304s.patch

This patch adds the functionality to return 304s in response to conditional requests.

CachingHttpClient now decides whether or not to return a 304 based on whether or not a conditional
request was made and the present cache entry is valid.

HttpCache#updateCacheEntry() is changed to return a HttpCacheEntry instead of a HttpResponse.
 This approach seemed more natural, and allowed the logic for deciding if a 304 should be
returned to be contained within CachingHttpClient, instead of straddling multiple classes.
 It also allows conditional request logic to be independent of HttpCache implementation. 
The tests were updated to reflect this change.

The logic for conditional requests was updated in CachedResponseSuitabilityChecker to detect
more supported conditional requests and whether or not they pass.  These were made public
so they could be used to check against an updated cache entry from revalidation.

CachedHttpResponseGenerator#generateNotModifiedResponse() was created to generate 304 responses
from cache entries.  generateResponse() was also modified to skip the check if the cache entry
is a 304 since 304's are not cached in the module.\

Unit tests were added to verify the new functionality.  Also, I attempted to add some documentation
to reflect public facing changes.

This patch was created by myself and Mohammed Azeem Uddin and is submitted with the permission
of my employer.

Please let me know if there is anything that should be changed.

Thank you,
Michajlo



> Handle conditional requests in cache
> ------------------------------------
>
>                 Key: HTTPCLIENT-1003
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1003
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>            Reporter: Michajlo Matijkiw
>             Fix For: 4.1.0
>
>         Attachments: add_304s.patch
>
>
> Return 304 if incoming request has "If-None-Match" or "If-Modified-Since" headers and
can be served from cache.  Currently we return a 200 which is correct but not optimal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message