Commit 273d0c05 authored by Nils Goroll's avatar Nils Goroll

handle NULL input

parent c6423d0f
...@@ -231,6 +231,10 @@ vmod_parser_parse(VRT_CTX, struct vmod_frozen_parser *vfpaa, ...@@ -231,6 +231,10 @@ vmod_parser_parse(VRT_CTX, struct vmod_frozen_parser *vfpaa,
INIT_FROZEN_ARGS(args); INIT_FROZEN_ARGS(args);
args->limit = vfpa->limit; args->limit = vfpa->limit;
if (s == NULL) {
return (0);
}
if (vfpa->n_expect == 0) if (vfpa->n_expect == 0)
return (!! json_walk_args(s, strlen(s), args)); return (!! json_walk_args(s, strlen(s), args));
......
...@@ -28,6 +28,7 @@ varnish v1 -vcl+backend { ...@@ -28,6 +28,7 @@ varnish v1 -vcl+backend {
return (synth(200)); return (synth(200));
} }
sub vcl_synth { sub vcl_synth {
set resp.http.fail = p_test.parse(req.http.not);
set resp.http.parse = set resp.http.parse =
p_test.parse({"{ a: 1, b: "hi there", c: true, d: false, "} + p_test.parse({"{ a: 1, b: "hi there", c: true, d: false, "} +
{" e : null, f: [ 1, -2, 3], g: { "1": [], h: [ 7 ] } } "}); {" e : null, f: [ 1, -2, 3], g: { "1": [], h: [ 7 ] } } "});
...@@ -70,6 +71,8 @@ client c1 { ...@@ -70,6 +71,8 @@ client c1 {
txreq txreq
rxresp rxresp
expect resp.status == 200 expect resp.status == 200
expect resp.http.fail == false
expect resp.http.parse == true
expect resp.http.a == 1 expect resp.http.a == 1
expect resp.http.a-type == NUMBER expect resp.http.a-type == NUMBER
expect resp.http.b == "hi there" expect resp.http.b == "hi there"
......
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