libmicrohttpd

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

commit 53c25f932f5bd45c26af675b4c89d71eb99a9b8c
parent 1c893a971fa8d04ada6c66aa9ebf525b03ed4426
Author: lv-426 <oxcafebaby@yahoo.com>
Date:   Mon, 11 Aug 2008 23:04:51 +0000

added MHD_OPTION_IP_ADDR

Diffstat:
Msrc/daemon/daemon.c | 296+++++++++++++------------------------------------------------------------------
Msrc/daemon/https/tls/gnutls_algorithms.c | 11+++++------
Msrc/include/microhttpd.h | 30++++++++++++++++--------------
Msrc/testcurl/Makefile.am | 10++++++++--
Asrc/testcurl/daemon_options_test.c | 117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/testcurl/https/tls_daemon_options_test.c | 70+++++++++++++++++++++++++++++++++++-----------------------------------
Msrc/testcurl/https/tls_session_time_out_test.c | 5+++--
7 files changed, 231 insertions(+), 308 deletions(-)

diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c @@ -783,6 +783,24 @@ MHD_select_thread (void *cls) return NULL; } +struct MHD_Daemon * +MHD_start_daemon (unsigned int options, + unsigned short port, + MHD_AcceptPolicyCallback apc, + void *apc_cls, + MHD_AccessHandlerCallback dh, void *dh_cls, ...) +{ + struct MHD_Daemon *ret; + va_list ap; + + /* initializes argument pointer */ + va_start (ap, dh_cls); + + ret = MHD_start_daemon_va (options, port, apc, apc_cls, dh, dh_cls, ap); + va_end (ap); + return ret; +} + /** * Start a webserver on the given port. * @@ -796,13 +814,14 @@ MHD_select_thread (void *cls) */ struct MHD_Daemon * MHD_start_daemon_va (unsigned int options, - unsigned short port, char *ip, + unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls, va_list ap) { const int on = 1; struct MHD_Daemon *retVal; + char * daemon_ip_addr = 0; /* listeningss sockets used by the daemon */ int socket_fd; @@ -815,68 +834,8 @@ MHD_start_daemon_va (unsigned int options, if ((port == 0) || (dh == NULL)) return NULL; - if ((options & MHD_USE_IPv6) != 0) - socket_fd = SOCKET (PF_INET6, SOCK_STREAM, 0); - else - socket_fd = SOCKET (PF_INET, SOCK_STREAM, 0); - if (socket_fd < 0) - { -#if HAVE_MESSAGES - if ((options & MHD_USE_DEBUG) != 0) - fprintf (stderr, "Call to socket failed: %s\n", STRERROR (errno)); -#endif - return NULL; - } - if ((SETSOCKOPT (socket_fd, - SOL_SOCKET, - SO_REUSEADDR, - &on, sizeof (on)) < 0) && (options & MHD_USE_DEBUG) != 0) - { -#if HAVE_MESSAGES - fprintf (stderr, "setsockopt failed: %s\n", STRERROR (errno)); -#endif - } - if ((options & MHD_USE_IPv6) != 0) - { - memset (&servaddr6, 0, sizeof (struct sockaddr_in6)); - /* todo impl IPv6 address setting */ - servaddr6.sin6_family = AF_INET6; - servaddr6.sin6_port = htons (port); - servaddr = (struct sockaddr *) &servaddr6; - addrlen = sizeof (struct sockaddr_in6); - } - else - { - memset (&servaddr4, 0, sizeof (struct sockaddr_in)); - inet_pton (AF_INET, ip, &servaddr4.sin_addr); - servaddr4.sin_family = AF_INET; - servaddr4.sin_port = htons (port); - servaddr = (struct sockaddr *) &servaddr4; - addrlen = sizeof (struct sockaddr_in); - } - if (BIND (socket_fd, servaddr, addrlen) < 0) - { -#if HAVE_MESSAGES - if ((options & MHD_USE_DEBUG) != 0) - fprintf (stderr, - "Failed to bind to port %u: %s\n", port, STRERROR (errno)); -#endif - CLOSE (socket_fd); - return NULL; - } - if (LISTEN (socket_fd, 20) < 0) - { -#if HAVE_MESSAGES - if ((options & MHD_USE_DEBUG) != 0) - fprintf (stderr, - "Failed to listen for connections: %s\n", STRERROR (errno)); -#endif - CLOSE (socket_fd); - return NULL; - } /* allocate the mhd daemon */ - retVal = malloc (sizeof (struct MHD_Daemon)); if (retVal == NULL) @@ -885,17 +844,18 @@ MHD_start_daemon_va (unsigned int options, return NULL; } + /* set default daemon values */ memset (retVal, 0, sizeof (struct MHD_Daemon)); retVal->options = options; retVal->port = port; retVal->apc = apc; retVal->apc_cls = apc_cls; - retVal->socket_fd = socket_fd; retVal->default_handler = dh; retVal->default_handler_cls = dh_cls; retVal->max_connections = MHD_MAX_CONNECTIONS_DEFAULT; retVal->pool_size = MHD_POOL_SIZE_DEFAULT; retVal->connection_timeout = 0; /* no timeout */ + #if HTTPS_SUPPORT if (options & MHD_USE_SSL) { @@ -908,10 +868,9 @@ MHD_start_daemon_va (unsigned int options, retVal->cred_type = MHD_GNUTLS_CRD_CERTIFICATE; } #endif - /* initializes the argument pointer variable */ /* - * loop through daemon options + * analyze daemon options */ while (MHD_OPTION_END != (opt = va_arg (ap, enum MHD_OPTION))) { @@ -934,6 +893,9 @@ MHD_start_daemon_va (unsigned int options, case MHD_OPTION_PER_IP_CONNECTION_LIMIT: retVal->per_ip_connection_limit = va_arg (ap, unsigned int); break; + case MHD_OPTION_IP_ADDR: + daemon_ip_addr = va_arg (ap, const char *); + break; #if HTTPS_SUPPORT case MHD_OPTION_PROTOCOL_VERSION: _set_priority (&retVal->priority_cache->protocol, @@ -985,58 +947,6 @@ MHD_start_daemon_va (unsigned int options, } } -#if HTTPS_SUPPORT - /* initialize HTTPS daemon certificate aspects & send / recv functions */ - if (options & MHD_USE_SSL && MHD_TLS_init (retVal) != 0) - { -#if HAVE_MESSAGES - MHD_DLOG (retVal, "Failed to initialize HTTPS daemon\n"); -#endif - free (retVal); - return NULL; - } -#endif - - if (((0 != (options & MHD_USE_THREAD_PER_CONNECTION)) || (0 != (options - & - MHD_USE_SELECT_INTERNALLY))) - && (0 != - pthread_create (&retVal->pid, NULL, &MHD_select_thread, retVal))) - { -#if HAVE_MESSAGES - MHD_DLOG (retVal, "Failed to create listen thread: %s\n", - STRERROR (errno)); -#endif - free (retVal); - CLOSE (socket_fd); - return NULL; - } - - return retVal; -} - -struct MHD_Daemon * -MHD_start_daemon (unsigned int options, - unsigned short port, - MHD_AcceptPolicyCallback apc, - void *apc_cls, - MHD_AccessHandlerCallback dh, void *dh_cls, ...) -{ - const int on = 1; - struct MHD_Daemon *retVal; - - /* listeningss sockets used by the daemon */ - int socket_fd; - va_list ap; - - struct sockaddr_in servaddr4; - struct sockaddr_in6 servaddr6; - const struct sockaddr *servaddr; - socklen_t addrlen; - enum MHD_OPTION opt; - - if ((port == 0) || (dh == NULL)) - return NULL; if ((options & MHD_USE_IPv6) != 0) socket_fd = SOCKET (PF_INET6, SOCK_STREAM, 0); else @@ -1063,6 +973,14 @@ MHD_start_daemon (unsigned int options, memset (&servaddr6, 0, sizeof (struct sockaddr_in6)); servaddr6.sin6_family = AF_INET6; servaddr6.sin6_port = htons (port); + if (daemon_ip_addr && inet_pton (AF_INET6, daemon_ip_addr, &servaddr6.sin6_addr) <= 0){ + #if HAVE_MESSAGES + if ((options & MHD_USE_DEBUG) != 0) + fprintf (stderr, + "Failed to parse given daemon ipv6 inet address: %s\n", daemon_ip_addr ); + return NULL; + #endif + } servaddr = (struct sockaddr *) &servaddr6; addrlen = sizeof (struct sockaddr_in6); } @@ -1071,9 +989,20 @@ MHD_start_daemon (unsigned int options, memset (&servaddr4, 0, sizeof (struct sockaddr_in)); servaddr4.sin_family = AF_INET; servaddr4.sin_port = htons (port); + if (daemon_ip_addr && inet_pton (AF_INET, daemon_ip_addr, &servaddr4.sin_addr) <= 0){ +#if HAVE_MESSAGES + if ((options & MHD_USE_DEBUG) != 0) + fprintf (stderr, + "Failed to parse given daemon ipv4 inet address: %s\n", daemon_ip_addr ); + return NULL; +#endif + } servaddr = (struct sockaddr *) &servaddr4; addrlen = sizeof (struct sockaddr_in); } + + retVal->socket_fd = socket_fd; + if (BIND (socket_fd, servaddr, addrlen) < 0) { #if HAVE_MESSAGES @@ -1084,6 +1013,8 @@ MHD_start_daemon (unsigned int options, CLOSE (socket_fd); return NULL; } + + if (LISTEN (socket_fd, 20) < 0) { #if HAVE_MESSAGES @@ -1095,118 +1026,6 @@ MHD_start_daemon (unsigned int options, return NULL; } - /* allocate the mhd daemon */ - - retVal = malloc (sizeof (struct MHD_Daemon)); - - if (retVal == NULL) - { - CLOSE (socket_fd); - return NULL; - } - - memset (retVal, 0, sizeof (struct MHD_Daemon)); - retVal->options = options; - retVal->port = port; - retVal->apc = apc; - retVal->apc_cls = apc_cls; - retVal->socket_fd = socket_fd; - retVal->default_handler = dh; - retVal->default_handler_cls = dh_cls; - retVal->max_connections = MHD_MAX_CONNECTIONS_DEFAULT; - retVal->pool_size = MHD_POOL_SIZE_DEFAULT; - retVal->connection_timeout = 0; /* no timeout */ -#if HTTPS_SUPPORT - if (options & MHD_USE_SSL) - { - /* lock gnutls_global mutex since it uses reference counting */ - pthread_mutex_lock (&gnutls_init_mutex); - MHD_gnutls_global_init (); - pthread_mutex_unlock (&gnutls_init_mutex); - /* set default priorities */ - MHD_tls_set_default_priority (&retVal->priority_cache, "", NULL); - retVal->cred_type = MHD_GNUTLS_CRD_CERTIFICATE; - } -#endif - /* initializes the argument pointer variable */ - - va_start (ap, dh_cls); - - /* - * loop through daemon options - */ - while (MHD_OPTION_END != (opt = va_arg (ap, enum MHD_OPTION))) - { - switch (opt) - { - case MHD_OPTION_CONNECTION_MEMORY_LIMIT: - retVal->pool_size = va_arg (ap, unsigned int); - break; - case MHD_OPTION_CONNECTION_LIMIT: - retVal->max_connections = va_arg (ap, unsigned int); - break; - case MHD_OPTION_CONNECTION_TIMEOUT: - retVal->connection_timeout = va_arg (ap, unsigned int); - break; - case MHD_OPTION_NOTIFY_COMPLETED: - retVal->notify_completed = - va_arg (ap, MHD_RequestCompletedCallback); - retVal->notify_completed_cls = va_arg (ap, void *); - break; - case MHD_OPTION_PER_IP_CONNECTION_LIMIT: - retVal->per_ip_connection_limit = va_arg (ap, unsigned int); - break; -#if HTTPS_SUPPORT - case MHD_OPTION_PROTOCOL_VERSION: - _set_priority (&retVal->priority_cache->protocol, - va_arg (ap, const int *)); - break; - case MHD_OPTION_HTTPS_KEY_PATH: - retVal->https_key_path = va_arg (ap, const char *); - break; - case MHD_OPTION_HTTPS_CERT_PATH: - retVal->https_cert_path = va_arg (ap, const char *); - break; - case MHD_OPTION_HTTPS_MEM_KEY: - retVal->https_mem_key = va_arg (ap, const char *); - break; - case MHD_OPTION_HTTPS_MEM_CERT: - retVal->https_mem_cert = va_arg (ap, const char *); - break; - case MHD_OPTION_CRED_TYPE: - retVal->cred_type = va_arg (ap, const int); - break; - case MHD_OPTION_KX_PRIORITY: - _set_priority (&retVal->priority_cache->kx, - va_arg (ap, const int *)); - break; - case MHD_OPTION_CIPHER_ALGORITHM: - _set_priority (&retVal->priority_cache->cipher, - va_arg (ap, const int *)); - break; - case MHD_OPTION_MAC_ALGO: - _set_priority (&retVal->priority_cache->mac, - va_arg (ap, const int *)); - break; -#endif - default: -#if HAVE_MESSAGES - if (opt > MHD_HTTPS_OPTION_START && opt < MHD_HTTPS_OPTION_END) - { - fprintf (stderr, - "Error: HTTPS option %d passed to non HTTPS daemon\n", - opt); - } - else - { - fprintf (stderr, - "Invalid MHD_OPTION argument! (Did you terminate the list with MHD_OPTION_END?)\n"); - } -#endif - abort (); - } - } - va_end (ap); #if HTTPS_SUPPORT /* initialize HTTPS daemon certificate aspects & send / recv functions */ if (options & MHD_USE_SSL && MHD_TLS_init (retVal) != 0) @@ -1236,27 +1055,6 @@ MHD_start_daemon (unsigned int options, return retVal; } - -/* - * start the MHD_Daemon while binding to a specific ip address. - * - * TODO : address adding ip parameter to MHD_start_daemon - */ -struct MHD_Daemon * -MHD_start_daemon_ip (unsigned int options, - unsigned short port, char *ip, - MHD_AcceptPolicyCallback apc, - void *apc_cls, - MHD_AccessHandlerCallback dh, void *dh_cls, ...) -{ - struct MHD_Daemon *ret; - va_list ap; - va_start (ap, dh_cls); - ret = MHD_start_daemon_va (options, port, ip, apc, apc_cls, dh, dh_cls, ap); - va_end (ap); - return ret; -} - /** * Start a webserver on the given port. * diff --git a/src/daemon/https/tls/gnutls_algorithms.c b/src/daemon/https/tls/gnutls_algorithms.c @@ -392,17 +392,16 @@ extern mhd_gtls_mod_auth_st dhe_psk_auth_struct; extern mhd_gtls_mod_auth_st srp_rsa_auth_struct; extern mhd_gtls_mod_auth_st srp_dss_auth_struct; -struct gnutls_kx_algo_entry +typedef struct mhd_gtls_kx_algo_entry { const char *name; gnutls_kx_algorithm_t algorithm; mhd_gtls_mod_auth_st *auth_struct; int needs_dh_params; int needs_rsa_params; -}; -typedef struct gnutls_kx_algo_entry gnutls_kx_algo_entry; +} mhd_gtls_kx_algo_entry_t; -static const gnutls_kx_algo_entry _gnutls_kx_algorithms[] = { +static const mhd_gtls_kx_algo_entry_t mhd_gtls_kx_algorithms[] = { #ifdef ENABLE_ANON {"ANON-DH", MHD_GNUTLS_KX_ANON_DH, &anon_auth_struct, 1, 0}, #endif @@ -466,8 +465,8 @@ static const gnutls_kx_algorithm_t supported_kxs[] = { }; #define GNUTLS_KX_LOOP(b) \ - const gnutls_kx_algo_entry *p; \ - for(p = _gnutls_kx_algorithms; p->name != NULL; p++) { b ; } + const mhd_gtls_kx_algo_entry_t *p; \ + for(p = mhd_gtls_kx_algorithms; p->name != NULL; p++) { b ; } #define GNUTLS_KX_ALG_LOOP(a) \ GNUTLS_KX_LOOP( if(p->algorithm == algorithm) { a; break; } ) diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -341,7 +341,16 @@ enum MHD_OPTION */ MHD_OPTION_PER_IP_CONNECTION_LIMIT = 5, - MHD_HTTPS_OPTION_START = 6, + /** + * Bind daemon to the supplied ip address. this option should be followed by a + * ip address string. Addresses should be supplied in the number & dot notation + * [ie. '127.0.0.1' for IPv4 & '::ffff:127.0.0.1' for IPv6 ]. Supplying an + * IPv6 address * must be done in conjunction with supplying the daemon with + * the 'MHD_USE_IPv6' option. + */ + MHD_OPTION_IP_ADDR = 6, + + MHD_HTTPS_OPTION_START = 7, /** * Filename for the private key (key.pem) to be used by the @@ -719,23 +728,16 @@ typedef int */ struct MHD_Daemon * MHD_start_daemon_va (unsigned int options, - unsigned short port, char * ip, + unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls, va_list ap); -struct MHD_Daemon * -MHD_start_daemon_ip (unsigned int options, - unsigned short port, char *ip, - MHD_AcceptPolicyCallback apc, - void *apc_cls, - MHD_AccessHandlerCallback dh, void *dh_cls, ...); - /* * Variadic version of MHD_start_daemon_va. This function will delegate calls * to MHD_start_daemon_va() once argument list is analyzed. */ -struct MHD_Daemon *MHD_start_daemon (unsigned int flags, +struct MHD_Daemon * MHD_start_daemon (unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls, @@ -803,9 +805,9 @@ MHD_get_connection_values (struct MHD_Connection *connection, /** * This function can be used to add an entry to - * the HTTP headers of a connection (so that the + * the HTTP headers of a connection (so that the * MHD_get_connection_values function will return - * them -- and the MHD PostProcessor will also + * them -- and the MHD PostProcessor will also * see them). This maybe required in certain * situations (see Mantis #1399) where (broken) * HTTP implementations fail to supply values needed @@ -830,10 +832,10 @@ MHD_get_connection_values (struct MHD_Connection *connection, * performed due to insufficient memory; * MHD_YES on success */ -int +int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, - const char *key, + const char *key, const char *value); /** diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am @@ -24,8 +24,9 @@ check_PROGRAMS = \ daemontest_large_put11 \ daemontest_long_header \ daemontest_get_chunked \ - daemontest_put_chunked - + daemontest_put_chunked \ + daemon_options_test + TESTS = $(check_PROGRAMS) noinst_LIBRARIES = libcurl_version_check.a @@ -38,6 +39,11 @@ libcurl_version_check_a_CPPFLAGS = \ -I$(top_srcdir)/src/daemon/https \ $(LIBCURL_CPPFLAGS) +daemon_options_test_SOURCES = \ + daemon_options_test.c +daemon_options_test_LDADD = \ + $(top_builddir)/src/daemon/libmicrohttpd.la + daemontest_get_SOURCES = \ daemontest_get.c daemontest_get_LDADD = \ diff --git a/src/testcurl/daemon_options_test.c b/src/testcurl/daemon_options_test.c @@ -0,0 +1,117 @@ +/* + This file is part of libmicrohttpd + (C) 2007 Christian Grothoff + + libmicrohttpd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + libmicrohttpd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + */ + +/** + * @file mhds_get_test.c + * @brief Testcase for libmicrohttpd daemon option arguments + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" + +#define MHD_E_MEM "Error: memory error\n" +#define MHD_E_SERVER_INIT "Error: failed to start server\n" + +const int DEBUG_GNUTLS_LOG_LEVEL = 0; +const char *test_file_name = "https_test_file"; +const char test_file_data[] = "Hello World\n"; + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, unsigned int *upload_data_size, + void **unused) +{ + return 0; +} + +int +test_wrap (char *test_name, int (*test) (void )) +{ + int ret; + va_list arg_list; + struct MHD_Daemon *d; + + fprintf (stdout, "running test: %s ", test_name); + ret = test (); + + if (ret == 0) + { + fprintf (stdout, "[pass]\n"); + } + else + { + fprintf (stdout, "[fail]\n"); + } + return ret; +} + +/** + * Test the MHD_OPTION_IP_ADDR along with an IPv4 address + */ +static int +test_ipv4_option () +{ + struct MHD_Daemon * d; + + d = MHD_start_daemon ( MHD_USE_DEBUG, 42433, + NULL, NULL, &ahc_echo, NULL, MHD_OPTION_IP_ADDR, "127.0.0.1", MHD_OPTION_END); + + if (d == 0) + return -1; + + MHD_stop_daemon (d); + return 0; +} + +/** + * Test the MHD_OPTION_IP_ADDR along with an IPv6 address + */ + +static int +test_ipv6_option () +{ + struct MHD_Daemon * d; + + d = MHD_start_daemon ( MHD_USE_DEBUG | MHD_USE_IPv6, 42433, + NULL, NULL, &ahc_echo, NULL, MHD_OPTION_IP_ADDR, "::ffff:127.0.0.1", MHD_OPTION_END); + + if (d == 0) + return -1; + + MHD_stop_daemon (d); + return 0; +} + +/* setup a temporary transfer test file */ +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + + errorCount += test_wrap("test_ipv4_option", &test_ipv4_option); + errorCount += test_wrap("test_ipv6_option", &test_ipv6_option); + + return errorCount != 0; +} diff --git a/src/testcurl/https/tls_daemon_options_test.c b/src/testcurl/https/tls_daemon_options_test.c @@ -254,7 +254,7 @@ static int setup (struct MHD_Daemon **d, va_list arg_list) { *d = MHD_start_daemon_va (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, 42433, "127.0.0.1", + MHD_USE_DEBUG, 42433, NULL, NULL, &http_ahc, NULL, arg_list); if (*d == NULL) @@ -428,40 +428,40 @@ main (int argc, char *const *argv) int cipher[] = { MHD_GNUTLS_CIPHER_3DES_CBC, 0 }; int kx[] = { MHD_GNUTLS_KX_ANON_DH, 0 }; -// errorCount += -// test_wrap ("https_transfer", &test_https_transfer, test_fd, "AES256-SHA", -// CURL_SSLVERSION_TLSv1, -// MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, -// MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, -// MHD_OPTION_END); -// errorCount += -// test_wrap ("file certificates", &test_file_certificates, test_fd, -// "AES256-SHA", CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, -// srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, -// srv_self_signed_cert_pem, MHD_OPTION_END); -// errorCount += -// test_wrap ("protocol_version", &test_protocol_version, test_fd, -// "AES256-SHA", CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, -// srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, -// srv_self_signed_cert_pem, MHD_OPTION_PROTOCOL_VERSION, p, -// MHD_OPTION_END); -// errorCount += -// test_wrap ("cipher DES-CBC3-SHA", &test_https_transfer, test_fd, -// "DES-CBC3-SHA", CURL_SSLVERSION_TLSv1, -// MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, -// MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, -// MHD_OPTION_CIPHER_ALGORITHM, cipher, MHD_OPTION_END); -// errorCount += -// test_wrap ("mac SH1", &test_https_transfer, test_fd, "AES256-SHA", -// CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, -// MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, -// MHD_OPTION_MAC_ALGO, mac, MHD_OPTION_END); -// errorCount += -// test_wrap ("kx ANON_DH", &test_https_transfer, test_fd, -// "ADH-DES-CBC3-SHA", CURL_SSLVERSION_TLSv1, -// MHD_OPTION_CRED_TYPE, MHD_GNUTLS_CRD_ANON, -// MHD_OPTION_CIPHER_ALGORITHM, cipher, MHD_OPTION_KX_PRIORITY, -// kx, MHD_OPTION_END); + errorCount += + test_wrap ("https_transfer", &test_https_transfer, test_fd, "AES256-SHA", + CURL_SSLVERSION_TLSv1, + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_END); + errorCount += + test_wrap ("file certificates", &test_file_certificates, test_fd, + "AES256-SHA", CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_END); + errorCount += + test_wrap ("protocol_version", &test_protocol_version, test_fd, + "AES256-SHA", CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_PROTOCOL_VERSION, p, + MHD_OPTION_END); + errorCount += + test_wrap ("cipher DES-CBC3-SHA", &test_https_transfer, test_fd, + "DES-CBC3-SHA", CURL_SSLVERSION_TLSv1, + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_CIPHER_ALGORITHM, cipher, MHD_OPTION_END); + errorCount += + test_wrap ("mac SH1", &test_https_transfer, test_fd, "AES256-SHA", + CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_MAC_ALGO, mac, MHD_OPTION_END); + errorCount += + test_wrap ("kx ANON_DH", &test_https_transfer, test_fd, + "ADH-DES-CBC3-SHA", CURL_SSLVERSION_TLSv1, + MHD_OPTION_CRED_TYPE, MHD_GNUTLS_CRD_ANON, + MHD_OPTION_CIPHER_ALGORITHM, cipher, MHD_OPTION_KX_PRIORITY, + kx, MHD_OPTION_END); errorCount += test_wrap ("ADH-AES256-SHA", &test_https_transfer, test_fd, "ADH-AES256-SHA", CURL_SSLVERSION_TLSv1, diff --git a/src/testcurl/https/tls_session_time_out_test.c b/src/testcurl/https/tls_session_time_out_test.c @@ -152,10 +152,11 @@ main (int argc, char *const *argv) MHD_gnutls_global_init (); MHD_gtls_global_set_log_level (11); - d = MHD_start_daemon_ip(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | - MHD_USE_DEBUG, 42433, "127.0.0.1", + d = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION | MHD_USE_SSL | + MHD_USE_DEBUG, 42433, NULL, NULL, &http_ahc, NULL, MHD_OPTION_CONNECTION_TIMEOUT, TIME_OUT, + MHD_OPTION_IP_ADDR, "127.0.0.1", MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, MHD_OPTION_END);