Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b26529dc
Commit
b26529dc
authored
Aug 10, 2011
by
Poul-Henning Kamp
Committed by
Tollef Fog Heen
Aug 17, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fiddle the "RFC" SLT_TTL record into submission.
Document the TTL record.
parent
f9002407
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
15 deletions
+45
-15
rfc2616.c
bin/varnishd/rfc2616.c
+12
-13
vsl.rst
doc/sphinx/reference/vsl.rst
+33
-2
No files found.
bin/varnishd/rfc2616.c
View file @
b26529dc
...
@@ -89,6 +89,16 @@ RFC2616_Ttl(const struct sess *sp)
...
@@ -89,6 +89,16 @@ RFC2616_Ttl(const struct sess *sp)
* We do not support ranges yet, so 206 is out.
* 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
)
{
switch
(
sp
->
err_code
)
{
default:
default:
sp
->
wrk
->
exp
.
ttl
=
-
1
.;
sp
->
wrk
->
exp
.
ttl
=
-
1
.;
...
@@ -114,10 +124,6 @@ RFC2616_Ttl(const struct sess *sp)
...
@@ -114,10 +124,6 @@ RFC2616_Ttl(const struct sess *sp)
max_age
=
0
;
max_age
=
0
;
else
else
max_age
=
strtoul
(
p
,
NULL
,
0
);
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
)
if
(
age
>
max_age
)
ttl
=
0
;
ttl
=
0
;
...
@@ -126,17 +132,10 @@ RFC2616_Ttl(const struct sess *sp)
...
@@ -126,17 +132,10 @@ RFC2616_Ttl(const struct sess *sp)
break
;
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 */
/* No expire header, fall back to default */
if
(
h_expires
==
0
)
if
(
h_expires
==
0
)
break
;
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 backend told us it is expired already, don't cache. */
if
(
h_expires
<
h_date
)
{
if
(
h_expires
<
h_date
)
{
...
@@ -169,8 +168,8 @@ RFC2616_Ttl(const struct sess *sp)
...
@@ -169,8 +168,8 @@ RFC2616_Ttl(const struct sess *sp)
/* calculated TTL, Our time, Date, Expires, max-age, age */
/* calculated TTL, Our time, Date, Expires, max-age, age */
WSP
(
sp
,
SLT_TTL
,
WSP
(
sp
,
SLT_TTL
,
"%u RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u
%u
"
,
"%u RFC %.0f %.0f %.0f %.0f %.0f %.0f %.0f %u"
,
sp
->
xid
,
ttl
,
-
1
.
-
1
.,
sp
->
wrk
->
exp
.
entered
,
sp
->
wrk
->
exp
.
age
,
sp
->
xid
,
ttl
,
-
1
.
,
-
1
.,
sp
->
wrk
->
exp
.
entered
,
sp
->
wrk
->
exp
.
age
,
h_date
,
h_expires
,
max_age
);
h_date
,
h_expires
,
max_age
);
return
(
ttl
);
return
(
ttl
);
...
...
doc/sphinx/reference/vsl.rst
View file @
b26529dc
...
@@ -4,6 +4,38 @@
...
@@ -4,6 +4,38 @@
Shared Memory Logging
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
Gzip records
~~~~~~~~~~~~
~~~~~~~~~~~~
...
@@ -14,7 +46,6 @@ gunziped, will run into many of these.
...
@@ -14,7 +46,6 @@ gunziped, will run into many of these.
The format is::
The format is::
%c %c %c %d %d %d %d %d
%c %c %c %d %d %d %d %d
| | | | | | | |
| | | | | | | |
| | | | | | | +- Bit length of compressed data
| | | | | | | +- Bit length of compressed data
...
@@ -26,7 +57,7 @@ The format is::
...
@@ -26,7 +57,7 @@ The format is::
| +------------------- 'F' = Fetch, 'D' = Deliver
| +------------------- 'F' = Fetch, 'D' = Deliver
+---------------------- 'G' = Gzip, 'U' = Gunzip, 'u' = Gunzip-test
+---------------------- 'G' = Gzip, 'U' = Gunzip, 'u' = Gunzip-test
Which in practice could look like
::
Examples
::
U F E 182 159 80 80 1392
U F E 182 159 80 80 1392
G F E 159 173 80 1304 1314
G F E 159 173 80 1304 1314
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment