Commit fa80a6a6 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Start marking variables with VCL versions.

(It doesn't get to the C code yet.)
parent 01379caf
......@@ -215,7 +215,7 @@ req.url
The requested URL, for instance "/robots.txt".
req.proto
req.proto ``VCL <= 4.0``
Type: STRING
......@@ -223,7 +223,15 @@ req.proto
Writable from: client
The HTTP protocol version used by the client, usually "HTTP/1.1"
or "HTTP/2.0".
req.proto ``VCL >= 4.1``
Type: STRING
Readable from: client
The HTTP protocol version used by the client, usually "HTTP/1.1"
or "HTTP/2.0".
......@@ -302,7 +310,7 @@ req.xid
Unique ID of this request.
req.esi
req.esi ``VCL <= 4.0``
Type: BOOL
......@@ -312,9 +320,8 @@ req.esi
Set to `false` to disable ESI processing
regardless of any value in beresp.do_esi. Defaults
to `true`. This variable is subject to change in
future versions, you should avoid using it.
to `true`. This variable is replaced by `resp.do_esi`
in VCL 4.1.
req.can_gzip
......@@ -515,7 +522,7 @@ bereq.url
The requested URL, copied from `req.url`
bereq.proto
bereq.proto ``VCL <= 4.0``
Type: STRING
......@@ -526,6 +533,15 @@ bereq.proto
The HTTP protocol version, "HTTP/1.1" unless a pass or pipe
request has "HTTP/1.0" in `req.proto`
bereq.proto ``VCL >= 4.1``
Type: STRING
Readable from: vcl_pipe, backend
The HTTP protocol version, "HTTP/1.1" unless a pass or pipe
request has "HTTP/1.0" in `req.proto`
bereq.http.*
......@@ -620,7 +636,7 @@ beresp.body
For producing a synthetic body.
beresp.proto
beresp.proto ``VCL <= 4.0``
Type: STRING
......@@ -630,6 +646,14 @@ beresp.proto
The HTTP protocol version the backend replied with.
beresp.proto ``VCL >= 4.1``
Type: STRING
Readable from: vcl_backend_response, vcl_backend_error
The HTTP protocol version the backend replied with.
beresp.status
......@@ -855,7 +879,6 @@ obj.proto
Readable from: vcl_hit
The HTTP protocol version stored in the object.
......@@ -959,7 +982,10 @@ resp
~~~~
This is the response we send to the client, it is built from either
`beresp` (pass/miss) or `obj` (hits).
`beresp` (pass/miss), `obj` (hits) or created from whole cloth (synth).
With the exception of `resp.body` all `resp.*` variables available
in both `vcl_deliver{}` and `vcl_synth{}` as a matter of symmetry.
resp
......@@ -978,7 +1004,17 @@ resp.body
To produce a synthetic response body, for instance for errors.
resp.proto
resp.proto ``VCL <= 4.0``
Type: STRING
Readable from: vcl_deliver, vcl_synth
Writable from: vcl_deliver, vcl_synth
The HTTP protocol version to use for the response.
resp.proto ``VCL >= 4.1``
Type: STRING
......
......@@ -169,21 +169,41 @@ returns = (
sp_variables = collections.OrderedDict()
class vardef(object):
def __init__(self, nam, typ, rd, wr, doc, uns):
def __init__(self, nam, typ, rd, wr, wu, vlo, vhi):
if nam in sp_variables:
return
sp_variables[nam] = self
self.nam = nam
self.typ = typ
self.rd = rd
self.wr = wr
self.doc = doc
self.uns = uns
self.uns = wu
self.vlo = vlo
self.vhi = vhi
def parse_vcl(x):
vlo,vhi = (0,99)
x = x.split()
if x[0] == "VCL" and x[1] == "<=":
vhi = int(float(x[2]) * 10)
elif x[0] == "VCL" and x[1] == ">=":
vlo = int(float(x[2]) * 10)
else:
print("Unknown variable version spec")
print("XXX", x, vlo, vhi)
exit(2)
return vlo,vhi
def parse_var(ln):
vn = ln.pop(0).split()
assert len(vn) == 1
vn = vn[0]
l1 = ln.pop(0).split("``")
assert len(l1) in (1,3)
vn = l1[0].strip()
if vn[-1] == '*':
vn = vn[:-1]
if len(l1) == 3:
vlo,vhi = parse_vcl(l1[1])
else:
vlo,vhi = 0,99
vr = []
vw = []
vu = []
......@@ -209,9 +229,8 @@ def parse_var(ln):
vu.append(i.strip(",."))
continue
break
doc = "\n" + l + "\n" + "\n".join(ln)
if vn[:8] != "storage.":
vardef(vn, vt, vr, vw, doc, uns=vu)
vardef(vn, vt, vr, vw, vu, vlo, vhi)
def parse_var_doc(fn):
s = 0
......
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