[PATCH 03 of 14] HTTP/2: add debug logging of control frames

Valentin V. Bartenev vbart at nginx.com
Mon Jul 3 13:58:47 UTC 2017


On Thursday 22 June 2017 13:33:07 Piotr Sikora via nginx-devel wrote:
> # HG changeset patch
> # User Piotr Sikora <piotrsikora at google.com>
> # Date 1490516711 25200
> #      Sun Mar 26 01:25:11 2017 -0700
> # Node ID 22d178a11e30c4a8576c3ce28859dfe1cc8adec0
> # Parent  a147dd50ee3fb8628b79f4482c552c7c2852a732
> HTTP/2: add debug logging of control frames.
> 
> Signed-off-by: Piotr Sikora <piotrsikora at google.com>
> 
[..]

I suggest to make messages a bit more readable this way:

diff -r ee638caf7f73 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Sun Mar 26 01:25:11 2017 -0700
+++ b/src/http/v2/ngx_http_v2.c Mon Jul 03 16:56:01 2017 +0300
@@ -1949,7 +1949,7 @@ ngx_http_v2_state_settings(ngx_http_v2_c
         }
 
         ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                       "http2 SETTINGS frame ack:1");
+                       "http2 SETTINGS ACK frame");
 
         h2c->settings_ack = 1;
 
@@ -1965,7 +1965,7 @@ ngx_http_v2_state_settings(ngx_http_v2_c
     }
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 SETTINGS frame params:%uz",
+                   "http2 SETTINGS frame with %uz params",
                    h2c->state.length / NGX_HTTP_V2_SETTINGS_PARAM_SIZE);
 
     return ngx_http_v2_state_settings_params(h2c, pos, end);
@@ -1998,21 +1998,21 @@ ngx_http_v2_state_settings_params(ngx_ht
         case NGX_HTTP_V2_HEADER_TABLE_SIZE_SETTING:
 
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                           "http2 SETTINGS param HEADER_TABLE_SIZE:%ui "
+                           "http2 SETTINGS param HEADER_TABLE_SIZE: %ui "
                            "(ignored)", value);
             break;
 
         case NGX_HTTP_V2_ENABLE_PUSH_SETTING:
 
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                           "http2 SETTINGS param ENABLE_PUSH:%ui "
+                           "http2 SETTINGS param ENABLE_PUSH: %ui "
                            "(ignored)", value);
             break;
 
         case NGX_HTTP_V2_MAX_STREAMS_SETTING:
 
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                           "http2 SETTINGS param MAX_CONCURRENT_STREAMS:%ui "
+                           "http2 SETTINGS param MAX_CONCURRENT_STREAMS: %ui "
                            "(ignored)", value);
             break;
 
@@ -2028,7 +2028,7 @@ ngx_http_v2_state_settings_params(ngx_ht
             }
 
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                           "http2 SETTINGS param INITIAL_WINDOW_SIZE:%ui",
+                           "http2 SETTINGS param INITIAL_WINDOW_SIZE: %ui",
                            value);
 
             window_delta = value - h2c->init_window;
@@ -2050,7 +2050,7 @@ ngx_http_v2_state_settings_params(ngx_ht
             }
 
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                           "http2 SETTINGS param MAX_FRAME_SIZE:%ui",
+                           "http2 SETTINGS param MAX_FRAME_SIZE: %ui",
                            value);
 
             h2c->frame_size = value;
@@ -2059,15 +2059,15 @@ ngx_http_v2_state_settings_params(ngx_ht
         case NGX_HTTP_V2_HEADER_LIST_SIZE_SETTING:
 
             ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                           "http2 SETTINGS param MAX_HEADER_LIST_SIZE:%ui "
+                           "http2 SETTINGS param MAX_HEADER_LIST_SIZE: %ui "
                            "(ignored)", value);
             break;
 
         default:
 
             ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                           "http2 SETTINGS param 0x%Xi:%ui "
-                           "(ignored)", id, value);
+                           "http2 unknown SETTINGS param id:0x%Xi value:%ui",
+                           id, value);
             break;
         }
 
@@ -2075,7 +2075,7 @@ ngx_http_v2_state_settings_params(ngx_ht
     }
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 send SETTINGS frame ack:1");
+                   "http2 send SETTINGS ACK frame");
 
     frame = ngx_http_v2_get_frame(h2c, NGX_HTTP_V2_SETTINGS_ACK_SIZE,
                                   NGX_HTTP_V2_SETTINGS_FRAME,
@@ -2126,16 +2126,18 @@ ngx_http_v2_state_ping(ngx_http_v2_conne
         return ngx_http_v2_state_save(h2c, pos, end, ngx_http_v2_state_ping);
     }
 
-    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 PING frame ack:%ud",
-                   h2c->state.flags & NGX_HTTP_V2_ACK_FLAG ? 1 : 0);
-
     if (h2c->state.flags & NGX_HTTP_V2_ACK_FLAG) {
+        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
+                      "http2 PING ACK frame",
+
         return ngx_http_v2_state_skip(h2c, pos, end);
     }
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 send PING frame ack:1");
+                   "http2 PING frame",
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
+                   "http2 send PING ACK frame");
 
     frame = ngx_http_v2_get_frame(h2c, NGX_HTTP_V2_PING_SIZE,
                                   NGX_HTTP_V2_PING_FRAME,
@@ -2551,7 +2553,7 @@ ngx_http_v2_send_settings(ngx_http_v2_co
     len = NGX_HTTP_V2_SETTINGS_PARAM_SIZE * 3;
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 send SETTINGS frame params:%uz",
+                   "http2 send SETTINGS frame with %uz params",
                    len / NGX_HTTP_V2_SETTINGS_PARAM_SIZE);
 
     frame = ngx_palloc(h2c->pool, sizeof(ngx_http_v2_out_frame_t));
@@ -2594,7 +2596,7 @@ ngx_http_v2_send_settings(ngx_http_v2_co
                                          ngx_http_v2_module);
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 send SETTINGS param MAX_CONCURRENT_STREAMS:%ui",
+                   "http2 send SETTINGS param MAX_CONCURRENT_STREAMS: %ui",
                    h2scf->concurrent_streams);
 
     buf->last = ngx_http_v2_write_uint16(buf->last,
@@ -2603,7 +2605,7 @@ ngx_http_v2_send_settings(ngx_http_v2_co
                                          h2scf->concurrent_streams);
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 send SETTINGS param INITIAL_WINDOW_SIZE:%uz",
+                   "http2 send SETTINGS param INITIAL_WINDOW_SIZE: %uz",
                    h2scf->preread_size);
 
     buf->last = ngx_http_v2_write_uint16(buf->last,
@@ -2611,7 +2613,7 @@ ngx_http_v2_send_settings(ngx_http_v2_co
     buf->last = ngx_http_v2_write_uint32(buf->last, h2scf->preread_size);
 
     ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
-                   "http2 send SETTINGS param MAX_FRAME_SIZE:%ud",
+                   "http2 send SETTINGS param MAX_FRAME_SIZE: %ud",
                    NGX_HTTP_V2_MAX_FRAME_SIZE);
 
     buf->last = ngx_http_v2_write_uint16(buf->last,



More information about the nginx-devel mailing list