Skip to content

Commit 22c6cd7

Browse files
committed
Crash on update healthcheck parameters from HTTP to TCP and existing URI,BODY,METHOD
1 parent 9dba558 commit 22c6cd7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/ngx_dynamic_upstream_lua.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,13 @@ ngx_http_dynamic_upstream_lua_update_healthcheck(lua_State *L)
813813
ngx_safe_slab_free(ucscf->shpool, (void **) &ucscf->data->request_body.data);
814814
ngx_safe_slab_free(ucscf->shpool, (void **) &ucscf->data->response_body.data);
815815
ngx_safe_slab_free(ucscf->shpool, (void **) &ucscf->data->response_codes);
816+
817+
ucscf->data->type.len = 0;
818+
ucscf->data->request_uri.len = 0;
819+
ucscf->data->request_method.len = 0;
820+
ucscf->data->request_body.len = 0;
821+
ucscf->data->response_body.len = 0;
822+
816823
if (ucscf->data->request_headers) {
817824
for (i = 0; i < ucscf->data->request_headers_count; ++i) {
818825
ngx_safe_slab_free(ucscf->shpool, (void **) &ucscf->data->request_headers[i].name.data);

src/ngx_dynamic_upstream_stream_lua.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,9 @@ ngx_stream_dynamic_upstream_lua_update_healthcheck(lua_State *L)
731731
ngx_safe_slab_free(ucscf->shpool, (void **) &ucscf->data->request_body.data);
732732
ngx_safe_slab_free(ucscf->shpool, (void **) &ucscf->data->response_body.data);
733733

734+
ucscf->data->request_body.len = 0;
735+
ucscf->data->response_body.len = 0;
736+
734737
lua_getfield(L, 2, "fall");
735738
lua_getfield(L, 2, "rise");
736739
lua_getfield(L, 2, "timeout");

0 commit comments

Comments
 (0)