[PATCH 2 of 2] HTTP/2: fix $body_bytes_sent variable

Piotr Sikora piotrsikora at google.com
Sun Mar 26 08:41:10 UTC 2017


# HG changeset patch
# User Piotr Sikora <piotrsikora at google.com>
# Date 1490516703 25200
#      Sun Mar 26 01:25:03 2017 -0700
# Node ID dd6c656ed7a327641b2ddfc34768f9551e44bb0f
# Parent  74ee816e712ee3b731437947470383555653338d
HTTP/2: fix $body_bytes_sent variable.

Previously, its value included payloads and frame headers of HEADERS
and CONTINUATION frames.

Signed-off-by: Piotr Sikora <piotrsikora at google.com>

diff -r 74ee816e712e -r dd6c656ed7a3 src/http/v2/ngx_http_v2_filter_module.c
--- a/src/http/v2/ngx_http_v2_filter_module.c
+++ b/src/http/v2/ngx_http_v2_filter_module.c
@@ -1211,6 +1211,9 @@ ngx_http_v2_headers_frame_handler(ngx_ht
                    "http2:%ui HEADERS frame %p was sent",
                    stream->node->id, frame);
 
+    stream->request->header_size += NGX_HTTP_V2_FRAME_HEADER_SIZE
+                                    + frame->length;
+
     ngx_http_v2_handle_frame(stream, frame);
 
     ngx_http_v2_handle_stream(h2c, stream);


More information about the nginx-devel mailing list