aboutsummaryrefslogtreecommitdiff
path: root/src/http/v2/ngx_http_v2.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2016-07-19 20:30:21 +0300
committerValentin Bartenev <vbart@nginx.com>2016-07-19 20:30:21 +0300
commitce6eb33d15f1efd3c418ce7688ed6de3af81cae9 (patch)
treeb9963cfe2afe37cd5b96d61e649d4a3fc2988617 /src/http/v2/ngx_http_v2.c
parentda852aa468db80f9e5138aea81a1bebb90e0be51 (diff)
downloadnginx-ce6eb33d15f1efd3c418ce7688ed6de3af81cae9.tar.gz
nginx-ce6eb33d15f1efd3c418ce7688ed6de3af81cae9.zip
HTTP/2: avoid sending output queue if there's nothing to send.
Particularly this fixes alerts on OS X and NetBSD systems when HTTP/2 is configured over plain TCP sockets. On these systems calling writev() with no data leads to EINVAL errors being logged as "writev() failed (22: Invalid argument) while processing HTTP/2 connection".
Diffstat (limited to 'src/http/v2/ngx_http_v2.c')
-rw-r--r--src/http/v2/ngx_http_v2.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 7e4736b60..959e3a6f3 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -410,6 +410,16 @@ ngx_http_v2_write_handler(ngx_event_t *wev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http2 write handler");
+ if (h2c->last_out == NULL && !c->buffered) {
+
+ if (wev->timer_set) {
+ ngx_del_timer(wev);
+ }
+
+ ngx_http_v2_handle_connection(h2c);
+ return;
+ }
+
h2c->blocked = 1;
rc = ngx_http_v2_send_output_queue(h2c);