summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream.c17
-rw-r--r--src/http/ngx_http_upstream.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 66163548a..2e4b2b48f 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1771,6 +1771,23 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r,
}
}
+#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
+
+ if (u->ssl_alpn_protocol.len) {
+ if (SSL_set_alpn_protos(c->ssl->connection, u->ssl_alpn_protocol.data,
+ u->ssl_alpn_protocol.len)
+ != 0)
+ {
+ ngx_ssl_error(NGX_LOG_ERR, c->log, 0,
+ "SSL_set_alpn_protos() failed");
+ ngx_http_upstream_finalize_request(r, u,
+ NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ }
+
+#endif
+
if (u->conf->ssl_session_reuse) {
c->ssl->save_session = ngx_http_upstream_ssl_save_session;
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
index 64d70cfea..3afe6e8f9 100644
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -390,6 +390,7 @@ struct ngx_http_upstream_s {
#if (NGX_HTTP_SSL || NGX_COMPAT)
ngx_str_t ssl_name;
+ ngx_str_t ssl_alpn_protocol;
#endif
ngx_http_cleanup_pt *cleanup;