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
85a42d7d
Unverified
Commit
85a42d7d
authored
Oct 14, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test and document VRT_ValidHdr()
parent
40b6f254
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
1 deletion
+29
-1
b00040.vtc
bin/varnishtest/tests/b00040.vtc
+11
-0
changes.rst
doc/changes.rst
+5
-0
vrt.h
include/vrt.h
+2
-1
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+7
-0
vmod_debug.vcc
lib/libvmod_debug/vmod_debug.vcc
+4
-0
No files found.
bin/varnishtest/tests/b00040.vtc
View file @
85a42d7d
...
...
@@ -10,12 +10,21 @@ server s1 {
} -start
varnish v1 -vcl+backend {
import debug;
sub vcl_recv {
if (req.url == "/9") {
set req.http.foo = {"
"};
}
}
sub vcl_deliver {
if (req.url == "/9") {
set resp.http.valid1 = debug.validhdr({"
"});
set resp.http.valid2 = debug.validhdr("a");
}
}
} -start
logexpect l1 -v v1 -g raw {
...
...
@@ -105,4 +114,6 @@ client c1 {
txreq -url /9
rxresp
expect resp.status == 200
expect resp.http.valid1 == false
expect resp.http.valid2 == true
} -run
doc/changes.rst
View file @
85a42d7d
...
...
@@ -37,6 +37,11 @@ Varnish Cache Next (2021-03-15)
set headers are now validated to contain only characters allowed by
RFC7230. A (runtime) VCL failure is triggered if not.
* ``VRT_ValidHdr()`` has been added for vmods to conduct the same
check as the ``validate_headers`` feature, for example when headers
are set by vmods using the ``cache_http.c`` Functions like
``http_ForceHeader()`` from untrusted input.
* The shard director now supports reconfiguration (adding/removing
backends) of several instances without any special ordering
requirement.
...
...
include/vrt.h
View file @
85a42d7d
...
...
@@ -52,8 +52,9 @@
* Whenever something is deleted or changed in a way which is not
* binary/load-time compatible, increment MAJOR version
*
* 13.0 (202
0
-03-15)
* 13.0 (202
1
-03-15)
* Calling convention for VDP implementation changed
* Added VRT_ValidHdr()
* 12.0 (2020-09-15)
* Added VRT_DirectorResolve()
* Added VCL_STRING VRT_BLOB_string(VRT_CTX, VCL_BLOB)
...
...
lib/libvmod_debug/vmod_debug.c
View file @
85a42d7d
...
...
@@ -1208,3 +1208,10 @@ xyzzy_priv_task_with_option(VRT_CTX, struct VARGS(priv_task_with_option) *args)
args
->
priv
->
priv
=
WS_Copy
(
ctx
->
ws
,
args
->
opt
,
-
1
);
return
(
args
->
priv
->
priv
);
}
VCL_BOOL
v_matchproto_
(
td_xyzzy_validhdr
)
xyzzy_validhdr
(
VRT_CTX
,
VCL_STRANDS
s
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
return
(
VRT_ValidHdr
(
ctx
,
s
));
}
lib/libvmod_debug/vmod_debug.vcc
View file @
85a42d7d
...
...
@@ -312,3 +312,7 @@ Quote an input string to be usable for an exact match in a regular expression.
$Function STRING priv_task_with_option(PRIV_TASK priv, [STRING opt])
A function mixing a named PRIV_TASK with optional parameters.
$Function BOOL validhdr(STRANDS)
Test if the argument is a valid header according to RFC7230 section 3.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