You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Jonathan Moore (JIRA)" <ji...@apache.org> on 2010/09/08 21:35:33 UTC
[jira] Created: (HTTPCLIENT-992) cache should not generate stale
responses to requests explicitly requesting first-hand or fresh ones
cache should not generate stale responses to requests explicitly requesting first-hand or fresh ones
----------------------------------------------------------------------------------------------------
Key: HTTPCLIENT-992
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-992
Project: HttpComponents HttpClient
Issue Type: Improvement
Components: Cache
Affects Versions: 4.1 Alpha2
Reporter: Jonathan Moore
The current implementation will serve a stale response in the case that it has a stale cache entry but revalidation with the origin fails. However, the RFC says we SHOULD NOT do this if the client explicitly requested a first-hand or fresh response (via no-cache, max-age, max-stale, or min-fresh).
--
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
[jira] Updated: (HTTPCLIENT-992) cache should not generate stale
responses to requests explicitly requesting first-hand or fresh ones
Posted by "Jonathan Moore (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Moore updated HTTPCLIENT-992:
--------------------------------------
Attachment: stale-response-to-explicit-request-optionB.patch
I've attached a patch that implements option (b) above if so desired.
This patch is contributed to the ASF with the permission of my employer.
> cache should not generate stale responses to requests explicitly requesting first-hand or fresh ones
> ----------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-992
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-992
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: Cache
> Affects Versions: 4.1 Alpha2
> Reporter: Jonathan Moore
> Attachments: stale-response-to-explicit-request-optionB.patch, stale-responses-to-explicit-requests.patch
>
>
> The current implementation will serve a stale response in the case that it has a stale cache entry but revalidation with the origin fails. However, the RFC says we SHOULD NOT do this if the client explicitly requested a first-hand or fresh response (via no-cache, max-age, max-stale, or min-fresh).
--
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
[jira] Commented: (HTTPCLIENT-992) cache should not generate stale
responses to requests explicitly requesting first-hand or fresh ones
Posted by "Jonathan Moore (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907377#action_12907377 ]
Jonathan Moore commented on HTTPCLIENT-992:
-------------------------------------------
By the way, here was something I could use a little input on, behavior-wise:
Suppose we have a cache entry dated 10 seconds ago with 'Cache-Control: max-age=5'. This is now 5 seconds stale and has an age of 10 seconds. If a client asks for this entry with 'Cache-Control: max-age=20', what should we do, if the revalidation with the origin fails?
(a) return the stale cache entry, as the overall age of the request is less than the max-age requested
(b) return a 504 (Gateway Timeout), since max-age on a request assumes the cache entry is still fresh and just tightens the freshness constraints; if the client was ok with a stale entry they would have used 'max-stale' instead
The current patch does (a), preferring to returning a stale entry over a 504 error, but I am actually leaning a little towards (b) now. I think 'max-age' on a request means "I want a *fresh* response no older than this".
> cache should not generate stale responses to requests explicitly requesting first-hand or fresh ones
> ----------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-992
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-992
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: Cache
> Affects Versions: 4.1 Alpha2
> Reporter: Jonathan Moore
> Attachments: stale-responses-to-explicit-requests.patch
>
>
> The current implementation will serve a stale response in the case that it has a stale cache entry but revalidation with the origin fails. However, the RFC says we SHOULD NOT do this if the client explicitly requested a first-hand or fresh response (via no-cache, max-age, max-stale, or min-fresh).
--
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
[jira] Updated: (HTTPCLIENT-992) cache should not generate stale
responses to requests explicitly requesting first-hand or fresh ones
Posted by "Jonathan Moore (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan Moore updated HTTPCLIENT-992:
--------------------------------------
Attachment: stale-responses-to-explicit-requests.patch
The attached patch addresses this issue by either propagating the IOException (for no-cache requests) or by generating a 504 (Gateway Timeout) error.
This patch is contributed to the ASF with the permission of my employer.
> cache should not generate stale responses to requests explicitly requesting first-hand or fresh ones
> ----------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-992
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-992
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: Cache
> Affects Versions: 4.1 Alpha2
> Reporter: Jonathan Moore
> Attachments: stale-responses-to-explicit-requests.patch
>
>
> The current implementation will serve a stale response in the case that it has a stale cache entry but revalidation with the origin fails. However, the RFC says we SHOULD NOT do this if the client explicitly requested a first-hand or fresh response (via no-cache, max-age, max-stale, or min-fresh).
--
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
[jira] Commented: (HTTPCLIENT-992) cache should not generate stale
responses to requests explicitly requesting first-hand or fresh ones
Posted by "Jonathan Moore (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907404#action_12907404 ]
Jonathan Moore commented on HTTPCLIENT-992:
-------------------------------------------
Answered my own question by reading the RFC:
"max-age
Indicates that the client is willing to accept a response whose age is no greater than the specified time in seconds. Unless max- stale directive is also included, the client is not willing to accept a stale response."
So option (b) is actually the correct behavior here.
> cache should not generate stale responses to requests explicitly requesting first-hand or fresh ones
> ----------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-992
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-992
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: Cache
> Affects Versions: 4.1 Alpha2
> Reporter: Jonathan Moore
> Attachments: stale-response-to-explicit-request-optionB.patch, stale-responses-to-explicit-requests.patch
>
>
> The current implementation will serve a stale response in the case that it has a stale cache entry but revalidation with the origin fails. However, the RFC says we SHOULD NOT do this if the client explicitly requested a first-hand or fresh response (via no-cache, max-age, max-stale, or min-fresh).
--
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
[jira] Resolved: (HTTPCLIENT-992) cache should not generate stale
responses to requests explicitly requesting first-hand or fresh ones
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCLIENT-992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCLIENT-992.
------------------------------------------
Fix Version/s: 4.1 Alpha3
Resolution: Fixed
Committed option B.
Oleg
> cache should not generate stale responses to requests explicitly requesting first-hand or fresh ones
> ----------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-992
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-992
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: Cache
> Affects Versions: 4.1 Alpha2
> Reporter: Jonathan Moore
> Fix For: 4.1 Alpha3
>
> Attachments: stale-response-to-explicit-request-optionB.patch, stale-responses-to-explicit-requests.patch
>
>
> The current implementation will serve a stale response in the case that it has a stale cache entry but revalidation with the origin fails. However, the RFC says we SHOULD NOT do this if the client explicitly requested a first-hand or fresh response (via no-cache, max-age, max-stale, or min-fresh).
--
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