Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2020-12-08 01:43:36 +0300
committerRuslan Ermilov <ru@nginx.com>2020-12-08 01:43:36 +0300
commite62a5132ca6ab74f324bf46fe91ee89e1951578c (patch)
treeaf6466408c02d152c872216911b66e004e6a5140
parentcfa669151e605410cfb57cc70b0e4023f4777602 (diff)
SSL: fixed SSL shutdown on lingering close.
Ensure c->recv is properly reset to ngx_recv if SSL_shutdown() blocks on writing. The bug had appeared in 554c6ae25ffc.
-rw-r--r--src/event/ngx_event_openssl.c4
-rw-r--r--src/http/ngx_http_request.c2
-rw-r--r--src/http/v2/ngx_http_v2.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index fd2b92ffc..93a6ae46e 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -2880,6 +2880,7 @@ ngx_ssl_shutdown(ngx_connection_t *c)
SSL_free(c->ssl->connection);
c->ssl = NULL;
+ c->recv = ngx_recv;
return NGX_OK;
}
@@ -2925,6 +2926,7 @@ ngx_ssl_shutdown(ngx_connection_t *c)
if (n == 1) {
SSL_free(c->ssl->connection);
c->ssl = NULL;
+ c->recv = ngx_recv;
return NGX_OK;
}
@@ -2967,6 +2969,7 @@ ngx_ssl_shutdown(ngx_connection_t *c)
if (sslerr == SSL_ERROR_ZERO_RETURN || ERR_peek_error() == 0) {
SSL_free(c->ssl->connection);
c->ssl = NULL;
+ c->recv = ngx_recv;
return NGX_OK;
}
@@ -2977,6 +2980,7 @@ ngx_ssl_shutdown(ngx_connection_t *c)
SSL_free(c->ssl->connection);
c->ssl = NULL;
+ c->recv = ngx_recv;
return NGX_ERROR;
}
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 12a68a961..e954c7c25 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -3397,8 +3397,6 @@ ngx_http_set_lingering_close(ngx_connection_t *c)
c->ssl->handler = ngx_http_set_lingering_close;
return;
}
-
- c->recv = ngx_recv;
}
#endif
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 58916a184..77b60d42e 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -739,8 +739,6 @@ ngx_http_v2_lingering_close(ngx_connection_t *c)
c->ssl->handler = ngx_http_v2_lingering_close;
return;
}
-
- c->recv = ngx_recv;
}
#endif