diff options
-rw-r--r-- | nanohttp/nanohttp-server.c | 14 | ||||
-rw-r--r-- | nanohttp/nanohttp-socket.c | 15 |
2 files changed, 15 insertions, 14 deletions
diff --git a/nanohttp/nanohttp-server.c b/nanohttp/nanohttp-server.c index d1cda7c..38c19cc 100644 --- a/nanohttp/nanohttp-server.c +++ b/nanohttp/nanohttp-server.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-server.c,v 1.35 2005/12/19 14:06:16 snowdrop Exp $ +* $Id: nanohttp-server.c,v 1.36 2005/12/22 21:59:41 mrcsys Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -101,6 +101,7 @@ static void WSAReaper(void *x); sigset_t thrsigset; #endif +extern SSL_CTX* SSLctx; /* @@ -444,6 +445,16 @@ httpd_session_main (void *data) len = 0; log_verbose1 ("starting httpd_session_main()"); + if( !SSLctx ){ + log_verbose1("Using HTTP"); + } else { + log_verbose1("Using HTTPS"); + conn->sock.ssl = init_ssl(SSLctx, conn->sock.sock, SSL_SERVER); + hsocket_block (conn->sock, 0); + if( conn->sock.ssl == NULL ){ + return herror_new("hsocket_accept", SSL_ERROR_INIT, "Unable to initialize SSL"); + } + } conn->atime = time ((time_t) 0); /* call the service */ /* req = hrequest_new_from_buffer (header);*/ @@ -507,6 +518,7 @@ httpd_session_main (void *data) }while(!done); hsocket_close(conn->sock); + log_verbose1("Marking connection as available"); conn->sock.sock = 0; hrequest_free(req); httpd_free(rconn); diff --git a/nanohttp/nanohttp-socket.c b/nanohttp/nanohttp-socket.c index 5c9b70d..cc84834 100644 --- a/nanohttp/nanohttp-socket.c +++ b/nanohttp/nanohttp-socket.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-socket.c,v 1.37 2005/12/20 21:48:10 mrcsys Exp $ +* $Id: nanohttp-socket.c,v 1.38 2005/12/22 21:59:41 mrcsys Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -258,18 +258,7 @@ hsocket_accept (hsocket_t sock, hsocket_t * dest) log_verbose3 ("accept new socket (%d) from '%s'", sockfd.sock, SAVE_STR (((char *) inet_ntoa (addr.sin_addr)))); - if( !SSLctx ){ - log_verbose1("Using HTTP"); - dest->sock = sockfd.sock; - } else { - log_verbose1("Using HTTPS"); - dest->ssl = init_ssl(SSLctx, sockfd.sock, SSL_SERVER); - dest->sock = sockfd.sock; - hsocket_block (sockfd, 0); - if( dest->ssl == NULL ){ - return herror_new("hsocket_accept", SSL_ERROR_INIT, "Unable to initialize SSL"); - } - } + dest->sock = sockfd.sock; return H_OK; } |