diff --git a/abcd b/abcd new file mode 100644 index 0000000..7926ec1 --- /dev/null +++ b/abcd @@ -0,0 +1,49 @@ + +# HG changeset patch +# User Ruslan Ermilov +# Date 1521484335 -10800 +# Node ID 190591ab0d76cef420f666522a0b1ccd70d33e3f +# Parent 413189f03c8d13d0d20bd5e44fa0e48e693badef +HTTP/2: improved frame info debugging. + +diff -r 413189f03c8d -r 190591ab0d76 src/http/v2/ngx_http_v2.c +--- a/src/http/v2/ngx_http_v2.c Mon Mar 19 16:42:56 2018 +0300 ++++ b/src/http/v2/ngx_http_v2.c Mon Mar 19 21:32:15 2018 +0300 +@@ -1990,6 +1990,9 @@ + return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR); + } + ++ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, ++ "http2 SETTINGS frame"); ++ + return ngx_http_v2_state_settings_params(h2c, pos, end); + } + +@@ -2130,8 +2133,8 @@ + 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, flags: %ud", h2c->state.flags); ++ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, ++ "http2 PING frame"); + + if (h2c->state.flags & NGX_HTTP_V2_ACK_FLAG) { + return ngx_http_v2_state_skip(h2c, pos, end); +diff -r 413189f03c8d -r 190591ab0d76 src/http/v2/ngx_http_v2_filter_module.c +--- a/src/http/v2/ngx_http_v2_filter_module.c Mon Mar 19 16:42:56 2018 +0300 ++++ b/src/http/v2/ngx_http_v2_filter_module.c Mon Mar 19 21:32:15 2018 +0300 +@@ -1169,9 +1169,9 @@ + cl->next = NULL; + frame->last = cl; + +- ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, +- "http2:%ui create HEADERS frame %p: len:%uz", +- stream->node->id, frame, frame->length); ++ ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ++ "http2:%ui create HEADERS frame %p: len:%uz fin:%ui", ++ stream->node->id, frame, frame->length, fin); + + return frame; + } + diff --git a/auto/options b/auto/options index af31f97..2e306ac 100644 --- a/auto/options +++ b/auto/options @@ -476,6 +476,7 @@ cat << END --without-http_fastcgi_module disable ngx_http_fastcgi_module --without-http_uwsgi_module disable ngx_http_uwsgi_module --without-http_scgi_module disable ngx_http_scgi_module + --without-http_grpc_module disable ngx_http_grpc_module --without-http_memcached_module disable ngx_http_memcached_module --without-http_limit_conn_module disable ngx_http_limit_conn_module --without-http_limit_req_module disable ngx_http_limit_req_module diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c index c3f5c4a..bc43f53 100644 --- a/src/http/modules/ngx_http_fastcgi_module.c +++ b/src/http/modules/ngx_http_fastcgi_module.c @@ -2706,8 +2706,6 @@ ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf) * conf->upstream.cache_methods = 0; * conf->upstream.temp_path = NULL; * conf->upstream.hide_headers_hash = { NULL, 0 }; - * conf->upstream.uri = { 0, NULL }; - * conf->upstream.location = NULL; * conf->upstream.store_lengths = NULL; * conf->upstream.store_values = NULL; * diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c index e39be53..5ec45e2 100644 --- a/src/http/modules/ngx_http_grpc_module.c +++ b/src/http/modules/ngx_http_grpc_module.c @@ -2953,7 +2953,7 @@ ngx_http_grpc_parse_fragment(ngx_http_request_t *r, ngx_http_grpc_ctx_t *ctx, ctx->name.data[ctx->name.len] = '\0'; } else { - ngx_memcpy(ctx->field_end, p, size); + ctx->field_end = ngx_cpymem(ctx->field_end, p, size); ctx->name.data[ctx->name.len] = '\0'; } @@ -3062,7 +3062,7 @@ ngx_http_grpc_parse_fragment(ngx_http_request_t *r, ngx_http_grpc_ctx_t *ctx, ctx->value.data[ctx->value.len] = '\0'; } else { - ngx_memcpy(ctx->field_end, p, size); + ctx->field_end = ngx_cpymem(ctx->field_end, p, size); ctx->value.data[ctx->value.len] = '\0'; } diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c index 69f28fa..82fa713 100644 --- a/src/http/modules/ngx_http_memcached_module.c +++ b/src/http/modules/ngx_http_memcached_module.c @@ -592,8 +592,6 @@ ngx_http_memcached_create_loc_conf(ngx_conf_t *cf) * conf->upstream.bufs.num = 0; * conf->upstream.next_upstream = 0; * conf->upstream.temp_path = NULL; - * conf->upstream.uri = { 0, NULL }; - * conf->upstream.location = NULL; */ conf->upstream.local = NGX_CONF_UNSET_PTR; diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index 252aedb..40dbc53 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c @@ -2797,13 +2797,13 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) * conf->upstream.cache_methods = 0; * conf->upstream.temp_path = NULL; * conf->upstream.hide_headers_hash = { NULL, 0 }; - * conf->upstream.uri = { 0, NULL }; - * conf->upstream.location = NULL; * conf->upstream.store_lengths = NULL; * conf->upstream.store_values = NULL; * conf->upstream.ssl_name = NULL; * * conf->method = NULL; + * conf->location = NULL; + * conf->url = { 0, NULL }; * conf->headers_source = NULL; * conf->headers.lengths = NULL; * conf->headers.values = NULL; diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index dc8098b..0c72d97 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2031,7 +2031,7 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u, } if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) { - if (ngx_tcp_push(c->fd) == NGX_ERROR) { + if (ngx_tcp_push(c->fd) == -1) { ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, ngx_tcp_push_n " failed"); ngx_http_upstream_finalize_request(r, u, diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index dc22099..303d157 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -1992,6 +1992,9 @@ ngx_http_v2_state_settings(ngx_http_v2_connection_t *h2c, u_char *pos, return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR); } + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, + "http2 SETTINGS frame"); + return ngx_http_v2_state_settings_params(h2c, pos, end); } @@ -2143,8 +2146,8 @@ ngx_http_v2_state_ping(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end) 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, flags: %ud", h2c->state.flags); + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, + "http2 PING frame"); if (h2c->state.flags & NGX_HTTP_V2_ACK_FLAG) { return ngx_http_v2_state_skip(h2c, pos, end); diff --git a/src/http/v2/ngx_http_v2_filter_module.c b/src/http/v2/ngx_http_v2_filter_module.c index 9228b46..6a09a41 100644 --- a/src/http/v2/ngx_http_v2_filter_module.c +++ b/src/http/v2/ngx_http_v2_filter_module.c @@ -1095,9 +1095,9 @@ ngx_http_v2_create_headers_frame(ngx_http_request_t *r, u_char *pos, cl->next = NULL; frame->last = cl; - ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http2:%ui create HEADERS frame %p: len:%uz", - stream->node->id, frame, frame->length); + ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http2:%ui create HEADERS frame %p: len:%uz fin:%ui", + stream->node->id, frame, frame->length, fin); return frame; } diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c index 4822e72..3d415bd 100644 --- a/src/os/unix/ngx_freebsd_sendfile_chain.c +++ b/src/os/unix/ngx_freebsd_sendfile_chain.c @@ -135,7 +135,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) if (ngx_freebsd_use_tcp_nopush && c->tcp_nopush == NGX_TCP_NOPUSH_UNSET) { - if (ngx_tcp_nopush(c->fd) == NGX_ERROR) { + if (ngx_tcp_nopush(c->fd) == -1) { err = ngx_socket_errno; /* diff --git a/src/os/unix/ngx_linux_sendfile_chain.c b/src/os/unix/ngx_linux_sendfile_chain.c index b44724c..5695839 100644 --- a/src/os/unix/ngx_linux_sendfile_chain.c +++ b/src/os/unix/ngx_linux_sendfile_chain.c @@ -130,7 +130,7 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) if (c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) { - if (ngx_tcp_nopush(c->fd) == NGX_ERROR) { + if (ngx_tcp_nopush(c->fd) == -1) { err = ngx_socket_errno; /*