Skip to content

Commit 2080eea

Browse files
committed
Wrap ngx_table_elt_t operations into version checks
1 parent def29fb commit 2080eea

4 files changed

+9
-1
lines changed

src/ngx_http_lua_control.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ ngx_http_lua_ngx_redirect(lua_State *L)
280280

281281
h->value.len = len;
282282
h->value.data = uri;
283+
#if defined(nginx_version) && nginx_version >= 1023000
283284
h->next = NULL;
285+
#endif
284286
ngx_str_set(&h->key, "Location");
285287

286288
r->headers_out.status = rc;

src/ngx_http_lua_headers_in.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ ngx_http_set_header_helper(ngx_http_request_t *r, ngx_http_lua_header_val_t *hv,
280280

281281
h->key = hv->key;
282282
h->value = *value;
283+
#if defined(nginx_version) && nginx_version >= 1023000
283284
h->next = NULL;
285+
#endif
284286

285287
h->lowcase_key = ngx_pnalloc(r->pool, h->key.len);
286288
if (h->lowcase_key == NULL) {

src/ngx_http_lua_headers_out.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ ngx_http_set_header_helper(ngx_http_request_t *r, ngx_http_lua_header_val_t *hv,
229229

230230
h->key = hv->key;
231231
h->value = *value;
232+
#if defined(nginx_version) && nginx_version >= 1023000
232233
h->next = NULL;
234+
#endif
233235

234236
h->lowcase_key = ngx_pnalloc(r->pool, h->key.len);
235237
if (h->lowcase_key == NULL) {
@@ -445,7 +447,6 @@ ngx_http_set_builtin_multi_header(ngx_http_request_t *r,
445447
}
446448

447449
ho->key = hv->key;
448-
ho->next = NULL;
449450
*ph = ho;
450451

451452
return NGX_OK;

src/ngx_http_lua_subrequest.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,9 @@ ngx_http_lua_copy_request_headers(ngx_http_request_t *sr,
16671667

16681668
clh->hash = ngx_http_lua_content_length_hash;
16691669
clh->key = ngx_http_lua_content_length_header_key;
1670+
#if defined(nginx_version) && nginx_version >= 1023000
1671+
clh->next = NULL;
1672+
#endif
16701673
clh->lowcase_key = ngx_pnalloc(sr->pool, clh->key.len);
16711674
if (clh->lowcase_key == NULL) {
16721675
return NGX_ERROR;

0 commit comments

Comments
 (0)