Mercurial > hg > nginx
changeset 8852:8fc9c7f2c533 quic
HTTP/3: added debug logging of response fields.
Because of QPACK compression it's hard to see what fields are actually
sent by the server.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 13 Sep 2021 16:25:37 +0300 |
parents | 051968b73c59 |
children | 7603284f7af5 |
files | src/http/v3/ngx_http_v3_filter_module.c |
diffstat | 1 files changed, 38 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3_filter_module.c Mon Sep 13 16:25:32 2021 +0300 +++ b/src/http/v3/ngx_http_v3_filter_module.c Mon Sep 13 16:25:37 2021 +0300 @@ -340,6 +340,10 @@ b->last = (u_char *) ngx_http_v3_encode_field_section_prefix(b->last, 0, 0, 0); + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \":status: %03ui\"", + r->headers_out.status); + if (r->headers_out.status == NGX_HTTP_OK) { b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0, NGX_HTTP_V3_HEADER_STATUS_200); @@ -365,12 +369,19 @@ n = sizeof("nginx") - 1; } + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"server: %*s\"", n, p); + b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0, NGX_HTTP_V3_HEADER_SERVER, p, n); } if (r->headers_out.date == NULL) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"date: %V\"", + &ngx_cached_http_time); + b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0, NGX_HTTP_V3_HEADER_DATE, ngx_cached_http_time.data, @@ -403,13 +414,23 @@ r->headers_out.content_type.data = p - n; } + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"content-type: %V\"", + &r->headers_out.content_type); + b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0, NGX_HTTP_V3_HEADER_CONTENT_TYPE_TEXT_PLAIN, r->headers_out.content_type.data, r->headers_out.content_type.len); } - if (r->headers_out.content_length == NULL) { + if (r->headers_out.content_length == NULL + && r->headers_out.content_length_n >= 0) + { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"content-length: %O\"", + r->headers_out.content_length_n); + if (r->headers_out.content_length_n > 0) { p = ngx_sprintf(b->last, "%O", r->headers_out.content_length_n); n = p - b->last; @@ -421,7 +442,7 @@ b->last = ngx_sprintf(b->last, "%O", r->headers_out.content_length_n); - } else if (r->headers_out.content_length_n == 0) { + } else { b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0, NGX_HTTP_V3_HEADER_CONTENT_LENGTH_ZERO); } @@ -439,12 +460,19 @@ ngx_http_time(p, r->headers_out.last_modified_time); + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"last-modified: %*s\"", n, p); + b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0, NGX_HTTP_V3_HEADER_LAST_MODIFIED, p, n); } if (r->headers_out.location && r->headers_out.location->value.len) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"location: %V\"", + &r->headers_out.location->value); + b->last = (u_char *) ngx_http_v3_encode_field_lri(b->last, 0, NGX_HTTP_V3_HEADER_LOCATION, r->headers_out.location->value.data, @@ -453,6 +481,9 @@ #if (NGX_HTTP_GZIP) if (r->gzip_vary) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"vary: Accept-Encoding\""); + b->last = (u_char *) ngx_http_v3_encode_field_ri(b->last, 0, NGX_HTTP_V3_HEADER_VARY_ACCEPT_ENCODING); } @@ -477,6 +508,10 @@ continue; } + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 output header: \"%V: %V\"", + &header[i].key, &header[i].value); + b->last = (u_char *) ngx_http_v3_encode_field_l(b->last, &header[i].key, &header[i].value); @@ -1417,7 +1452,7 @@ } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http3 trailer: \"%V: %V\"", + "http3 output trailer: \"%V: %V\"", &header[i].key, &header[i].value); b->last = (u_char *) ngx_http_v3_encode_field_l(b->last,