comparison src/http/modules/ngx_http_grpc_module.c @ 7320:696df3ac27ac

SSL: save sessions for upstream peers using a callback function. In TLSv1.3, NewSessionTicket messages arrive after the handshake and can come at any time. Therefore we use a callback to save the session when we know about it. This approach works for < TLSv1.3 as well. The callback function is set once per location on merge phase. Since SSL_get_session() in BoringSSL returns an unresumable session for TLSv1.3, peer save_session() methods have been updated as well to use a session supplied within the callback. To preserve API, the session is cached in c->ssl->session. It is preferably accessed in save_session() methods by ngx_ssl_get_session() and ngx_ssl_get0_session() wrappers.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 17 Jul 2018 12:53:23 +0300
parents 6cfd45d4c754
children 45e513c3540d
comparison
equal deleted inserted replaced
7319:dcab86115261 7320:696df3ac27ac
4625 if (ngx_ssl_crl(cf, glcf->upstream.ssl, &glcf->ssl_crl) != NGX_OK) { 4625 if (ngx_ssl_crl(cf, glcf->upstream.ssl, &glcf->ssl_crl) != NGX_OK) {
4626 return NGX_ERROR; 4626 return NGX_ERROR;
4627 } 4627 }
4628 } 4628 }
4629 4629
4630 if (ngx_ssl_client_session_cache(cf, glcf->upstream.ssl,
4631 glcf->upstream.ssl_session_reuse)
4632 != NGX_OK)
4633 {
4634 return NGX_ERROR;
4635 }
4636
4630 #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation 4637 #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
4631 4638
4632 if (SSL_CTX_set_alpn_protos(glcf->upstream.ssl->ctx, 4639 if (SSL_CTX_set_alpn_protos(glcf->upstream.ssl->ctx,
4633 (u_char *) "\x02h2", 3) 4640 (u_char *) "\x02h2", 3)
4634 != 0) 4641 != 0)