@@ -418,20 +418,9 @@ ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr,
418
418
sr -> headers_in .content_length_n = parsed_sr -> content_length_n ;
419
419
sr -> request_body = parsed_sr -> request_body ;
420
420
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
-
433
421
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
+ {
435
424
return NGX_HTTP_INTERNAL_SERVER_ERROR ;
436
425
}
437
426
@@ -440,6 +429,17 @@ ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr,
440
429
return NGX_HTTP_INTERNAL_SERVER_ERROR ;
441
430
}
442
431
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
+
443
443
h -> hash = sr -> header_hash ;
444
444
445
445
h -> key = ngx_http_echo_content_length_header_key ;
0 commit comments