libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 994a1c47eca8ee6ac26d13e039f793d6d1083b40
parent 5e64daa0305d86f25983572e4666099968999a6e
Author: lv-426 <oxcafebaby@yahoo.com>
Date:   Mon, 23 Jun 2008 00:28:02 +0000

support for a non HTTPS build

Diffstat:
Mconfigure.ac | 1+
Msrc/daemon/Makefile.am | 14+++++++++-----
Msrc/daemon/connection.h | 2+-
Msrc/daemon/daemon.c | 8++++++++
Msrc/daemon/internal.h | 2+-
Msrc/examples/Makefile.am | 20++++++++++----------
Msrc/examples/https_server_example.c | 2+-
7 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -153,6 +153,7 @@ then else AC_DEFINE([HTTPS_SUPPORT],[1],[Include HTTPS support]) fi +AM_CONDITIONAL(ENABLE_HTTPS, test "$enable_HTTPS" = "yes") # Symbols required by GNU_TLS AC_DEFINE([ENABLE_MINITASN1],[1],[Include minitasn1 support]) diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am @@ -1,4 +1,8 @@ -SUBDIRS = https . +SUBDIRS = . + +if ENABLE_HTTPS + SUBDIRS += https +endif AM_CPPFLAGS = -I$(top_srcdir)/src/include \ -I$(top_srcdir)/src/daemon \ @@ -31,10 +35,10 @@ postprocessor.c \ response.c response.h libmicrohttpd_la_LDFLAGS = \ -export-dynamic -version-info 4:3:0 $(retaincommand) -libmicrohttpd_la_LIBADD = \ -https/libhttps.la - - + +if ENABLE_HTTPS + libmicrohttpd_la_LIBADD = https/libhttps.la +endif check_PROGRAMS = \ postprocessor_test \ diff --git a/src/daemon/connection.h b/src/daemon/connection.h @@ -77,7 +77,7 @@ int MHD_connection_handle_idle (struct MHD_Connection *connection); int MHD_con_read(struct MHD_Connection *connection); int MHD_con_write(struct MHD_Connection *connection); -#ifdef HTTPS_SUPPORT +#if HTTPS_SUPPORT int MHDS_connection_handle_read(struct MHD_Connection *connection); int MHDS_connection_handle_write(struct MHD_Connection *connection); int MHDS_connection_handle_idle(struct MHD_Connection *connection); diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c @@ -201,6 +201,7 @@ gnutls_push_param_adapter (void *connection, /** * Handle an individual TLS connection. */ +#if HTTPS_SUPPORT static void * MHDS_handle_connection (void *data) { @@ -251,6 +252,7 @@ MHDS_handle_connection (void *data) MHD_handle_connection (data); } +#endif /** * Accept an incoming connection and create the MHD_Connection object for @@ -410,11 +412,13 @@ MHD_accept_connection (struct MHD_Daemon *daemon) /* attempt to create handler thread */ if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) { +#if HTTPS_SUPPORT if (daemon->options & MHD_USE_SSL) res_thread_create = pthread_create (&connection->pid, NULL, &MHDS_handle_connection, connection); else +#endif { res_thread_create = pthread_create (&connection->pid, NULL, &MHD_handle_connection, @@ -931,11 +935,13 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) } /* TLS clean up */ +#if HTTPS_SUPPORT if (daemon->options & MHD_USE_SSL) { gnutls_priority_deinit (daemon->priority_cache); gnutls_global_deinit (); } +#endif free (daemon); } @@ -947,6 +953,7 @@ tls_log_func (int level, const char *str) fprintf (stdout, "|<%d>| %s", level, str); } +#if HTTPS_SUPPORT int MHDS_init (struct MHD_Daemon *daemon) { @@ -984,6 +991,7 @@ MHDS_init (struct MHD_Daemon *daemon) // TODO address error case return value return 0; } +#endif #ifndef WINDOWS diff --git a/src/daemon/internal.h b/src/daemon/internal.h @@ -642,7 +642,7 @@ struct MHD_Daemon */ unsigned short port; -#if HTTPS_SUPPORT +#ifdef HTTPS_SUPPORT /* server credintials */ gnutls_certificate_credentials_t x509_cret; diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am @@ -1,16 +1,20 @@ SUBDIRS = . -AM_CPPFLAGS = -I$(top_srcdir)/src/include +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/include \ +-I$(top_srcdir)/src/https/includes # example programs - noinst_PROGRAMS = \ -https_server_example \ minimal_example \ querystring_example \ fileserver_example \ fileserver_example_external_select +if ENABLE_HTTPS + noinst_PROGRAMS += https_server_example +endif + minimal_example_SOURCES = \ minimal_example.c minimal_example_LDADD = \ @@ -31,15 +35,11 @@ fileserver_example_external_select_SOURCES = \ fileserver_example_external_select_LDADD = \ $(top_builddir)/src/daemon/libmicrohttpd.la +https_server_example_SOURCES = \ +https_server_example.c https_server_example_CPPFLAGS = \ - $(GNUTLS_CPPFLAGS) \ + -I$(top_srcdir)/src/daemon/https/includes \ -I$(top_srcdir)/src/daemon \ -I$(top_srcdir)/src/include -https_server_example_SOURCES = \ - https_server_example.c https_server_example_LDADD = \ $(top_builddir)/src/daemon/libmicrohttpd.la -https_server_example_LDFLAGS = \ - -L$(GNUTLS_LIB_PATH) \ - -lgnutls - diff --git a/src/examples/https_server_example.c b/src/examples/https_server_example.c @@ -44,7 +44,7 @@ #endif #include <string.h> #include <stdio.h> -#include <gnutls/gnutls.h> +#include "gnutls.h" #include <gcrypt.h> #define BUF_SIZE 1024