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

2017-04-06 Thread Valentin V. Bartenev
On Monday 03 April 2017 20:13:40 Piotr Sikora via nginx-devel wrote:
> # HG changeset patch
> # User Piotr Sikora 
> # Date 1490516711 25200
> #  Sun Mar 26 01:25:11 2017 -0700
> # Node ID 06d6418afe6e73604aea707ef9c5802f5bf27bf4
> # Parent  22be63bf21edaa1b8ea916c7d8cd4e5fe4892061
> HTTP/2: add debug logging of control frames.
> 
> Signed-off-by: Piotr Sikora 
> 
> diff -r 22be63bf21ed -r 06d6418afe6e src/http/v2/ngx_http_v2.c
> --- a/src/http/v2/ngx_http_v2.c
> +++ b/src/http/v2/ngx_http_v2.c
[..]
> @@ -2449,8 +2468,18 @@ ngx_http_v2_send_settings(ngx_http_v2_co
>  ngx_http_v2_srv_conf_t   *h2scf;
>  ngx_http_v2_out_frame_t  *frame;
>  
> -ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
> -   "http2 send SETTINGS frame ack:%ui", ack);
> +if (ack) {
> +ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
> +   "http2 send SETTINGS frame ack:1");
> +
> +len = 0;
> +
> +} else {
> +ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
> +   "http2 send SETTINGS frame params:3");
> +
> +len = NGX_HTTP_V2_SETTINGS_PARAM_SIZE * 3;
> +}
>  
>  frame = ngx_palloc(h2c->pool, sizeof(ngx_http_v2_out_frame_t));
>  if (frame == NULL) {
> @@ -2462,8 +2491,6 @@ ngx_http_v2_send_settings(ngx_http_v2_co
>  return NGX_ERROR;
>  }
>  
> -len = ack ? 0 : (sizeof(uint16_t) + sizeof(uint32_t)) * 3;
> -
>  buf = ngx_create_temp_buf(h2c->pool, NGX_HTTP_V2_FRAME_HEADER_SIZE + 
> len);
>  if (buf == NULL) {
>  return NGX_ERROR;
> @@ -2494,15 +2521,27 @@ ngx_http_v2_send_settings(ngx_http_v2_co
>  h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
>   ngx_http_v2_module);
>  
> +ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
> +   "http2 send SETTINGS frame 
> MAX_CONCURRENT_STREAMS:%ui",
> +   h2scf->concurrent_streams);
> +
>  buf->last = ngx_http_v2_write_uint16(buf->last,
>   
> NGX_HTTP_V2_MAX_STREAMS_SETTING);
>  buf->last = ngx_http_v2_write_uint32(buf->last,
>   h2scf->concurrent_streams);
>  
> +ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
> +   "http2 send SETTINGS frame INITIAL_WINDOW_SIZE:%uz",
> +   h2scf->preread_size);
> +
>  buf->last = ngx_http_v2_write_uint16(buf->last,
>   
> NGX_HTTP_V2_INIT_WINDOW_SIZE_SETTING);
>  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 frame MAX_FRAME_SIZE:%ud",
> +   NGX_HTTP_V2_MAX_FRAME_SIZE);
> +
>  buf->last = ngx_http_v2_write_uint16(buf->last,
> 
> NGX_HTTP_V2_MAX_FRAME_SIZE_SETTING);
>  buf->last = ngx_http_v2_write_uint32(buf->last,

You can always find these values in configuration, and I can't remember a case 
where
I've ever needed them.  On the contrary, there's always a problem with the huge 
size
of typical http/2 debug log.  So it's not a good idea to add something just 
because
we can.

  wbr, Valentin V. Bartenev

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: [PATCH] HTTP/2: add debug logging of pseudo-headers

2017-04-06 Thread Valentin V. Bartenev
On Monday 03 April 2017 20:13:34 Piotr Sikora via nginx-devel wrote:
> # HG changeset patch
> # User Piotr Sikora 
> # Date 1490516711 25200
> #  Sun Mar 26 01:25:11 2017 -0700
> # Node ID 3d72ae17c41990774721a678c50b8307ecb684c8
> # Parent  22be63bf21edaa1b8ea916c7d8cd4e5fe4892061
> HTTP/2: add debug logging of pseudo-headers.
> 
> Signed-off-by: Piotr Sikora 
> 
> diff -r 22be63bf21ed -r 3d72ae17c419 src/http/v2/ngx_http_v2.c
> --- a/src/http/v2/ngx_http_v2.c
> +++ b/src/http/v2/ngx_http_v2.c
> @@ -1585,6 +1585,10 @@ ngx_http_v2_state_process_header(ngx_htt
>  rc = ngx_http_v2_pseudo_header(r, header);
>  
>  if (rc == NGX_OK) {
> +ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
> +   "http2 http header: \":%V: %V\"",
> +   &header->name, &header->value);
> +
>  return ngx_http_v2_state_header_complete(h2c, pos, end);
>  }
>  

Maybe "http2 pseudo-header: \":%V: %V\""?
Because it doesn't look like a valid "http header".

  wbr, Valentin V. Bartenev

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel