From 2d4697dbbec7dd51ed5aeebb10e543038e15a359 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Tue, 19 Feb 2019 20:25:25 +0300 Subject: Validation and normalization of request host. --- src/nxt_h1proto.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/nxt_h1proto.c') diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c index 2194e56f..4e1b22e9 100644 --- a/src/nxt_h1proto.c +++ b/src/nxt_h1proto.c @@ -526,9 +526,7 @@ nxt_h1p_conn_request_header_parse(nxt_task_t *task, void *obj, void *data) return; } - /* ret == NXT_ERROR */ - status = NXT_HTTP_BAD_REQUEST; - + status = ret; goto error; case NXT_AGAIN: -- cgit From 444b9ffea90c3d3f8c06421a03f027c889b4a1e2 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 26 Feb 2019 19:12:16 +0300 Subject: Keepalive mode is disabled on HTTP header parsing errors. --- src/nxt_h1proto.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nxt_h1proto.c') diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c index 4e1b22e9..b5b5d6e6 100644 --- a/src/nxt_h1proto.c +++ b/src/nxt_h1proto.c @@ -563,6 +563,8 @@ nxt_h1p_conn_request_header_parse(nxt_task_t *task, void *obj, void *data) error: + h1p->keepalive = 0; + nxt_http_request_error(task, r, status); } -- cgit From 834e8ca576868c5ecd104bd5ebec9968c7f80a0b Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 28 Feb 2019 18:04:11 +0300 Subject: Fixed timer and event race condition. When idle timeout occurs at the same time as a request comes in, the timer handler closes connection while the read event triggers request processing, and this eventually leads to segmentation fault. --- src/nxt_h1proto.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nxt_h1proto.c') diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c index b5b5d6e6..07e3c7bc 100644 --- a/src/nxt_h1proto.c +++ b/src/nxt_h1proto.c @@ -1220,6 +1220,7 @@ nxt_h1p_conn_request_timeout(nxt_task_t *task, void *obj, void *data) nxt_debug(task, "h1p conn request timeout"); c = nxt_read_timer_conn(timer); + c->block_read = 1; /* * Disable SO_LINGER off during socket closing * to send "408 Request Timeout" error response. @@ -1250,6 +1251,7 @@ nxt_h1p_conn_request_send_timeout(nxt_task_t *task, void *obj, void *data) nxt_debug(task, "h1p conn request send timeout"); c = nxt_write_timer_conn(timer); + c->block_write = 1; h1p = c->socket.data; nxt_h1p_request_error(task, h1p, h1p->request); @@ -1464,6 +1466,7 @@ nxt_h1p_idle_timeout(nxt_task_t *task, void *obj, void *data) nxt_debug(task, "h1p idle timeout"); c = nxt_read_timer_conn(timer); + c->block_read = 1; nxt_h1p_idle_response(task, c); } @@ -1559,6 +1562,7 @@ nxt_h1p_idle_response_timeout(nxt_task_t *task, void *obj, void *data) nxt_debug(task, "h1p idle timeout response timeout"); c = nxt_read_timer_conn(timer); + c->block_write = 1; nxt_h1p_shutdown(task, c); } -- cgit