Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-vslp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-vslp
Commits
14ff8ae8
Commit
14ff8ae8
authored
Jul 21, 2014
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle null pointer string arguments to backend_by_string and backend_by_string_hash
parent
72c66a91
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
v01004.vtc
src/tests/v01004.vtc
+22
-8
vmod_vslp.c
src/vmod_vslp.c
+2
-2
No files found.
src/tests/v01004.vtc
View file @
14ff8ae8
...
@@ -3,6 +3,10 @@ varnishtest "VSLP director String"
...
@@ -3,6 +3,10 @@ varnishtest "VSLP director String"
server s1 {
server s1 {
rxreq
rxreq
txresp -body "ech3Ooj"
txresp -body "ech3Ooj"
rxreq
txresp -body "ech3Ooj"
rxreq
txresp -body "ech3Ooj"
} -start
} -start
server s2 {
server s2 {
...
@@ -28,20 +32,22 @@ varnish v1 -vcl+backend {
...
@@ -28,20 +32,22 @@ varnish v1 -vcl+backend {
}
}
sub recv_sub {
sub recv_sub {
if(req.url == "/3") {
set req.backend_hint = vd.backend_by_string_hash(req.http.X-Hash, RS);
set req.backend_hint = vd.backend_by_string_hash(req.http.X-Hash, RS);
}
}
}
sub vcl_recv {
sub vcl_recv {
if(req.url == "/1") {
if(req.url == "/1") {
set req.backend_hint = vd.backend_by_string("/eishoSu2");
set req.backend_hint = vd.backend_by_string("/eishoSu2");
}
} else if (req.url == "/2") {
if(req.url == "/2") {
set req.backend_hint = vd.backend_by_string_hash("/eishoSu2", SHA256);
set req.backend_hint = vd.backend_by_string_hash("/eishoSu2", SHA256);
}
}
else if (req.url == "/3") {
set req.http.X-Hash = "/oob3dahS";
set req.http.X-Hash = "/oob3dahS";
call recv_sub;
call recv_sub;
} else if (req.url == "/null_by_string") {
set req.backend_hint = vd.backend_by_string(req.http.NonExistent);
} else if (req.url == "/null_by_string_hash") {
set req.backend_hint = vd.backend_by_string_hash(req.http.NonExistent, SHA256);
}
return(pass);
return(pass);
}
}
...
@@ -60,4 +66,12 @@ client c1 {
...
@@ -60,4 +66,12 @@ client c1 {
txreq -url /3
txreq -url /3
rxresp
rxresp
expect resp.body == "xiuFi3Pe"
expect resp.body == "xiuFi3Pe"
txreq -url /null_by_string
rxresp
expect resp.body == "ech3Ooj"
txreq -url /null_by_string_hash
rxresp
expect resp.body == "ech3Ooj"
} -run
} -run
src/vmod_vslp.c
View file @
14ff8ae8
...
@@ -166,7 +166,7 @@ vmod_vslp_backend_by_string(const struct vrt_ctx *ctx, struct vmod_vslp_vslp *vs
...
@@ -166,7 +166,7 @@ vmod_vslp_backend_by_string(const struct vrt_ctx *ctx, struct vmod_vslp_vslp *vs
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vslpd
,
VMOD_VSLP_VSLP_MAGIC
);
CHECK_OBJ_NOTNULL
(
vslpd
,
VMOD_VSLP_VSLP_MAGIC
);
hash
=
vslpd
->
vslpd
->
hash_fp
(
s
);
hash
=
vslpd
->
vslpd
->
hash_fp
(
s
?
s
:
""
);
be
=
vslpdir_pick_be
(
vslpd
->
vslpd
,
ctx
,
hash
);
be
=
vslpdir_pick_be
(
vslpd
->
vslpd
,
ctx
,
hash
);
return
(
be
);
return
(
be
);
...
@@ -183,7 +183,7 @@ vmod_vslp_backend_by_string_hash(const struct vrt_ctx *ctx, struct vmod_vslp_vsl
...
@@ -183,7 +183,7 @@ vmod_vslp_backend_by_string_hash(const struct vrt_ctx *ctx, struct vmod_vslp_vsl
CHECK_OBJ_NOTNULL
(
vslpd
,
VMOD_VSLP_VSLP_MAGIC
);
CHECK_OBJ_NOTNULL
(
vslpd
,
VMOD_VSLP_VSLP_MAGIC
);
hash_fp
=
vslp_get_hash_fp
(
hash_m
);
hash_fp
=
vslp_get_hash_fp
(
hash_m
);
hash
=
hash_fp
(
s
);
hash
=
hash_fp
(
s
?
s
:
""
);
be
=
vslpdir_pick_be
(
vslpd
->
vslpd
,
ctx
,
hash
);
be
=
vslpdir_pick_be
(
vslpd
->
vslpd
,
ctx
,
hash
);
return
(
be
);
return
(
be
);
...
...
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