Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

now we allow empty parameters in the redis2_query directive.

  • Loading branch information...
commit d10631b5de1da78f779c75886bc4263bbaae18fe 1 parent a125be5
@agentzh agentzh authored
Showing with 25 additions and 3 deletions.
  1. +6 −3 src/ngx_http_redis2_module.c
  2. +19 −0 t/bugs.t
View
9 src/ngx_http_redis2_module.c
@@ -343,13 +343,16 @@ ngx_http_redis2_query(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR;
}
- *arg = ngx_palloc(cf->pool,
- sizeof(ngx_http_complex_value_t));
-
+ *arg = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t));
if (*arg == NULL) {
return NGX_CONF_ERROR;
}
+ if (value[i].len == 0) {
+ ngx_memzero(*arg, sizeof(ngx_http_complex_value_t));
+ continue;
+ }
+
ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
ccv.cf = cf;
ccv.value = &value[i];
View
19 t/bugs.t
@@ -179,3 +179,22 @@ qq{+OK\r
\$18\r\na 1line \r\n and 2nd\r
}
+
+
+=== TEST 6: set empty param
+--- config
+ location /set {
+ redis2_query flushall;
+ redis2_query set foo "";
+ redis2_query get foo;
+ redis2_pass 127.0.0.1:$TEST_NGINX_REDIS_PORT;
+ }
+--- request
+ GET /set
+--- response_body eval
+qq{+OK\r
++OK\r
+\$0\r
+\r
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.