Commit b26529dc authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Fiddle the "RFC" SLT_TTL record into submission.

Document the TTL record.
parent f9002407
......@@ -89,6 +89,16 @@ RFC2616_Ttl(const struct sess *sp)
* We do not support ranges yet, so 206 is out.
*/
if (http_GetHdr(hp, H_Age, &p)) {
age = strtoul(p, NULL, 0);
sp->wrk->exp.age = age;
}
if (http_GetHdr(hp, H_Expires, &p))
h_expires = TIM_parse(p);
if (http_GetHdr(hp, H_Date, &p))
h_date = TIM_parse(p);
switch (sp->err_code) {
default:
sp->wrk->exp.ttl = -1.;
......@@ -114,10 +124,6 @@ RFC2616_Ttl(const struct sess *sp)
max_age = 0;
else
max_age = strtoul(p, NULL, 0);
if (http_GetHdr(hp, H_Age, &p)) {
age = strtoul(p, NULL, 0);
sp->wrk->exp.age = age;
}
if (age > max_age)
ttl = 0;
......@@ -126,17 +132,10 @@ RFC2616_Ttl(const struct sess *sp)
break;
}
/* Next look for absolute specifications from backend */
if (http_GetHdr(hp, H_Expires, &p))
h_expires = TIM_parse(p);
/* No expire header, fall back to default */
if (h_expires == 0)
break;
if (http_GetHdr(hp, H_Date, &p))
h_date = TIM_parse(p);
/* If backend told us it is expired already, don't cache. */
if (h_expires < h_date) {
......@@ -169,8 +168,8 @@ RFC2616_Ttl(const struct sess *sp)
/* calculated TTL, Our time, Date, Expires, max-age, age */
WSP(sp, SLT_TTL,
"%u RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u %u",
sp->xid, ttl, -1. -1., sp->wrk->exp.entered, sp->wrk->exp.age,
"%u RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u",
sp->xid, ttl, -1., -1., sp->wrk->exp.entered, sp->wrk->exp.age,
h_date, h_expires, max_age);
return (ttl);
......
......@@ -4,6 +4,38 @@
Shared Memory Logging
=====================
TTL records
~~~~~~~~~~~
A TTL record is emitted whenever the ttl, grace or keep values for an
object is set.
The format is::
%u %s %d %d %d %d %d [ %d %u %u ]
| | | | | | | | | |
| | | | | | | | | +- Max-Age from Cache-Control header
| | | | | | | | +---- Expires header
| | | | | | | +------- Date header
| | | | | | +------------ Age (incl Age: header value)
| | | | | +--------------- Reference time for TTL
| | | | +------------------ Keep
| | | +--------------------- Grace
| | +------------------------ TTL
| +--------------------------- "RFC" or "VCL"
+------------------------------ object XID
The last three fields are only present in "RFC" headers.
Examples::
1001 RFC 19 -1 -1 1312966109 4 0 0 23
1001 VCL 10 -1 -1 1312966109 4
1001 VCL 7 -1 -1 1312966111 6
1001 VCL 7 120 -1 1312966111 6
1001 VCL 7 120 3600 1312966111 6
1001 VCL 12 120 3600 1312966113 8
Gzip records
~~~~~~~~~~~~
......@@ -14,7 +46,6 @@ gunziped, will run into many of these.
The format is::
%c %c %c %d %d %d %d %d
| | | | | | | |
| | | | | | | +- Bit length of compressed data
......@@ -26,7 +57,7 @@ The format is::
| +------------------- 'F' = Fetch, 'D' = Deliver
+---------------------- 'G' = Gzip, 'U' = Gunzip, 'u' = Gunzip-test
Which in practice could look like::
Examples::
U F E 182 159 80 80 1392
G F E 159 173 80 1304 1314
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