gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28208 - libmicrohttpd/src/testcurl/https


From: gnunet
Subject: [GNUnet-SVN] r28208 - libmicrohttpd/src/testcurl/https
Date: Sat, 20 Jul 2013 12:03:53 +0200

Author: grothoff
Date: 2013-07-20 12:03:53 +0200 (Sat, 20 Jul 2013)
New Revision: 28208

Modified:
   libmicrohttpd/src/testcurl/https/test_https_get.c
   libmicrohttpd/src/testcurl/https/test_https_get_parallel.c
   libmicrohttpd/src/testcurl/https/test_https_get_select.c
Log:
-expanded HTTPS testcases to also cover epoll

Modified: libmicrohttpd/src/testcurl/https/test_https_get.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_get.c   2013-07-19 20:26:17 UTC 
(rev 28207)
+++ libmicrohttpd/src/testcurl/https/test_https_get.c   2013-07-20 10:03:53 UTC 
(rev 28208)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file mhds_get_test.c
+ * @file test_https_get.c
  * @brief  Testcase for libmicrohttpd HTTPS GET operations
  * @author Sagie Amir
  */
@@ -37,8 +37,11 @@
 extern const char srv_signed_cert_pem[];
 extern const char srv_signed_key_pem[];
 
+
 static int
-test_cipher_option (FILE * test_fd, char *cipher_suite, int proto_version)
+test_cipher_option (FILE * test_fd, 
+                   const char *cipher_suite, 
+                   int proto_version)
 {
 
   int ret;
@@ -62,9 +65,12 @@
   return ret;
 }
 
+
 /* perform a HTTP GET request via SSL/TLS */
-int
-test_secure_get (FILE * test_fd, char *cipher_suite, int proto_version)
+static int
+test_secure_get (FILE * test_fd, 
+                const char *cipher_suite, 
+                int proto_version)
 {
   int ret;
   struct MHD_Daemon *d;
@@ -88,11 +94,16 @@
   return ret;
 }
 
+
 int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
+  const char *aes256_sha_tlsv1   = "AES256-SHA";
+  const char *aes256_sha_sslv3   = "AES256-SHA";
+  const char *des_cbc3_sha_tlsv1 = "DES-CBC3-SHA";
 
+
   if (!gcry_check_version (GCRYPT_VERSION))
     abort ();
   if (0 != curl_global_init (CURL_GLOBAL_ALL))
@@ -101,13 +112,9 @@
       return -1;
     }
 
-  char *aes256_sha_tlsv1   = "AES256-SHA";
-  char *aes256_sha_sslv3   = "AES256-SHA";
-  char *des_cbc3_sha_tlsv1 = "DES-CBC3-SHA";
-
   if (curl_uses_nss_ssl() == 0)
     {
-      aes256_sha_tlsv1 = "rsa_aes_256_sha";
+      aes256_sha_tlsv1 = "rsa_aes_256_sha";    
       aes256_sha_sslv3 = "rsa_aes_256_sha";
       des_cbc3_sha_tlsv1 = "rsa_aes_128_sha";
     }
@@ -118,7 +125,6 @@
     test_secure_get (NULL, aes256_sha_sslv3, CURL_SSLVERSION_SSLv3);
   errorCount +=
     test_cipher_option (NULL, des_cbc3_sha_tlsv1, CURL_SSLVERSION_TLSv1);
-
   print_test_result (errorCount, argv[0]);
 
   curl_global_cleanup ();

Modified: libmicrohttpd/src/testcurl/https/test_https_get_parallel.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_get_parallel.c  2013-07-19 
20:26:17 UTC (rev 28207)
+++ libmicrohttpd/src/testcurl/https/test_https_get_parallel.c  2013-07-20 
10:03:53 UTC (rev 28208)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file tls_thread_mode_test.c
+ * @file test_https_get_parallel.c
  * @brief  Testcase for libmicrohttpd HTTPS GET operations
  * @author Sagie Amir
  * @author Christian Grothoff
@@ -38,6 +38,7 @@
 
 int curl_check_version (const char *req_version, ...);
 
