From 1e0e97fe7b654ecd7f5315d129df6e57f3e63371 Mon Sep 17 00:00:00 2001 From: m0gg Date: Fri, 1 Dec 2006 10:55:59 +0000 Subject: Fix nanoHTTP HTTPS client (still needs port in URL) --- nanohttp/nanohttp-ssl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'nanohttp/nanohttp-ssl.c') diff --git a/nanohttp/nanohttp-ssl.c b/nanohttp/nanohttp-ssl.c index a5f32e3..22aa3d1 100644 --- a/nanohttp/nanohttp-ssl.c +++ b/nanohttp/nanohttp-ssl.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-ssl.c,v 1.34 2006/11/30 14:24:00 m0gg Exp $ +* $Id: nanohttp-ssl.c,v 1.35 2006/12/01 10:56:00 m0gg Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2001-2005 Rochester Institute of Technology @@ -284,7 +284,7 @@ _hssl_parse_arguments(int argc, char **argv) } else if (!strcmp(argv[i - 1], NHTTPD_ARG_HTTPS)) { - hssl_enabled(); + hssl_enable(); } } @@ -437,12 +437,21 @@ hssl_enabled(void) herror_t hssl_client_ssl(struct hsocket_t * sock) { + SSL_CTX *ctx; SSL *ssl; int ret; log_verbose1("Starting SSL client initialization"); - if (!(ssl = SSL_new(_hssl_context))) + _hssl_library_init(); + + if (!(ctx = SSL_CTX_new(SSLv23_method()))) + { + log_error2("SSL_CTX_new failed (ctx == %p)", ctx); + return herror_new("hssl_client_ssl", HSSL_ERROR_CONTEXT, "Cannot create SSL client context"); + } + + if (!(ssl = SSL_new(ctx))) { log_error1("Cannot create new SSL object"); return herror_new("hssl_client_ssl", HSSL_ERROR_CLIENT, "SSL_new failed"); -- cgit v1.1-32-gdbae