Upstream: https://github.com/openresty/lua-nginx-module/pull/1017 --- a/src/ngx_http_lua_headers.c +++ b/src/ngx_http_lua_headers.c @@ -77,6 +77,9 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L) size_t size; ngx_buf_t *b, *first = NULL; ngx_int_t i, j; +#if defined(nginx_version) && nginx_version >= 1011011 + ngx_chain_t *cl; +#endif ngx_connection_t *c; ngx_http_request_t *r, *mr; ngx_http_connection_t *hc; @@ -147,8 +150,15 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L) if (hc->nbusy) { b = NULL; + +#if defined(nginx_version) && nginx_version >= 1011011 + for (cl = hc->busy; cl; /* void */) { + b = cl->buf; + cl = cl->next; +#else for (i = 0; i < hc->nbusy; i++) { b = hc->busy[i]; +#endif dd("busy buf: %d: [%.*s]", (int) i, (int) (b->pos - b->start), b->start); @@ -223,8 +233,15 @@ ngx_http_lua_ngx_req_raw_header(lua_State *L) } if (hc->nbusy) { + +#if defined(nginx_version) && nginx_version >= 1011011 + for (cl = hc->busy; cl; /* void */) { + b = cl->buf; + cl = cl->next; +#else for (i = 0; i < hc->nbusy; i++) { b = hc->busy[i]; +#endif if (!found) { if (b != first) {