Commit e4a0af76 authored by Tollef Fog Heen's avatar Tollef Fog Heen
parents 6587c5d5 2b4e6317
......@@ -71,7 +71,7 @@ struct params {
gid_t gid;
/* TTL used for lack of anything better */
unsigned default_ttl;
double default_ttl;
/* Maximum concurrent sessions */
unsigned max_sess;
......@@ -163,7 +163,7 @@ struct params {
unsigned diag_bitmap;
/* Default grace period */
unsigned default_grace;
double default_grace;
/* Log hash string to shm */
unsigned log_hash;
......
......@@ -502,7 +502,8 @@ static const struct parspec input_parspec[] = {
"The unprivileged group to run as.",
MUST_RESTART,
MAGIC_INIT_STRING },
{ "default_ttl", tweak_uint, &master.default_ttl, 0, UINT_MAX,
{ "default_ttl", tweak_timeout_double, &master.default_ttl,
0, UINT_MAX,
"The TTL assigned to objects if neither the backend nor "
"the VCL code assigns one.\n"
"Objects already cached will not be affected by changes "
......@@ -573,7 +574,8 @@ static const struct parspec input_parspec[] = {
"Maximum is 65535 bytes.",
0,
"255", "bytes" },
{ "default_grace", tweak_uint, &master.default_grace, 0, UINT_MAX,
{ "default_grace", tweak_timeout_double, &master.default_grace,
0, UINT_MAX,
"Default grace period. We will deliver an object "
"this long after it has expired, provided another thread "
"is attempting to get a new copy.\n"
......
......@@ -71,9 +71,9 @@ SVNID("$Id$")
double
RFC2616_Ttl(const struct sess *sp)
{
int ttl;
double ttl;
unsigned max_age, age;
double h_date, h_expires, ttd;
double h_date, h_expires;
char *p;
const struct http *hp;
......@@ -84,7 +84,6 @@ RFC2616_Ttl(const struct sess *sp)
ttl = params->default_ttl;
max_age = age = 0;
ttd = 0;
h_expires = 0;
h_date = 0;
......@@ -116,6 +115,8 @@ RFC2616_Ttl(const struct sess *sp)
if (http_GetHdr(hp, H_Expires, &p))
h_expires = TIM_parse(p);
/* No expire header, fall back to default */
if (h_expires == 0)
break;
......@@ -129,8 +130,7 @@ RFC2616_Ttl(const struct sess *sp)
}
if (h_date == 0 ||
(h_date < sp->wrk->entered + params->clock_skew &&
h_date + params->clock_skew > sp->wrk->entered)) {
fabs(h_date - sp->wrk->entered) < params->clock_skew) {
/*
* If we have no Date: header or if it is
* sufficiently close to our clock we will
......@@ -139,27 +139,22 @@ RFC2616_Ttl(const struct sess *sp)
if (h_expires < sp->wrk->entered)
ttl = 0;
else
ttd = h_expires;
ttl = h_expires - sp->wrk->entered;
break;
} else {
/*
* But even if the clocks are out of whack we can still
* derive a relative time from the two headers.
* (the negative ttl case is caught above)
*/
ttl = (int)(h_expires - h_date);
}
/*
* But even if the clocks are out of whack we can still
* derive a relative time from the two headers.
* (the negative ttl case is caught above)
*/
ttl = (int)(h_expires - h_date);
} while (0);
if (ttd > 0)
ttl = ttd - sp->wrk->entered;
/* calculated TTL, Our time, Date, Expires, max-age, age */
WSP(sp, SLT_TTL, "%u RFC %d %d %d %d %u %u", sp->xid,
ttd ? (int)(ttl) : 0,
(int)sp->wrk->entered, (int)h_date,
(int)h_expires, max_age, age);
WSP(sp, SLT_TTL, "%u RFC %g %g %g %g %u %u", sp->xid,
ttl, sp->wrk->entered, h_date, h_expires, max_age, age);
return (ttl);
}
......
......@@ -76,6 +76,11 @@ Varnish Glossary
the client. When the response is stored in varnishd's cache,
we call it an object.
backend response
The response specifically served from a backend to
varnishd. The backend response may be manipulated in
vcl_fetch.
body
The bytes that make up the contents of the object, varnishd
does not care if they are in HTML, XML, JPEG or even EBCDIC,
......@@ -84,8 +89,8 @@ Varnish Glossary
object
The (possibly) cached version of a backend response. Varnishd
receives a reponse from the backend and creates an object,
from which it may produce cached responses to clients. If the
backend response is created from a request which is passed, it
from which it may deliver cached responses to clients. If the
object is created as a result of a request which is passed, it
will not be stored for caching.
.. comment: "configuration of varnishd -----------------------------"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment