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
baa7e69d
Commit
baa7e69d
authored
Jan 15, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the error messages for 'vcl N.N;'
Some specialcasing is warranted to get sensible messages. Fixes #2532
parent
79ed4fce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
13 deletions
+43
-13
v00049.vtc
bin/varnishtest/tests/v00049.vtc
+10
-0
vcc_compile.h
lib/libvcc/vcc_compile.h
+0
-1
vcc_parse.c
lib/libvcc/vcc_parse.c
+32
-11
vcc_utils.c
lib/libvcc/vcc_utils.c
+1
-1
No files found.
bin/varnishtest/tests/v00049.vtc
View file @
baa7e69d
...
...
@@ -15,3 +15,13 @@ 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"; }
}
varnish v1 -cliexpect {Don't play silly buggers with VCL version numbers} \
{vcl.inline t0 "vcl 4.00 ; backend b { .host = \"localhost\";} "}
varnish v1 -cliexpect {Don't play silly buggers with VCL version numbers} \
{vcl.inline t1 "vcl 04.0 ; backend b { .host = \"localhost\";} "}
varnish v1 -cliexpect {Expected 'vcl N.N;' found no semi-colon} \
{vcl.inline t2 "vcl 4.0 backend b { .host = \"localhost\";} "}
lib/libvcc/vcc_compile.h
View file @
baa7e69d
...
...
@@ -310,7 +310,6 @@ void Resolve_Sockaddr(struct vcc *tl, const char *host, const char *defport,
double
vcc_TimeUnit
(
struct
vcc
*
);
void
vcc_ByteVal
(
struct
vcc
*
,
double
*
);
void
vcc_NumVal
(
struct
vcc
*
,
double
*
,
int
*
);
double
vcc_DoubleVal
(
struct
vcc
*
tl
);
void
vcc_Duration
(
struct
vcc
*
tl
,
double
*
);
unsigned
vcc_UintVal
(
struct
vcc
*
tl
);
...
...
lib/libvcc/vcc_parse.c
View file @
baa7e69d
...
...
@@ -274,29 +274,50 @@ vcc_ParseFunction(struct vcc *tl)
static
void
vcc_ParseVcl
(
struct
vcc
*
tl
)
{
struct
token
*
tok
;
struct
token
*
tok
0
,
*
tok1
,
*
tok2
;
assert
(
vcc_IdIs
(
tl
->
t
,
"vcl"
));
tok0
=
tl
->
t
;
vcc_NextToken
(
tl
);
tok
=
tl
->
t
;
tok
->
src
->
syntax
=
vcc_DoubleVal
(
tl
);
ERRCHK
(
tl
);
if
(
tl
->
t
->
e
-
tok
->
b
>
4
)
{
tok1
=
tl
->
t
;
Expect
(
tl
,
CNUM
);
tok1
->
src
->
syntax
=
*
tl
->
t
->
b
-
'0'
;
vcc_NextToken
(
tl
);
Expect
(
tl
,
'.'
);
vcc_NextToken
(
tl
);
Expect
(
tl
,
CNUM
);
tok2
=
tl
->
t
;
tok1
->
src
->
syntax
+=
.
1
*
(
*
tl
->
t
->
b
-
'0'
);
vcc_NextToken
(
tl
);
if
(
tok1
->
e
-
tok1
->
b
!=
1
||
tok2
->
e
-
tok2
->
b
!=
1
)
{
VSB_printf
(
tl
->
sb
,
"Don't play silly buggers with VCL version numbers
\n
"
);
vcc_ErrWhere2
(
tl
,
tok
,
tl
->
t
);
vcc_ErrWhere2
(
tl
,
tok0
,
tl
->
t
);
ERRCHK
(
tl
);
}
if
(
tl
->
t
->
tok
!=
';'
)
{
/* Special handling, because next token might be 'vcl'
* in the built-in VCL, and that would give a very
* confusing error message
*/
VSB_printf
(
tl
->
sb
,
"Expected 'vcl N.N;' found no semi-colon
\n
"
);
vcc_ErrWhere2
(
tl
,
tok0
,
tl
->
t
);
ERRCHK
(
tl
);
}
if
(
tl
->
syntax
!=
0
.
0
&&
tok
->
src
->
syntax
>
tl
->
syntax
)
{
vcc_NextToken
(
tl
);
if
(
tl
->
syntax
!=
0
.
0
&&
tok1
->
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
);
tok
1
->
src
->
syntax
,
tl
->
syntax
);
vcc_ErrWhere2
(
tl
,
tok
0
,
tl
->
t
);
ERRCHK
(
tl
);
}
ExpectErr
(
tl
,
';'
);
vcc_NextToken
(
tl
);
}
/*--------------------------------------------------------------------
...
...
lib/libvcc/vcc_utils.c
View file @
baa7e69d
...
...
@@ -344,7 +344,7 @@ vcc_NumVal(struct vcc *tl, double *d, int *frac)
vcc_NextToken
(
tl
);
}
double
static
double
vcc_DoubleVal
(
struct
vcc
*
tl
)
{
double
d
;
...
...
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