From 1f9bf527ec631d64e4a24295ea92dedae974db36 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 14 Feb 2011 21:14:37 +0000 Subject: fix ssl support and confirm builds clean when not configured Signed-off-by: Andy Green --- lib/libwebsockets.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 0e64817..cf814ec 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -87,6 +87,19 @@ delete_from_fd(struct libwebsocket_context *this, int fd) return 1; } +#ifdef LWS_OPENSSL_SUPPORT +static void +libwebsockets_decode_ssl_error(void) +{ + char buf[256]; + u_long err; + + while ((err = ERR_get_error()) != 0) { + ERR_error_string_n(err, buf, sizeof(buf)); + fprintf(stderr, "*** %s\n", buf); + } +} +#endif void libwebsocket_close_and_free_session(struct libwebsocket_context *this, @@ -402,7 +415,6 @@ libwebsocket_service_fd(struct libwebsocket_context *this, #ifdef LWS_OPENSSL_SUPPORT new_wsi->ssl = NULL; - this->ssl_ctx = NULL; if (this->use_ssl) { @@ -411,6 +423,7 @@ libwebsocket_service_fd(struct libwebsocket_context *this, fprintf(stderr, "SSL_new failed: %s\n", ERR_error_string(SSL_get_error( new_wsi->ssl, 0), NULL)); + libwebsockets_decode_ssl_error(); free(new_wsi); break; } @@ -1348,7 +1361,6 @@ static void sigpipe_handler(int x) } - /** * libwebsocket_create_context() - Create the websocket handler * @port: Port to listen on... you can use 0 to suppress listening on -- cgit v1.2.3