+
 /**
  * used when spawning multiple threads executing curl server requests
  *
@@ -58,6 +59,7 @@
   return &nonnull;
 }
 
+
 /**
  * Test non-parallel requests.
  *
@@ -79,6 +81,7 @@
   return 0;
 }
 
+
 /**
  * Test parallel request handling.
  *
@@ -124,6 +127,7 @@
 main (int argc, char *const *argv)
 {  
   unsigned int errorCount = 0;
+  const char *aes256_sha = "AES256-SHA";
 
   /* initialize random seed used by curl clients */
   unsigned int iseed = (unsigned int) time (NULL);
@@ -135,21 +139,34 @@
       return -1;
     }
 
-  char *aes256_sha = "AES256-SHA";
   if (curl_uses_nss_ssl() == 0)
-    {
-      aes256_sha = "rsa_aes_256_sha";
-    }
-
+    aes256_sha = "rsa_aes_256_sha";    
+#if LINUX
   errorCount +=
+    test_wrap ("single threaded daemon, single client, epoll", 
&test_single_client,
+               NULL,
+               MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | 
MHD_USE_EPOLL_LINUX_ONLY,
+               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);
+#endif
+  errorCount +=
     test_wrap ("single threaded daemon, single client", &test_single_client,
                NULL,
                MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG,
                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);
-
+#if LINUX
   errorCount +=
+    test_wrap ("single threaded daemon, parallel clients, epoll",
+               &test_parallel_clients, NULL,
+               MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | 
MHD_USE_EPOLL_LINUX_ONLY,
+               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);
+#endif
+  errorCount +=
     test_wrap ("single threaded daemon, parallel clients",
                &test_parallel_clients, NULL,
                MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG,

Modified: libmicrohttpd/src/testcurl/https/test_https_get_select.c
===================================================================
--- libmicrohttpd/src/testcurl/https/test_https_get_select.c    2013-07-19 
20:26:17 UTC (rev 28207)
+++ libmicrohttpd/src/testcurl/https/test_https_get_select.c    2013-07-20 
10:03:53 UTC (rev 28208)
@@ -19,7 +19,7 @@
  */
 
 /**
- * @file mhds_get_test.c
+ * @file test_https_get_select.c
  * @brief  Testcase for libmicrohttpd HTTPS GET operations
  * @author Sagie Amir
  */
@@ -71,8 +71,9 @@
   return ret;
 }
 
+
 static int
-testExternalGet ()
+testExternalGet (int flags)
 {
   struct MHD_Daemon *d;
   CURL *c;
@@ -88,12 +89,13 @@
   struct CURLMsg *msg;
   time_t start;
   struct timeval tv;
+  const char *aes256_sha = "AES256-SHA";
 
   multi = NULL;
   cbc.buf = buf;
   cbc.size = 2048;
   cbc.pos = 0;
-  d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL,
+  d = MHD_start_daemon (MHD_USE_DEBUG | MHD_USE_SSL | flags,
                         1082, NULL, NULL, &ahc_echo, "GET", 
                         MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
                         MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
@@ -101,11 +103,8 @@
   if (d == NULL)
     return 256;
 
-  char *aes256_sha = "AES256-SHA";
   if (curl_uses_nss_ssl() == 0)
-    {
-      aes256_sha = "rsa_aes_256_sha";
-    }
+    aes256_sha = "rsa_aes_256_sha";   
 
   c = curl_easy_init ();
   curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1:1082/hello_world";);
@@ -222,8 +221,12 @@
       fprintf (stderr, "Error: %s\n", strerror (errno));
       return -1;
     }
-  if (0 != (errorCount = testExternalGet ()))
+#if LINUX
+  if (0 != (errorCount = testExternalGet (MHD_USE_EPOLL_LINUX_ONLY)))
     fprintf (stderr, "Fail: %d\n", errorCount);
+#endif
+  if (0 != (errorCount = testExternalGet (0)))
+    fprintf (stderr, "Fail: %d\n", errorCount);
   curl_global_cleanup ();
   return errorCount != 0;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]