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
7de2ff8e
Commit
7de2ff8e
authored
Jan 25, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change assert to proper error message and test it.
Fixes #2197
parent
6786c86b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
2 deletions
+62
-2
cache_esi_parse.c
bin/varnishd/cache/cache_esi_parse.c
+16
-2
e00006.vtc
bin/varnishtest/tests/e00006.vtc
+46
-0
No files found.
bin/varnishd/cache/cache_esi_parse.c
View file @
7de2ff8e
...
...
@@ -479,7 +479,14 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
if
(
l
>
7
&&
!
memcmp
(
p
,
"http://"
,
7
))
{
h
=
p
+
7
;
p
=
strchr
(
h
,
'/'
);
AN
(
p
);
if
(
p
==
NULL
)
{
vep_error
(
vep
,
"ESI 1.0 <esi:include> invalid src= URL"
);
vep
->
state
=
VEP_TAGERROR
;
AZ
(
vep
->
attr_vsb
);
VSB_destroy
(
&
vep
->
include_src
);
return
;
}
Debug
(
"HOST <%.*s> PATH <%s>
\n
"
,
(
int
)(
p
-
h
),
h
,
p
);
VSB_printf
(
vep
->
vsb
,
"%c"
,
VEC_INCL
);
VSB_printf
(
vep
->
vsb
,
"Host: %.*s%c"
,
(
int
)(
p
-
h
),
h
,
0
);
...
...
@@ -496,7 +503,14 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
"ESI 1.0 <esi:include> https:// treated as http://"
);
h
=
p
+
8
;
p
=
strchr
(
h
,
'/'
);
AN
(
p
);
if
(
p
==
NULL
)
{
vep_error
(
vep
,
"ESI 1.0 <esi:include> invalid src= URL"
);
vep
->
state
=
VEP_TAGERROR
;
AZ
(
vep
->
attr_vsb
);
VSB_destroy
(
&
vep
->
include_src
);
return
;
}
VSB_printf
(
vep
->
vsb
,
"%c"
,
VEC_INCL
);
VSB_printf
(
vep
->
vsb
,
"Host: %.*s%c"
,
(
int
)(
p
-
h
),
h
,
0
);
}
else
if
(
*
p
==
'/'
)
{
...
...
bin/varnishtest/tests/e00006.vtc
View file @
7de2ff8e
...
...
@@ -43,3 +43,49 @@ client c1 {
client c1 -run
varnish v1 -expect esi_errors == 0
# Now try with invalid URLs
server s1 {
rxreq
expect req.url == /http
txresp -body {
<esi:include
src=
"http://foobar"
/>
1234}
rxreq
expect req.url == /https
txresp -body {
<esi:include
src=
"https://foobar"
/>
123456}
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
set req.backend_hint = s2;
set req.backend_hint = s1;
}
sub vcl_backend_response {
set beresp.do_esi = true;
}
}
varnish v1 -cliok "param.set feature +esi_ignore_https"
logexpect l1 -v v1 -g raw {
expect * * ESI_xmlerror "ERR at 35 ESI 1.0
<esi:include>
invalid src= URL"
expect * * ESI_xmlerror "WARN at 36 ESI 1.0
<esi:include>
https:// treated as http://"
expect * * ESI_xmlerror "ERR at 36 ESI 1.0
<esi:include>
invalid src= URL"
} -start
client c1 {
txreq -url /http
rxresp
expect resp.status == 200
expect resp.bodylen == 4
txreq -url /https
rxresp
expect resp.status == 200
expect resp.bodylen == 6
}
client c1 -run
logexpect l1 -wait
varnish v1 -expect esi_errors == 2
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