1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

Handle pending SSL reads which would otherwise not trigger a POLLIN.

service.c: Add handle_pending label and jump if more content after lws_server_socket_service
ssl.c: set wsi->ssl = NULL on close (prevents potential segfault)
This commit is contained in:
Andrew Canaday 2015-12-02 15:13:56 -05:00
parent ab620ffde3
commit 08ebfa5237
2 changed files with 8 additions and 1 deletions

View file

@ -490,7 +490,12 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
n = lws_server_socket_service(context, wsi, pollfd);
if (n < 0)
goto close_and_handled;
goto handled;
if( lws_ssl_pending(wsi) ) {
goto handle_pending;
}
else {
goto handled;
};
case LWS_CONNMODE_WS_SERVING:
case LWS_CONNMODE_WS_CLIENT:
@ -585,6 +590,7 @@ drain:
eff_buf.token_len = 0;
} while (more);
handle_pending:
pending = lws_ssl_pending(wsi);
if (pending) {
pending = pending > sizeof(context->service_buffer)?

View file

@ -515,6 +515,7 @@ lws_ssl_close(struct libwebsocket *wsi)
SSL_shutdown(wsi->ssl);
compatible_close(n);
SSL_free(wsi->ssl);
wsi->ssl = NULL;
return 1; /* handled */
}