From 73327fb2d2a2da4b25e91e34ca121cac6b03fe42 Mon Sep 17 00:00:00 2001 From: snowdrop Date: Fri, 6 Jan 2006 14:09:27 +0000 Subject: added #ifdef HAVE_SSL check --- nanohttp/nanohttp-socket.c | 8 ++++++-- nanohttp/nanohttp-socket.h | 9 ++++++++- nanohttp/nanohttp-ssl.c | 5 +++++ nanohttp/nanohttp-ssl.h | 10 ++++++++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/nanohttp/nanohttp-socket.c b/nanohttp/nanohttp-socket.c index cc84834..62bf287 100644 --- a/nanohttp/nanohttp-socket.c +++ b/nanohttp/nanohttp-socket.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-socket.c,v 1.38 2005/12/22 21:59:41 mrcsys Exp $ +* $Id: nanohttp-socket.c,v 1.39 2006/01/06 14:09:27 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -76,12 +76,14 @@ #define errno WSAGetLastError() #endif + +#ifdef HAVE_SSL SSL_CTX* SSLctx = NULL; char *SSLCert = NULL; char *SSLPass = NULL; char *SSLCA = NULL; int SSLCertLess = 0; - +#endif /*-------------------------------------------------- FUNCTION: hsocket_module_init @@ -124,6 +126,7 @@ hsocket_init (hsocket_t * sock ) log_verbose1("Starting hsocket init"); /* just set the descriptor to -1 */ sock->sock = -1; +#ifdef HAVE_SSL sock->ssl = NULL; if(SSLCert || SSLCertLess){ log_verbose1("calling init ctx"); @@ -132,6 +135,7 @@ hsocket_init (hsocket_t * sock ) return herror_new("hsocket_init", HSOCKET_ERROR_CONNECT, "Unable to initialize SSL CTX" ); } } +#endif return H_OK; } diff --git a/nanohttp/nanohttp-socket.h b/nanohttp/nanohttp-socket.h index 5613ac7..58443f3 100644 --- a/nanohttp/nanohttp-socket.h +++ b/nanohttp/nanohttp-socket.h @@ -1,5 +1,5 @@ /****************************************************************** - * $Id: nanohttp-socket.h,v 1.16 2005/12/19 14:06:16 snowdrop Exp $ + * $Id: nanohttp-socket.h,v 1.17 2006/01/06 14:09:27 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -27,7 +27,10 @@ #include #include + +#ifdef HAVE_SSL #include +#endif #ifdef WIN32 #include @@ -36,13 +39,17 @@ #ifdef WIN32 typedef struct hsocket_t { +#ifdef HAVE_SSL SSL *ssl; +#endif SOCKET sock; } hsocket_t; typedef int socklen_t; #else typedef struct hsocket_t { +#ifdef HAVA_SSL SSL *ssl; +#endif int sock; } hsocket_t; #endif diff --git a/nanohttp/nanohttp-ssl.c b/nanohttp/nanohttp-ssl.c index c2f578b..93dcb6a 100644 --- a/nanohttp/nanohttp-ssl.c +++ b/nanohttp/nanohttp-ssl.c @@ -21,6 +21,9 @@ * Descrip: SSL connection routines */ +/* Enter only if --with-ssl was specified to the configure script */ +#ifdef HAVE_SSL + #include #ifndef WIN32 #include @@ -360,3 +363,5 @@ void ssl_cleanup(SSL* ssl) } } +#endif /* end of ifdef HAVE_SSL */ + diff --git a/nanohttp/nanohttp-ssl.h b/nanohttp/nanohttp-ssl.h index f6f9219..c783812 100644 --- a/nanohttp/nanohttp-ssl.h +++ b/nanohttp/nanohttp-ssl.h @@ -22,13 +22,16 @@ * Descrip: Common ssl routines */ +/* Do enter only if --with-ssl was specified by the configure script */ +#ifdef HAVE_SSL + #ifdef TRU64 #include typedef unsigned int uint32_t; #endif -#ifndef __COMMON_H__ -#define __COMMON_H__ +#ifndef __NANOHTTP_SSL_H_ +#define __NANOHTTP_SSL_H_ #include @@ -95,3 +98,6 @@ SSL* init_ssl(SSL_CTX* ctx, int sock, int type); void ssl_cleanup(); #endif + +#endif /* HAVE_SSL */ + -- cgit v1.1-32-gdbae