Skip to content

Commit f0741a7

Browse files
committed
Merge branch 'master' into devel
2 parents 66af9ad + ba8bd2b commit f0741a7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/ngx_http_echo_subrequest.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -418,20 +418,9 @@ ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr,
418418
sr->headers_in.content_length_n = parsed_sr->content_length_n;
419419
sr->request_body = parsed_sr->request_body;
420420

421-
sr->headers_in.content_length = ngx_pcalloc(sr->pool,
422-
sizeof(ngx_table_elt_t));
423-
sr->headers_in.content_length->value.data =
424-
ngx_palloc(sr->pool, NGX_OFF_T_LEN);
425-
if (sr->headers_in.content_length->value.data == NULL) {
426-
return NGX_HTTP_INTERNAL_SERVER_ERROR;
427-
}
428-
sr->headers_in.content_length->value.len = ngx_sprintf(
429-
sr->headers_in.content_length->value.data, "%O",
430-
sr->headers_in.content_length_n) -
431-
sr->headers_in.content_length->value.data;
432-
433421
if (ngx_list_init(&sr->headers_in.headers, sr->pool, 20,
434-
sizeof(ngx_table_elt_t)) != NGX_OK) {
422+
sizeof(ngx_table_elt_t)) != NGX_OK)
423+
{
435424
return NGX_HTTP_INTERNAL_SERVER_ERROR;
436425
}
437426

@@ -440,6 +429,17 @@ ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr,
440429
return NGX_HTTP_INTERNAL_SERVER_ERROR;
441430
}
442431

432+
h->value.data = ngx_palloc(sr->pool, NGX_OFF_T_LEN);
433+
434+
if (h->value.data == NULL) {
435+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
436+
}
437+
438+
h->value.len = ngx_sprintf(h->value.data, "%z",
439+
parsed_sr->content_length_n) - h->value.data;
440+
441+
sr->headers_in.content_length = h;
442+
443443
h->hash = sr->header_hash;
444444

445445
h->key = ngx_http_echo_content_length_header_key;

0 commit comments

Comments
 (0)