Mercurial > hg > nginx-quic
comparison src/http/v2/ngx_http_v2.c @ 7016:ab6ef3037840
HTTP/2: add debug logging of pseudo-headers and cookies.
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
author | Piotr Sikora <piotrsikora@google.com> |
---|---|
date | Tue, 30 May 2017 17:42:27 +0300 |
parents | ed1101bbf19f |
children | 645ed7112a01 |
comparison
equal
deleted
inserted
replaced
7015:dfed742c0183 | 7016:ab6ef3037840 |
---|---|
1566 | 1566 |
1567 if (header->name.data[0] == ':') { | 1567 if (header->name.data[0] == ':') { |
1568 rc = ngx_http_v2_pseudo_header(r, header); | 1568 rc = ngx_http_v2_pseudo_header(r, header); |
1569 | 1569 |
1570 if (rc == NGX_OK) { | 1570 if (rc == NGX_OK) { |
1571 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1572 "http2 pseudo-header: \":%V: %V\"", | |
1573 &header->name, &header->value); | |
1574 | |
1571 return ngx_http_v2_state_header_complete(h2c, pos, end); | 1575 return ngx_http_v2_state_header_complete(h2c, pos, end); |
1572 } | 1576 } |
1573 | 1577 |
1574 if (rc == NGX_ABORT) { | 1578 if (rc == NGX_ABORT) { |
1575 goto error; | 1579 goto error; |
1607 if (ngx_http_v2_cookie(r, header) != NGX_OK) { | 1611 if (ngx_http_v2_cookie(r, header) != NGX_OK) { |
1608 return ngx_http_v2_connection_error(h2c, | 1612 return ngx_http_v2_connection_error(h2c, |
1609 NGX_HTTP_V2_INTERNAL_ERROR); | 1613 NGX_HTTP_V2_INTERNAL_ERROR); |
1610 } | 1614 } |
1611 | 1615 |
1612 return ngx_http_v2_state_header_complete(h2c, pos, end); | 1616 } else { |
1613 } | 1617 h = ngx_list_push(&r->headers_in.headers); |
1614 | 1618 if (h == NULL) { |
1615 h = ngx_list_push(&r->headers_in.headers); | 1619 return ngx_http_v2_connection_error(h2c, |
1616 if (h == NULL) { | 1620 NGX_HTTP_V2_INTERNAL_ERROR); |
1617 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); | 1621 } |
1618 } | 1622 |
1619 | 1623 h->key.len = header->name.len; |
1620 h->key.len = header->name.len; | 1624 h->key.data = header->name.data; |
1621 h->key.data = header->name.data; | 1625 |
1622 | 1626 /* |
1623 /* TODO Optimization: precalculate hash and handler for indexed headers. */ | 1627 * TODO Optimization: precalculate hash |
1624 h->hash = ngx_hash_key(h->key.data, h->key.len); | 1628 * and handler for indexed headers. |
1625 | 1629 */ |
1626 h->value.len = header->value.len; | 1630 h->hash = ngx_hash_key(h->key.data, h->key.len); |
1627 h->value.data = header->value.data; | 1631 |
1628 | 1632 h->value.len = header->value.len; |
1629 h->lowcase_key = h->key.data; | 1633 h->value.data = header->value.data; |
1630 | 1634 |
1631 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); | 1635 h->lowcase_key = h->key.data; |
1632 | 1636 |
1633 hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash, | 1637 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
1634 h->lowcase_key, h->key.len); | 1638 |
1635 | 1639 hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash, |
1636 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { | 1640 h->lowcase_key, h->key.len); |
1637 goto error; | 1641 |
1642 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { | |
1643 goto error; | |
1644 } | |
1638 } | 1645 } |
1639 | 1646 |
1640 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1647 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1641 "http2 http header: \"%V: %V\"", &h->key, &h->value); | 1648 "http2 http header: \"%V: %V\"", |
1649 &header->name, &header->value); | |
1642 | 1650 |
1643 return ngx_http_v2_state_header_complete(h2c, pos, end); | 1651 return ngx_http_v2_state_header_complete(h2c, pos, end); |
1644 | 1652 |
1645 error: | 1653 error: |
1646 | 1654 |