// request to origin was aborted
if (EBIT_TEST(http->storeEntry()->flags, ENTRY_ABORTED)) {
debugs(88, 3, "handleIMSReply: request to origin aborted '" << http->storeEntry()->url() << "', sending old entry to client" );
- http->logType = LOG_TCP_REFRESH_FAIL;
+ http->logType = LOG_TCP_REFRESH_FAIL_OLD;
sendClientOldEntry();
}
}
// origin replied with an error
- else {
+ else if (http->request->flags.fail_on_validation_err) {
+ http->logType = LOG_TCP_REFRESH_FAIL_ERR;
+ debugs(88, 3, "handleIMSReply: origin replied with error " << status <<
+ ", forwarding to client due to fail_on_validation_err");
+ sendClientUpstreamResponse();
+ } else {
// ignore and let client have old entry
- http->logType = LOG_TCP_REFRESH_FAIL;
+ http->logType = LOG_TCP_REFRESH_FAIL_OLD;
debugs(88, 3, "handleIMSReply: origin replied with error " <<
status << ", sending old entry (" << old_rep->sline.status << ") to client");
sendClientOldEntry();
LOG_TCP_HIT,
LOG_TCP_MISS,
LOG_TCP_REFRESH_UNMODIFIED, // refresh from origin revalidated existing entry
- LOG_TCP_REFRESH_FAIL, // refresh from origin failed
+ LOG_TCP_REFRESH_FAIL_OLD, // refresh from origin failed, stale reply sent
+ LOG_TCP_REFRESH_FAIL_ERR, // refresh from origin failed, error forwarded
LOG_TCP_REFRESH_MODIFIED, // refresh from origin replaced existing entry
LOG_TCP_CLIENT_REFRESH_MISS,
LOG_TCP_IMS_HIT,
no_cache:
if (!ignoreCacheControl && rep->cache_control) {
- if (EBIT_TEST(rep->cache_control->mask, CC_PROXY_REVALIDATE))
- EBIT_SET(entry->flags, ENTRY_REVALIDATE);
- else if (EBIT_TEST(rep->cache_control->mask, CC_MUST_REVALIDATE))
+ if (EBIT_TEST(rep->cache_control->mask, CC_PROXY_REVALIDATE) ||
+ EBIT_TEST(rep->cache_control->mask, CC_MUST_REVALIDATE) ||
+ EBIT_TEST(rep->cache_control->mask, CC_S_MAXAGE))
EBIT_SET(entry->flags, ENTRY_REVALIDATE);
}
"TCP_HIT",
"TCP_MISS",
"TCP_REFRESH_UNMODIFIED",
- "TCP_REFRESH_FAIL",
+ "TCP_REFRESH_FAIL", // same tag logged for LOG_TCP_REFRESH_FAIL_OLD and
+ "TCP_REFRESH_FAIL", // LOG_TCP_REFRESH_FAIL_ERR for backward-compatibility
"TCP_REFRESH_MODIFIED",
"TCP_CLIENT_REFRESH_MISS",
"TCP_IMS_HIT",
if (code == LOG_TCP_IMS_HIT)
return 1;
- if (code == LOG_TCP_REFRESH_FAIL)
+ if (code == LOG_TCP_REFRESH_FAIL_OLD)
return 1;
if (code == LOG_TCP_REFRESH_UNMODIFIED)
#endif
) {
debugs(22, 3, "refreshCheck: YES: Must revalidate stale response");
+ request->flags.fail_on_validation_err = 1;
return STALE_MUST_REVALIDATE;
}
struct request_flags {
- request_flags(): range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),ignore_cc(0),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),chunked_reply(0),stream_error(0),destinationIPLookedUp_(0) {
+ request_flags(): range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),fail_on_validation_err(0),accelerated(0),ignore_cc(0),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),chunked_reply(0),stream_error(0),destinationIPLookedUp_(0) {
#if USE_HTTP_VIOLATIONS
nocache_hack = 0;
#endif
unsigned int refresh:1;
unsigned int redirected:1;
unsigned int need_validation:1;
+ unsigned int fail_on_validation_err:1; ///< whether we should fail if validation fails
#if USE_HTTP_VIOLATIONS
unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */
#endif