HTTP/2: add debug logging of pseudo-headers and cookies.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
This commit is contained in:
Piotr Sikora 2017-05-30 17:42:27 +03:00
parent 92cc3059fe
commit 95955b7c04

View File

@ -1568,6 +1568,10 @@ ngx_http_v2_state_process_header(ngx_http_v2_connection_t *h2c, u_char *pos,
rc = ngx_http_v2_pseudo_header(r, header);
if (rc == NGX_OK) {
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http2 pseudo-header: \":%V: %V\"",
&header->name, &header->value);
return ngx_http_v2_state_header_complete(h2c, pos, end);
}
@ -1609,18 +1613,20 @@ ngx_http_v2_state_process_header(ngx_http_v2_connection_t *h2c, u_char *pos,
NGX_HTTP_V2_INTERNAL_ERROR);
}
return ngx_http_v2_state_header_complete(h2c, pos, end);
}
} else {
h = ngx_list_push(&r->headers_in.headers);
if (h == NULL) {
return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR);
return ngx_http_v2_connection_error(h2c,
NGX_HTTP_V2_INTERNAL_ERROR);
}
h->key.len = header->name.len;
h->key.data = header->name.data;
/* TODO Optimization: precalculate hash and handler for indexed headers. */
/*
* TODO Optimization: precalculate hash
* and handler for indexed headers.
*/
h->hash = ngx_hash_key(h->key.data, h->key.len);
h->value.len = header->value.len;
@ -1636,9 +1642,11 @@ ngx_http_v2_state_process_header(ngx_http_v2_connection_t *h2c, u_char *pos,
if (hh && hh->handler(r, h, hh->offset) != NGX_OK) {
goto error;
}
}
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http2 http header: \"%V: %V\"", &h->key, &h->value);
"http2 http header: \"%V: %V\"",
&header->name, &header->value);
return ngx_http_v2_state_header_complete(h2c, pos, end);