Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: abbreviated SSL handshake may interact badly w...

Ruslan Ermilov
April 06, 2015 05:08PM
details: http://hg.nginx.org/nginx/rev/643f2ce02f1c
branches:
changeset: 6068:643f2ce02f1c
user: Ruslan Ermilov <ru@nginx.com>
date: Tue Apr 07 00:07:04 2015 +0300
description:
Upstream: abbreviated SSL handshake may interact badly with Nagle.

diffstat:

src/http/ngx_http_upstream.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r 231a5bbd9e9c -r 643f2ce02f1c src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Mon Apr 06 19:20:36 2015 +0300
+++ b/src/http/ngx_http_upstream.c Tue Apr 07 00:07:04 2015 +0300
@@ -1448,7 +1448,9 @@ static void
ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r,
ngx_http_upstream_t *u, ngx_connection_t *c)
{
- ngx_int_t rc;
+ int tcp_nodelay;
+ ngx_int_t rc;
+ ngx_http_core_loc_conf_t *clcf;

if (ngx_http_upstream_test_connect(c) != NGX_OK) {
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
@@ -1481,6 +1483,28 @@ ngx_http_upstream_ssl_init_connection(ng
NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
+
+ /* abbreviated SSL handshake may interact badly with Nagle */
+
+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+
+ if (clcf->tcp_nodelay && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) {
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay");
+
+ tcp_nodelay = 1;
+
+ if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
+ (const void *) &tcp_nodelay, sizeof(int)) == -1)
+ {
+ ngx_connection_error(c, ngx_socket_errno,
+ "setsockopt(TCP_NODELAY) failed");
+ ngx_http_upstream_finalize_request(r, u,
+ NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
+ c->tcp_nodelay = NGX_TCP_NODELAY_SET;
+ }
}

r->connection->log->action = "SSL handshaking to upstream";

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: abbreviated SSL handshake may interact badly w...

Ruslan Ermilov 457 April 06, 2015 05:08PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 298
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready