Skip to content

Commit 65d8750

Browse files
bugfix: wrong pipelined request body length when request body is parent's request body. (#1814)
1 parent 8b9d7fd commit 65d8750

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ngx_http_lua_subrequest.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,7 @@ ngx_http_lua_copy_request_headers(ngx_http_request_t *sr,
16371637
{
16381638
ngx_table_elt_t *clh, *header;
16391639
ngx_list_part_t *part;
1640+
ngx_chain_t *in;
16401641
ngx_uint_t i;
16411642
u_char *p;
16421643
off_t len;
@@ -1653,8 +1654,11 @@ ngx_http_lua_copy_request_headers(ngx_http_request_t *sr,
16531654
if (sr->request_body && !pr_not_chunked) {
16541655

16551656
/* craft our own Content-Length */
1657+
len = 0;
16561658

1657-
len = sr->request_body->buf ? ngx_buf_size(sr->request_body->buf) : 0;
1659+
for (in = sr->request_body->bufs; in; in = in->next) {
1660+
len += ngx_buf_size(in->buf);
1661+
}
16581662

16591663
clh = ngx_list_push(&sr->headers_in.headers);
16601664
if (clh == NULL) {

0 commit comments

Comments
 (0)