Mercurial > hg > nginx
comparison src/http/modules/ngx_http_grpc_module.c @ 7736:a46fcf101cfc
Core: added format specifiers to output binary data as hex.
Now "s", "V", and "v" format specifiers may be prefixed with "x" (lowercase)
or "X" (uppercase) to output corresponding data in hexadecimal format.
In collaboration with Maxim Dounin.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 28 Oct 2020 10:56:11 +0300 |
parents | 1a719ee45526 |
children | 88eca63261c3 |
comparison
equal
deleted
inserted
replaced
7735:908f48bd3c2f | 7736:a46fcf101cfc |
---|---|
1139 f->stream_id_3 = 1; | 1139 f->stream_id_3 = 1; |
1140 } | 1140 } |
1141 | 1141 |
1142 f->flags |= NGX_HTTP_V2_END_HEADERS_FLAG; | 1142 f->flags |= NGX_HTTP_V2_END_HEADERS_FLAG; |
1143 | 1143 |
1144 #if (NGX_DEBUG) | 1144 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1145 if (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP) { | 1145 "grpc header: %*xs%s, len: %uz", |
1146 u_char buf[512]; | 1146 (size_t) ngx_min(b->last - b->pos, 256), b->pos, |
1147 size_t n, m; | 1147 b->last - b->pos > 256 ? "..." : "", |
1148 | 1148 b->last - b->pos); |
1149 n = ngx_min(b->last - b->pos, 256); | |
1150 m = ngx_hex_dump(buf, b->pos, n) - buf; | |
1151 | |
1152 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1153 "grpc header: %*s%s, len: %uz", | |
1154 m, buf, b->last - b->pos > 256 ? "..." : "", | |
1155 b->last - b->pos); | |
1156 } | |
1157 #endif | |
1158 | 1149 |
1159 if (r->request_body_no_buffering) { | 1150 if (r->request_body_no_buffering) { |
1160 | 1151 |
1161 u->request_bufs = cl; | 1152 u->request_bufs = cl; |
1162 | 1153 |
1602 ngx_http_upstream_main_conf_t *umcf; | 1593 ngx_http_upstream_main_conf_t *umcf; |
1603 | 1594 |
1604 u = r->upstream; | 1595 u = r->upstream; |
1605 b = &u->buffer; | 1596 b = &u->buffer; |
1606 | 1597 |
1607 #if (NGX_DEBUG) | 1598 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1608 if (r->connection->log->log_level & NGX_LOG_DEBUG_HTTP) { | 1599 "grpc response: %*xs%s, len: %uz", |
1609 u_char buf[512]; | 1600 (size_t) ngx_min(b->last - b->pos, 256), |
1610 size_t n, m; | 1601 b->pos, b->last - b->pos > 256 ? "..." : "", |
1611 | 1602 b->last - b->pos); |
1612 n = ngx_min(b->last - b->pos, 256); | |
1613 m = ngx_hex_dump(buf, b->pos, n) - buf; | |
1614 | |
1615 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1616 "grpc response: %*s%s, len: %uz", | |
1617 m, buf, b->last - b->pos > 256 ? "..." : "", | |
1618 b->last - b->pos); | |
1619 } | |
1620 #endif | |
1621 | 1603 |
1622 ctx = ngx_http_grpc_get_ctx(r); | 1604 ctx = ngx_http_grpc_get_ctx(r); |
1623 | 1605 |
1624 if (ctx == NULL) { | 1606 if (ctx == NULL) { |
1625 return NGX_ERROR; | 1607 return NGX_ERROR; |