refresh.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 22 Refresh Calculation */
10 
11 #ifndef USE_POSIX_REGEX
12 #define USE_POSIX_REGEX /* put before includes; always use POSIX */
13 #endif
14 
15 #include "squid.h"
16 #include "HttpHdrCc.h"
17 #include "HttpReply.h"
18 #include "HttpRequest.h"
19 #include "MemObject.h"
20 #include "mgr/Registration.h"
21 #include "RefreshPattern.h"
22 #include "SquidConfig.h"
23 #include "SquidTime.h"
24 #include "Store.h"
25 #include "URL.h"
26 #include "util.h"
27 
28 typedef enum {
31 #if USE_HTCP
33 #endif
34 #if USE_CACHE_DIGESTS
36 #endif
40 
44 typedef struct {
45  bool expires;
46  bool min;
47  bool lmfactor;
48  bool max;
49 } stale_flags;
50 
51 /*
52  * This enumerated list assigns specific values, ala HTTP/FTP status
53  * codes. All Fresh codes are in the range 100-199 and all stale
54  * codes are 200-299. We might want to use these codes in logging,
55  * so best to keep them consistent over time.
56  */
57 enum {
74 };
75 
76 static struct RefreshCounts {
77  const char *proto;
78  int total;
81 
82 static const RefreshPattern *refreshUncompiledPattern(const char *);
84 static int refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const RefreshPattern * R, stale_flags * sf);
85 
86 static RefreshPattern DefaultRefresh("<none>", 0);
87 
92 const RefreshPattern *
93 refreshLimits(const char *url)
94 {
95  for (auto R = Config.Refresh; R; R = R->next) {
96  ++(R->stats.matchTests);
97  if (R->pattern.match(url)) {
98  ++(R->stats.matchCount);
99  return R;
100  }
101  }
102 
103  return nullptr;
104 }
105 
114 static const RefreshPattern *
115 refreshUncompiledPattern(const char *pat)
116 {
117  for (auto R = Config.Refresh; R; R = R->next) {
118  if (0 == strcmp(R->pattern.c_str(), pat))
119  return R;
120  }
121 
122  return nullptr;
123 }
124 
146 static int
147 refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const RefreshPattern * R, stale_flags * sf)
148 {
149  // 1. If the cached object has an explicit expiration time, then we rely on this and
150  // completely ignore the Min, Percent and Max values in the refresh_pattern.
151  if (entry->expires > -1) {
152  sf->expires = true;
153 
154  if (entry->expires > check_time) {
155  debugs(22, 3, "FRESH: expires " << entry->expires <<
156  " >= check_time " << check_time << " ");
157 
158  return -1;
159  } else {
160  debugs(22, 3, "STALE: expires " << entry->expires <<
161  " < check_time " << check_time << " ");
162 
163  return (check_time - entry->expires);
164  }
165  }
166 
167  debugs(22, 3, "No explicit expiry given, using heuristics to determine freshness");
168 
169  // 2. If the entry is older than the maximum age in the refresh_pattern, it is STALE.
170  if (age > R->max) {
171  debugs(22, 3, "STALE: age " << age << " > max " << R->max << " ");
172  sf->max = true;
173  return (age - R->max);
174  }
175 
176  // 3. If there is a Last-Modified header, try the last-modified factor algorithm.
177  const time_t lastmod_delta = entry->timestamp - entry->lastModified();
178  if (lastmod_delta > 0) {
179  /* stale_age is the age of the response when it became/becomes stale according to
180  * the last-modified factor algorithm. It's how long we can consider the response
181  * fresh from the time we cached it.
182  */
183  time_t stale_age = static_cast<time_t>(lastmod_delta * R->pct);
184 
185  debugs(22,3, "Last modified " << lastmod_delta << " sec before we cached it, L-M factor " <<
186  (100.0 * R->pct) << "% = " << stale_age << " sec freshness lifetime");
187  sf->lmfactor = true;
188 
189  if (age >= stale_age) {
190  debugs(22, 3, "STALE: age " << age << " > stale_age " << stale_age);
191  return (age - stale_age);
192  } else {
193  debugs(22, 3, "FRESH: age " << age << " <= stale_age " << stale_age);
194  return -1;
195  }
196  }
197 
198  // 4. If the entry is not as old as the minimum age in the refresh_pattern, it is FRESH.
199  if (age < R->min) {
200  debugs(22, 3, "FRESH: age (" << age << " sec) is less than configured minimum (" << R->min << " sec)");
201  sf->min = true;
202  return -1;
203  }
204 
205  // 5. default is stale, by the amount we missed the minimum by
206  debugs(22, 3, "STALE: No explicit expiry, no last modified, and older than configured minimum.");
207  return (age - R->min);
208 }
209 
264 static int
265 refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
266 {
267  time_t age = 0;
268  time_t check_time = squid_curtime + delta;
269  int staleness;
270  stale_flags sf;
271 
272  // get the URL of this entry, if there is one
273  static const SBuf nilUri("<none>");
274  SBuf uri = nilUri;
275  if (entry->mem_obj)
276  uri = entry->mem_obj->storeId();
277  else if (request)
278  uri = request->effectiveRequestUri();
279 
280  debugs(22, 3, "checking freshness of URI: " << uri);
281 
282  // age is not necessarily the age now, but the age at the given check_time
283  if (check_time > entry->timestamp)
284  age = check_time - entry->timestamp;
285 
286  // FIXME: what to do when age < 0 or counter overflow?
287  assert(age >= 0);
288 
289  /* We need a refresh rule. In order of preference:
290  *
291  * 1. the rule that matches this URI by regex
292  * 2. the "." rule from the config file
293  * 3. the default "." rule
294  */
295  // XXX: performance regression. c_str() reallocates
296  const RefreshPattern *R = (uri != nilUri) ? refreshLimits(uri.c_str()) : refreshUncompiledPattern(".");
297  if (NULL == R)
298  R = &DefaultRefresh;
299 
300  debugs(22, 3, "Matched '" << R->pattern.c_str() << " " <<
301  (int) R->min << " " << (int) (100.0 * R->pct) << "%% " <<
302  (int) R->max << "'");
303 
304  debugs(22, 3, "\tage:\t" << age);
305 
306  debugs(22, 3, "\tcheck_time:\t" << mkrfc1123(check_time));
307 
308  debugs(22, 3, "\tentry->timestamp:\t" << mkrfc1123(entry->timestamp));
309 
310  if (request && !request->flags.ignoreCc) {
311  const HttpHdrCc *const cc = request->cache_control;
312  int minFresh = -1;
313  if (cc && cc->hasMinFresh(&minFresh)) {
314  debugs(22, 3, "\tage + min-fresh:\t" << age << " + " <<
315  minFresh << " = " << age + minFresh);
316  debugs(22, 3, "\tcheck_time + min-fresh:\t" << check_time << " + "
317  << minFresh << " = " <<
318  mkrfc1123(check_time + minFresh));
319  age += minFresh;
320  check_time += minFresh;
321  }
322  }
323 
324  memset(&sf, '\0', sizeof(sf));
325 
326  staleness = refreshStaleness(entry, check_time, age, R, &sf);
327 
328  debugs(22, 3, "Staleness = " << staleness);
329 
330  const HttpReplyPointer reply(entry->mem_obj && entry->mem_obj->getReply() ? entry->mem_obj->getReply() : nullptr);
331 
332  // stale-if-error requires any failure be passed thru when its period is over.
333  int staleIfError = -1;
334  if (request && reply && reply->cache_control &&
335  reply->cache_control->hasStaleIfError(&staleIfError) &&
336  staleIfError < staleness) {
337 
338  debugs(22, 3, "stale-if-error period expired. Will produce error if validation fails.");
339  request->flags.failOnValidationError = true;
340  }
341 
342  /* If the origin server specified either of:
343  * Cache-Control: must-revalidate
344  * Cache-Control: proxy-revalidate
345  * the spec says the response must always be revalidated if stale.
346  */
347  const bool revalidateAlways = EBIT_TEST(entry->flags, ENTRY_REVALIDATE_ALWAYS);
348  if (revalidateAlways || (staleness > -1 &&
350  debugs(22, 3, "YES: Must revalidate stale object (origin set " <<
351  (revalidateAlways ? "no-cache or private" :
352  "must-revalidate, proxy-revalidate or s-maxage") << ")");
353  if (request)
354  request->flags.failOnValidationError = true;
355  return STALE_MUST_REVALIDATE;
356  }
357 
358  /* request-specific checks */
359  if (request && !request->flags.ignoreCc) {
360  HttpHdrCc *cc = request->cache_control;
361 
362  /* If the request is an IMS request, and squid is configured NOT to service this from cache
363  * (either by 'refresh-ims' in the refresh pattern or 'refresh_all_ims on' globally)
364  * then force a reload from the origin.
365  */
366  if (request->flags.ims && (R->flags.refresh_ims || Config.onoff.refresh_all_ims)) {
367  // The client's no-cache header is changed into a IMS query
368  debugs(22, 3, "YES: Client IMS request forcing revalidation of object (refresh-ims option)");
369  return STALE_FORCED_RELOAD;
370  }
371 
372 #if USE_HTTP_VIOLATIONS
373  /* Normally a client reload request ("Cache-Control: no-cache" or "Pragma: no-cache")
374  * means we must treat this reponse as STALE and fetch a new one.
375  *
376  * However, some options exist to override this behaviour. For example, we might just
377  * revalidate our existing response, or even just serve it up without revalidating it.
378  *
379  * ---- Note on the meaning of nocache_hack -----
380  *
381  * The nocache_hack flag has a very specific and complex meaning:
382  *
383  * (a) this is a reload request ("Cache-Control: no-cache" or "Pragma: no-cache" header)
384  * and (b) the configuration file either has at least one refresh_pattern with
385  * ignore-reload or reload-into-ims (not necessarily the rule matching this request) or
386  * the global reload_into_ims is set to on
387  *
388  * In other words: this is a client reload, and we might need to override
389  * the default behaviour (but we might not).
390  *
391  * "nocache_hack" is a pretty deceptive name for such a complicated meaning.
392  */
393  if (request->flags.noCacheHack()) {
394 
395  if (R->flags.ignore_reload) {
396  /* The client's no-cache header is ignored completely - we'll try to serve
397  * what we have (assuming it's still fresh, etc.)
398  */
399  debugs(22, 3, "MAYBE: Ignoring client reload request - trying to serve from cache (ignore-reload option)");
400  } else if (R->flags.reload_into_ims || Config.onoff.reload_into_ims) {
401  /* The client's no-cache header is not honoured completely - we'll just try
402  * to revalidate our cached copy (IMS to origin) instead of fetching a new
403  * copy with an unconditional GET.
404  */
405  debugs(22, 3, "YES: Client reload request - cheating, only revalidating with origin (reload-into-ims option)");
406  return STALE_RELOAD_INTO_IMS;
407  } else {
408  /* The client's no-cache header is honoured - we fetch a new copy from origin */
409  debugs(22, 3, "YES: Client reload request - fetching new copy from origin");
410  request->flags.noCache = true;
411  return STALE_FORCED_RELOAD;
412  }
413  }
414 #endif
415 
416  // Check the Cache-Control client request header
417  if (NULL != cc) {
418 
419  // max-age directive
420  int maxAge = -1;
421  if (cc->hasMaxAge(&maxAge)) {
422 
423  // RFC 8246: reply contains CC:immutable then ignore client CC:max-age=N
424  if (reply && reply->cache_control && reply->cache_control->hasImmutable()) {
425  debugs(22, 3, "MAYBE: Ignoring client CC:max-age=" << maxAge << " request - 'Cache-Control: immutable'");
426 
427 #if USE_HTTP_VIOLATIONS
428  // Ignore of client "Cache-Control: max-age=0" header
429  } else if (R->flags.ignore_reload && maxAge == 0) {
430  debugs(22, 3, "MAYBE: Ignoring client reload request - trying to serve from cache (ignore-reload option)");
431 #endif
432 
433  // Honour client "Cache-Control: max-age=x" header
434  } else if (age > maxAge || maxAge == 0) {
435  debugs(22, 3, "YES: Revalidating object - client 'Cache-Control: max-age=" << maxAge << "'");
437  }
438  }
439 
440  // max-stale directive
441  int maxStale = -1;
442  if (cc->hasMaxStale(&maxStale) && staleness > -1) {
443  if (maxStale==HttpHdrCc::MAX_STALE_ANY) {
444  debugs(22, 3, "NO: Client accepts a stale response of any age - 'Cache-Control: max-stale'");
446  } else if (staleness < maxStale) {
447  debugs(22, 3, "NO: Client accepts a stale response - 'Cache-Control: max-stale=" << maxStale << "'");
449  }
450  }
451  }
452  }
453 
454  // If the object is fresh, return the right FRESH_ code
455  if (-1 == staleness) {
456  debugs(22, 3, "Object isn't stale..");
457  if (sf.expires) {
458  debugs(22, 3, "returning FRESH_EXPIRES");
459  return FRESH_EXPIRES;
460  }
461 
462  assert(!sf.max);
463 
464  if (sf.lmfactor) {
465  debugs(22, 3, "returning FRESH_LMFACTOR_RULE");
466  return FRESH_LMFACTOR_RULE;
467  }
468 
469  assert(sf.min);
470 
471  debugs(22, 3, "returning FRESH_MIN_RULE");
472  return FRESH_MIN_RULE;
473  }
474 
475  /*
476  * At this point the response is stale, unless one of
477  * the override options kicks in.
478  * NOTE: max-stale config blocks the overrides.
479  */
480  int max_stale = (R->max_stale >= 0 ? R->max_stale : Config.maxStale);
481  if ( max_stale >= 0 && staleness > max_stale) {
482  debugs(22, 3, "YES: refresh_pattern max-stale=N limit from squid.conf");
483  if (request)
484  request->flags.failOnValidationError = true;
485  return STALE_MAX_STALE;
486  }
487 
488  if (sf.expires) {
489 #if USE_HTTP_VIOLATIONS
490 
491  if (R->flags.override_expire && age < R->min) {
492  debugs(22, 3, "NO: Serving from cache - even though explicit expiry has passed, we enforce Min value (override-expire option)");
493  return FRESH_OVERRIDE_EXPIRES;
494  }
495 
496 #endif
497  return STALE_EXPIRES;
498  }
499 
500  if (sf.max)
501  return STALE_MAX_RULE;
502 
503  if (sf.lmfactor) {
504 #if USE_HTTP_VIOLATIONS
505  if (R->flags.override_lastmod && age < R->min) {
506  debugs(22, 3, "NO: Serving from cache - even though L-M factor says the object is stale, we enforce Min value (override-lastmod option)");
507  return FRESH_OVERRIDE_LASTMOD;
508  }
509 #endif
510  debugs(22, 3, "YES: L-M factor says the object is stale'");
511  return STALE_LMFACTOR_RULE;
512  }
513 
514  debugs(22, 3, "returning STALE_DEFAULT");
515  return STALE_DEFAULT;
516 }
517 
528 bool
530 {
531  /*
532  * Don't look at the request to avoid no-cache and other nuisances.
533  * the object should have a mem_obj so the URL will be found there.
534  * minimum_expiry_time seconds delta (defaults to 60 seconds), to
535  * avoid objects which expire almost immediately, and which can't
536  * be refreshed.
537  */
538  int reason = refreshCheck(entry, NULL, Config.minimum_expiry_time);
540  ++ refreshCounts[rcStore].status[reason];
541 
542  if (reason < STALE_MUST_REVALIDATE)
543  /* Does not need refresh. This is certainly cachable */
544  return true;
545 
546  if (entry->lastModified() < 0)
547  /* We should know entry's modification time to do a refresh */
548  return false;
549 
550  if (entry->mem_obj == NULL)
551  /* no mem_obj? */
552  return true;
553 
554  if (entry->getReply() == NULL)
555  /* no reply? */
556  return true;
557 
558  if (entry->getReply()->content_length == 0)
559  /* No use refreshing (caching?) 0 byte objects */
560  return false;
561 
562  /* This seems to be refreshable. Cache it */
563  return true;
564 }
565 
567 static bool
568 refreshIsStaleIfHit(const int reason)
569 {
570  switch (reason) {
571  case FRESH_MIN_RULE:
572  case FRESH_LMFACTOR_RULE:
573  case FRESH_EXPIRES:
574  return false;
575  default:
576  return true;
577  }
578 }
579 
588 int
590 {
591  int reason = refreshCheck(entry, request, 0);
593  ++ refreshCounts[rcHTTP].status[reason];
594  request->flags.staleIfHit = refreshIsStaleIfHit(reason);
595  return (Config.onoff.offline || reason < 200) ? 0 : 1;
596 }
597 
599 int
601 {
602  int reason = refreshCheck(entry, request, 30);
604  ++ refreshCounts[rcICP].status[reason];
605  return (reason < 200) ? 0 : 1;
606 }
607 
608 #if USE_HTCP
609 int
612 {
613  int reason = refreshCheck(entry, request, 10);
615  ++ refreshCounts[rcHTCP].status[reason];
616  return (reason < 200) ? 0 : 1;
617 }
618 
619 #endif
620 
621 #if USE_CACHE_DIGESTS
622 int
624 refreshCheckDigest(const StoreEntry * entry, time_t delta)
625 {
626  int reason = refreshCheck(entry,
627  entry->mem_obj ? entry->mem_obj->request.getRaw() : nullptr,
628  delta);
630  ++ refreshCounts[rcCDigest].status[reason];
631  return (reason < 200) ? 0 : 1;
632 }
633 #endif
634 
645 time_t
646 getMaxAge(const char *url)
647 {
648  const RefreshPattern *R;
649  debugs(22, 3, "getMaxAge: '" << url << "'");
650 
651  if ((R = refreshLimits(url)))
652  return R->max;
653  else
654  return REFRESH_DEFAULT_MAX;
655 }
656 
657 static int
658 refreshCountsStatsEntry(StoreEntry * sentry, struct RefreshCounts &rc, int code, const char *desc)
659 {
660  storeAppendPrintf(sentry, "%6d\t%6.2f\t%s\n", rc.status[code], xpercent(rc.status[code], rc.total), desc);
661  return rc.status[code];
662 }
663 
664 static void
666 {
667  if (!rc.total)
668  return;
669 
670  storeAppendPrintf(sentry, "\n\n%s histogram:\n", rc.proto);
671  storeAppendPrintf(sentry, "Count\t%%Total\tCategory\n");
672 
673  int sum = 0;
674  sum += refreshCountsStatsEntry(sentry, rc, FRESH_REQUEST_MAX_STALE_ALL, "Fresh: request max-stale wildcard");
675  sum += refreshCountsStatsEntry(sentry, rc, FRESH_REQUEST_MAX_STALE_VALUE, "Fresh: request max-stale value");
676  sum += refreshCountsStatsEntry(sentry, rc, FRESH_EXPIRES, "Fresh: expires time not reached");
677  sum += refreshCountsStatsEntry(sentry, rc, FRESH_LMFACTOR_RULE, "Fresh: refresh_pattern last-mod factor percentage");
678  sum += refreshCountsStatsEntry(sentry, rc, FRESH_MIN_RULE, "Fresh: refresh_pattern min value");
679  sum += refreshCountsStatsEntry(sentry, rc, FRESH_OVERRIDE_EXPIRES, "Fresh: refresh_pattern override-expires");
680  sum += refreshCountsStatsEntry(sentry, rc, FRESH_OVERRIDE_LASTMOD, "Fresh: refresh_pattern override-lastmod");
681  sum += refreshCountsStatsEntry(sentry, rc, STALE_MUST_REVALIDATE, "Stale: response has must-revalidate");
682  sum += refreshCountsStatsEntry(sentry, rc, STALE_RELOAD_INTO_IMS, "Stale: changed reload into IMS");
683  sum += refreshCountsStatsEntry(sentry, rc, STALE_FORCED_RELOAD, "Stale: request has no-cache directive");
684  sum += refreshCountsStatsEntry(sentry, rc, STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE, "Stale: age exceeds request max-age value");
685  sum += refreshCountsStatsEntry(sentry, rc, STALE_EXPIRES, "Stale: expires time reached");
686  sum += refreshCountsStatsEntry(sentry, rc, STALE_MAX_RULE, "Stale: refresh_pattern max age rule");
687  sum += refreshCountsStatsEntry(sentry, rc, STALE_LMFACTOR_RULE, "Stale: refresh_pattern last-mod factor percentage");
688  sum += refreshCountsStatsEntry(sentry, rc, STALE_DEFAULT, "Stale: by default");
689  storeAppendPrintf(sentry, "\n");
690 }
691 
692 static void
694 {
695  // display per-rule counts of usage and tests
696  storeAppendPrintf(sentry, "\nRefresh pattern usage:\n\n");
697  storeAppendPrintf(sentry, " Used \tChecks \t%% Matches\tPattern\n");
698  for (const RefreshPattern *R = Config.Refresh; R; R = R->next) {
699  storeAppendPrintf(sentry, " %10" PRIu64 "\t%10" PRIu64 "\t%6.2f\t%s%s\n",
700  R->stats.matchCount,
701  R->stats.matchTests,
702  xpercent(R->stats.matchCount, R->stats.matchTests),
703  (R->pattern.flags&REG_ICASE ? "-i " : ""),
704  R->pattern.c_str());
705  }
706 
707  int i;
708  int total = 0;
709 
710  /* get total usage count */
711 
712  for (i = 0; i < rcCount; ++i)
713  total += refreshCounts[i].total;
714 
715  /* protocol usage histogram */
716  storeAppendPrintf(sentry, "\nRefreshCheck calls per protocol\n\n");
717 
718  storeAppendPrintf(sentry, "Protocol\t#Calls\t%%Calls\n");
719 
720  for (i = 0; i < rcCount; ++i)
721  storeAppendPrintf(sentry, "%10s\t%6d\t%6.2f\n",
722  refreshCounts[i].proto,
723  refreshCounts[i].total,
724  xpercent(refreshCounts[i].total, total));
725 
726  /* per protocol histograms */
727  storeAppendPrintf(sentry, "\n\nRefreshCheck histograms for various protocols\n");
728 
729  for (i = 0; i < rcCount; ++i)
730  refreshCountsStats(sentry, refreshCounts[i]);
731 }
732 
733 static void
735 {
736  Mgr::RegisterAction("refresh", "Refresh Algorithm Statistics", refreshStats, 0, 1);
737 }
738 
739 void
741 {
742  memset(refreshCounts, 0, sizeof(refreshCounts));
743  refreshCounts[rcHTTP].proto = "HTTP";
744  refreshCounts[rcICP].proto = "ICP";
745 #if USE_HTCP
746 
747  refreshCounts[rcHTCP].proto = "HTCP";
748 #endif
749 
750  refreshCounts[rcStore].proto = "On Store";
751 #if USE_CACHE_DIGESTS
752 
753  refreshCounts[rcCDigest].proto = "Cache Digests";
754 #endif
755 
757 }
758 
bool min
Heuristic minimum age limited.
Definition: refresh.cc:46
bool max
Configured maximum age limit.
Definition: refresh.cc:48
#define assert(EX)
Definition: assert.h:17
const char * mkrfc1123(time_t)
Definition: rfc1123.c:202
SQUIDCEXTERN double xpercent(double part, double whole)
Definition: util.c:54
a representation of a refresh pattern.
HttpHdrCc * cache_control
Definition: Message.h:76
int refresh_all_ims
Definition: SquidConfig.h:288
time_t getMaxAge(const char *url)
Definition: refresh.cc:646
Definition: SBuf.h:87
int status[STALE_DEFAULT+1]
Definition: refresh.cc:79
time_t minimum_expiry_time
Definition: SquidConfig.h:505
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
int i
Definition: membanger.c:49
void lastModified(const time_t when)
Definition: Store.h:142
bool noCacheHack() const
Definition: RequestFlags.h:126
static struct RefreshCounts refreshCounts[rcCount]
int refreshCheckHTTP(const StoreEntry *entry, HttpRequest *request)
Definition: refresh.cc:589
static int refreshCountsStatsEntry(StoreEntry *sentry, struct RefreshCounts &rc, int code, const char *desc)
Definition: refresh.cc:658
RegexPattern pattern
void OBJH(StoreEntry *)
Definition: forward.h:44
bool hasMinFresh(int32_t *val=nullptr) const
Definition: HttpHdrCc.h:140
static const RefreshPattern * refreshUncompiledPattern(const char *)
Definition: refresh.cc:115
time_t expires
Definition: Store.h:167
int refreshCheckHTCP(const StoreEntry *entry, HttpRequest *request)
Definition: refresh.cc:611
time_t squid_curtime
Definition: stub_time.cc:17
time_t timestamp
Definition: Store.h:165
bool expires
Expires: header absolute timestamp limit.
Definition: refresh.cc:45
int refreshCheckICP(const StoreEntry *entry, HttpRequest *request)
Definition: refresh.cc:600
bool failOnValidationError
Definition: RequestFlags.h:50
static RefreshPattern DefaultRefresh("<none>", 0)
const RefreshPattern * refreshLimits(const char *url)
Definition: refresh.cc:93
int64_t content_length
Definition: Message.h:83
#define REG_ICASE
Definition: GnuRegex.h:230
int reload_into_ims
Definition: SquidConfig.h:291
static void refreshCountsStats(StoreEntry *sentry, struct RefreshCounts &rc)
Definition: refresh.cc:665
struct RefreshPattern::@95 flags
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
const char * storeId() const
Definition: MemObject.cc:54
void RegisterAction(char const *action, char const *desc, OBJH *handler, int pw_req_flag, int atomic)
Definition: Registration.cc:16
static const int32_t MAX_STALE_ANY
Definition: HttpHdrCc.h:53
virtual HttpReply const * getReply() const
Definition: store.cc:1742
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:673
const char * proto
Definition: refresh.cc:77
refreshCountsEnum
Definition: refresh.cc:28
bool hasMaxStale(int32_t *val=nullptr) const
Definition: HttpHdrCc.h:132
const char * c_str() const
Definition: RegexPattern.h:35
const char * c_str()
Definition: SBuf.cc:546
uint16_t flags
Definition: Store.h:173
#define REFRESH_DEFAULT_MAX
MemObject * mem_obj
Definition: Store.h:162
RefreshPattern * next
time_t maxStale
Definition: SquidConfig.h:94
unsigned char code
Definition: html_quote.c:20
static void refreshRegisterWithCacheManager(void)
Definition: refresh.cc:734
struct SquidConfig::@112 onoff
bool lmfactor
Last-Modified with heuristic determines limit.
Definition: refresh.cc:47
bool SIGHDLR int STUB void int
Definition: stub_tools.cc:68
#define PRIu64
Definition: types.h:120
RequestFlags flags
Definition: HttpRequest.h:129
static int refreshCheck(const StoreEntry *entry, HttpRequest *request, time_t delta)
Definition: refresh.cc:265
static bool refreshIsStaleIfHit(const int reason)
whether reply is stale if it is a hit
Definition: refresh.cc:568
bool hasMaxAge(int32_t *val=nullptr) const
Definition: HttpHdrCc.h:122
void refreshInit(void)
Definition: refresh.cc:740
int refreshCheckDigest(const StoreEntry *entry, time_t delta)
Definition: refresh.cc:624
static int refreshStaleness(const StoreEntry *entry, time_t check_time, const time_t age, const RefreshPattern *R, stale_flags *sf)
Definition: refresh.cc:147
const HttpReplyPointer & getReply() const
Definition: MemObject.h:55
Definition: refresh.cc:30
bool refreshIsCachable(const StoreEntry *entry)
Definition: refresh.cc:529
static OBJH refreshStats
Definition: refresh.cc:83
RefreshPattern * Refresh
Definition: SquidConfig.h:416
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:904
HttpRequestPointer request
Definition: MemObject.h:157
#define EBIT_TEST(flag, bit)
Definition: defines.h:107
C * getRaw() const
Definition: RefCount.h:74
class SquidConfig Config
Definition: SquidConfig.cc:12
#define NULL
Definition: types.h:166
A const & min(A const &lhs, A const &rhs)
bool hasStaleIfError(int32_t *val=nullptr) const
Definition: HttpHdrCc.h:150

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors