Commit e8c64b5b authored by Geoff Simmons's avatar Geoff Simmons

store() method emits and error to the log and returns if the string

to be stored is NULL
parent 41abcb92
varnishtest "vtstor-vmod: test error handling"
server s1 {} -start
varnish v1 -vcl+backend {
import vtstor from "${vmod_topbuild}/src/.libs/libvmod_vtstor.so";
import std;
sub vcl_init {
new zero = vtstor.vtstor(0, 0, 0, 0);
}
sub vcl_recv {
zero.store(req.http.Foo, req.http.Bar);
return(synth(200, "OK"));
}
} -start
client c1 {
txreq -hdr "Bar: baz"
rxresp
expect resp.status == 200
} -run
logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect 0 * Begin req
expect * = VCL_Error ^vmod vtstor: store() method called with NULL string$
expect * = End
} -run
......@@ -114,6 +114,12 @@ vmod_vtstor_store(VRT_CTX, struct vmod_vtstor_vtstor *vmi,
AN(hdr);
AN(hdr->what);
if (s == NULL) {
VSLb(ctx->vsl, SLT_VCL_Error,
"vmod vtstor: store() method called with NULL string");
return;
}
hp = selecthttp(ctx, hdr->where);
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment