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
23705c43
Commit
23705c43
authored
Feb 07, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VRT_fail in case silly HTTP status numbers are set, and test that.
parent
e9e1373b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
14 deletions
+48
-14
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+7
-10
v00050.vtc
bin/varnishtest/tests/v00050.vtc
+41
-4
No files found.
bin/varnishd/cache/cache_vrt_var.c
View file @
23705c43
...
...
@@ -97,17 +97,14 @@ VRT_l_##obj##_status(VRT_CTX, long num) \
\
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->http_##obj, HTTP_MAGIC); \
if (num > 65535) { \
VSLb(ctx->vsl, SLT_VCL_Error, \
"%s.status > 65535", #obj); \
WS_MarkOverflow(ctx->http_##obj->ws); \
} else if ((num % 1000) < 100) { \
VSLb(ctx->vsl, SLT_VCL_Error, \
"illegal %s.status (..0##)", #obj); \
WS_MarkOverflow(ctx->http_##obj->ws); \
} else { \
if (num < 0) \
VRT_fail(ctx, "%s.status (%ld) is negative", #obj, num); \
else if (num > 65535) \
VRT_fail(ctx, "%s.status (%ld) > 65535", #obj, num); \
else if ((num % 1000) < 100) \
VRT_fail(ctx, "illegal %s.status (%ld) (..0##)", #obj, num); \
else \
http_SetStatus(ctx->http_##obj, (uint16_t)num); \
} \
}
#define VRT_STATUS_R(obj) \
...
...
bin/varnishtest/tests/v00050.vtc
View file @
23705c43
...
...
@@ -91,6 +91,15 @@ varnish v1 -vcl+backend {
return (synth(400));
}
}
if (req.http.huge == "yes") {
set resp.status = 65536;
}
if (req.http.small == "yes") {
set resp.status = 99;
}
if (req.http.negative == "yes") {
set resp.status = -200;
}
}
sub vcl_recv {
...
...
@@ -100,6 +109,9 @@ varnish v1 -vcl+backend {
}
sub vcl_synth {
if (resp.reason == "VCL failed") {
return (deliver);
}
std.log("synth " + resp.status + " " + resp.reason);
if (resp.status != 22301) {
set resp.status = 501;
...
...
@@ -148,10 +160,35 @@ client c1 {
rxresp
expect resp.status == 302
expect resp.reason == "Wrong Postcode"
}
} -run
logexpect l1 -v v1 {
expect * * VCL_Error "illegal resp.status .99. ...0##."
expect * * VCL_Error "resp.status .65536. > 65535"
expect * * VCL_Error "resp.status .-200. is negative"
} -start
client c1 -run
client c1 {
txreq -url "/a" -hdr "Small: yes"
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
expect_close
} -run
client c1 {
txreq -url "/a" -hdr "Huge: yes"
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
} -run
server s1 -wait
client c1 {
txreq -url "/a" -hdr "Negative: yes"
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
} -run
varnish v1 -stop
logexpect l1 -wait
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