diff --git a/core/socket.c b/core/socket.c index a125cbc23..323c05a00 100644 --- a/core/socket.c +++ b/core/socket.c @@ -1160,6 +1160,21 @@ void uwsgi_add_socket_from_fd(struct uwsgi_socket *uwsgi_sock, int fd) { uwsgi_log("uwsgi zerg socket %d attached to INET address %s fd %d\n", uwsgi_get_socket_num(uwsgi_sock), computed_addr, uwsgi_sock->fd); } else { + struct uwsgi_socket *us = uwsgi.sockets; + while (us) { + /* + * Apply SSL configuration for https-socket + * under the same name to the the socket received form + * systemd or upstart. + */ + if (!strcmp(us->name, computed_addr)) { + uwsgi_sock->proto_name = uwsgi_concat2(us->proto_name, ""); + uwsgi_sock->ssl_ctx = us->ssl_ctx; + us->ssl_ctx = NULL; + break; + } + us = us->next; + } uwsgi_log("uwsgi socket %d attached to INET address %s fd %d\n", uwsgi_get_socket_num(uwsgi_sock), computed_addr, uwsgi_sock->fd); } free(computed_addr); @@ -1228,6 +1243,21 @@ void uwsgi_add_socket_from_fd(struct uwsgi_socket *uwsgi_sock, int fd) { uwsgi_log("uwsgi zerg socket %d attached to INET6 address %s fd %d\n", uwsgi_get_socket_num(uwsgi_sock), computed_addr, uwsgi_sock->fd); } else { + struct uwsgi_socket *us = uwsgi.sockets; + while (us) { + /* + * Apply SSL configuration for https-socket + * under the same name to the the socket received form + * systemd or upstart. + */ + if (!strcmp(us->name, computed_addr)) { + uwsgi_sock->proto_name = uwsgi_concat2(us->proto_name, ""); + uwsgi_sock->ssl_ctx = us->ssl_ctx; + us->ssl_ctx = NULL; + break; + } + us = us->next; + } uwsgi_log("uwsgi socket %d attached to INET6 address %s fd %d\n", uwsgi_get_socket_num(uwsgi_sock), computed_addr, uwsgi_sock->fd); } free(computed_addr);