Sun, 14 Jan 2018 10:38:09 +0100
fixes keep-alive with ssl
--- a/src/server/daemon/httplistener.c Sat Jan 13 19:01:00 2018 +0100 +++ b/src/server/daemon/httplistener.c Sun Jan 14 10:38:09 2018 +0100 @@ -402,6 +402,7 @@ conn->address = ca; conn->fd = clientfd; conn->listener = ls; + conn->ssl_accepted = 0; if(ls->ssl) { // SSL connections are always non-blocking // set socket non blocking
--- a/src/server/daemon/sessionhandler.c Sat Jan 13 19:01:00 2018 +0100 +++ b/src/server/daemon/sessionhandler.c Sun Jan 14 10:38:09 2018 +0100 @@ -260,7 +260,7 @@ Event *event = malloc(sizeof(Event)); ZERO(event, sizeof(Event)); - event->fn = conn->ssl ? evt_request_ssl_accept : evt_request_input; + event->fn = conn->ssl && !conn->ssl_accepted ? evt_request_ssl_accept : evt_request_input; event->finish = evt_request_finish; event->cookie = io; @@ -305,6 +305,7 @@ return 0; } } + conn->ssl_accepted = WS_TRUE; // SSL_accept successful, start request input now event->fn = evt_request_input;
--- a/src/server/daemon/sessionhandler.h Sat Jan 13 19:01:00 2018 +0100 +++ b/src/server/daemon/sessionhandler.h Sun Jan 14 10:38:09 2018 +0100 @@ -51,6 +51,7 @@ HttpListener *listener; SessionHandler *session_handler; SSL *ssl; + WSBool ssl_accepted; int ssl_error; int (*read)(Connection *conn, void *buf, int len); int (*write)(Connection *conn, const void *buf, int len);