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
9a841378
Commit
9a841378
authored
Jun 20, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add code to cater for other vcl syntax numbers than 4.0, we will
soon need them.
parent
b2eaca02
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
9 deletions
+43
-9
v00049.vtc
bin/varnishtest/tests/v00049.vtc
+17
-0
vcc_compile.c
lib/libvcc/vcc_compile.c
+2
-2
vcc_compile.h
lib/libvcc/vcc_compile.h
+1
-0
vcc_parse.c
lib/libvcc/vcc_parse.c
+23
-7
No files found.
bin/varnishtest/tests/v00049.vtc
0 → 100644
View file @
9a841378
varnishtest "VCL syntax numbers"
varnish v1 -vcl {backend b1 { .host = "127.0.0.1:8080"; }} -start
varnish v1 -syntax 3.9 -errvcl "VCL version 3.9 not supported." {
backend b1 { .host = "127.0.0.1:8080"; }
}
varnish v1 -syntax 4.0 -errvcl "silly buggers" {
vcl 4.01;
backend b1 { .host = "127.0.0.1:8080"; }
}
varnish v1 -syntax 4.0 -errvcl "9.9 higher than the top level version" {
vcl 9.9;
backend b1 { .host = "127.0.0.1:8080"; }
}
lib/libvcc/vcc_compile.c
View file @
9a841378
...
...
@@ -481,7 +481,7 @@ vcc_resolve_includes(struct vcc *tl)
continue
;
t1
=
VTAILQ_NEXT
(
t
,
list
);
assert
(
t1
!=
NULL
);
/* There's always an EOI */
AN
(
t1
);
/* There's always an EOI */
if
(
t1
->
tok
!=
CSTR
)
{
VSB_printf
(
tl
->
sb
,
"include not followed by string constant.
\n
"
);
...
...
@@ -489,7 +489,7 @@ vcc_resolve_includes(struct vcc *tl)
return
;
}
t2
=
VTAILQ_NEXT
(
t1
,
list
);
assert
(
t2
!=
NULL
);
/* There's always an EOI */
AN
(
t2
);
/* There's always an EOI */
if
(
t2
->
tok
!=
';'
)
{
VSB_printf
(
tl
->
sb
,
...
...
lib/libvcc/vcc_compile.h
View file @
9a841378
...
...
@@ -70,6 +70,7 @@ struct symbol;
struct
source
{
VTAILQ_ENTRY
(
source
)
list
;
float
syntax
;
char
*
name
;
const
char
*
b
;
const
char
*
e
;
...
...
lib/libvcc/vcc_parse.c
View file @
9a841378
...
...
@@ -279,13 +279,20 @@ vcc_ParseVcl(struct vcc *tl)
assert
(
vcc_IdIs
(
tl
->
t
,
"vcl"
));
vcc_NextToken
(
tl
);
tok
=
tl
->
t
;
t
l
->
syntax
=
vcc_DoubleVal
(
tl
);
t
ok
->
src
->
syntax
=
vcc_DoubleVal
(
tl
);
ERRCHK
(
tl
);
if
(
tl
->
syntax
!=
4
.
0
)
{
// see TODO above
VSB_printf
(
tl
->
sb
,
"VCL version %.1f not supported.
\n
"
,
tl
->
syntax
);
vcc_ErrWhere
(
tl
,
tok
);
if
(
tl
->
t
->
e
-
tok
->
b
>
4
)
{
VSB_printf
(
tl
->
sb
,
"Don't play silly buggers with VCL version numbers
\n
"
);
vcc_ErrWhere2
(
tl
,
tok
,
tl
->
t
);
ERRCHK
(
tl
);
}
if
(
tl
->
syntax
!=
0
.
0
&&
tok
->
src
->
syntax
>
tl
->
syntax
)
{
VSB_printf
(
tl
->
sb
,
"VCL version %.1f higher than"
" the top level version %.1f
\n
"
,
tok
->
src
->
syntax
,
tl
->
syntax
);
vcc_ErrWhere2
(
tl
,
tok
,
tl
->
t
);
ERRCHK
(
tl
);
}
ExpectErr
(
tl
,
';'
);
...
...
@@ -322,18 +329,27 @@ void
vcc_Parse
(
struct
vcc
*
tl
)
{
struct
toplev
*
tp
;
struct
token
*
tok
;
if
(
tl
->
t
->
tok
!=
ID
||
!
vcc_IdIs
(
tl
->
t
,
"vcl"
))
{
VSB_printf
(
tl
->
sb
,
"VCL version declaration missing
\n
"
"Update your VCL to Version 4 syntax, and add
\n
"
"
\t
vcl 4.0;
\n
"
"on the first line the VCL files.
\n
"
"on the first line
of
the VCL files.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
ERRCHK
(
tl
);
}
tok
=
tl
->
t
;
vcc_ParseVcl
(
tl
);
if
(
tok
->
src
->
syntax
!=
4
.
0
)
{
VSB_printf
(
tl
->
sb
,
"VCL version %.1f not supported.
\n
"
,
tok
->
src
->
syntax
);
vcc_ErrWhere2
(
tl
,
tok
,
tl
->
t
);
ERRCHK
(
tl
);
}
tl
->
syntax
=
tl
->
t
->
src
->
syntax
;
ERRCHK
(
tl
);
while
(
tl
->
t
->
tok
!=
EOI
)
{
ERRCHK
(
tl
);
...
...
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