gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r7375 - libmicrohttpd/src/testcurl/https
Date: Tue, 1 Jul 2008 19:29:28 -0600 (MDT)

Author: grothoff
Date: 2008-07-01 19:29:27 -0600 (Tue, 01 Jul 2008)
New Revision: 7375

Modified:
   libmicrohttpd/src/testcurl/https/Makefile.am
   libmicrohttpd/src/testcurl/https/daemon_https_test_get.c
Log:
fixes

Modified: libmicrohttpd/src/testcurl/https/Makefile.am
===================================================================
--- libmicrohttpd/src/testcurl/https/Makefile.am        2008-07-02 01:22:49 UTC 
(rev 7374)
+++ libmicrohttpd/src/testcurl/https/Makefile.am        2008-07-02 01:29:27 UTC 
(rev 7375)
@@ -4,7 +4,7 @@
 -I$(top_srcdir)/src/daemon \
 -I$(top_srcdir)/src/include 
 
-noinst_PROGRAMS = \
+check_PROGRAMS = \
   daemon_https_test_get
 
 TESTS = $(check_PROGRAMS)

Modified: libmicrohttpd/src/testcurl/https/daemon_https_test_get.c
===================================================================
--- libmicrohttpd/src/testcurl/https/daemon_https_test_get.c    2008-07-02 
01:22:49 UTC (rev 7374)
+++ libmicrohttpd/src/testcurl/https/daemon_https_test_get.c    2008-07-02 
01:29:27 UTC (rev 7375)
@@ -157,7 +157,7 @@
   char url[255];
   char **file_path;
   /* currently use hard coded certificate as test file - consider better 
alternatives */
-  char *test_file_name = "cert.pem";
+  const char *test_file_name = "cert.pem";
   struct stat test_file_stat;
   int key_file, cert_file, test_file;
 
@@ -170,11 +170,18 @@
   test_file = open (test_file_name, O_RDONLY);
   if (!test_file)
     {
-      fprintf (stderr, "Error : failed to open test_file. errno:%d\n", errno);
+      fprintf (stderr, "Error: failed to open `%s': %s\n",
+              test_file_name,
+              strerror(errno));
       return 1;
     }
   if (stat (test_file_name, &test_file_stat) == -1)
-    return 1;
+    {
+      fprintf (stderr, "Error: failed to stat `%s': %s\n", 
+              test_file_name,
+              strerror(errno));
+      return 2;
+    }
   mem_test_file_local = malloc (sizeof (char) * test_file_stat.st_size);
   if (read (test_file, mem_test_file_local, test_file_stat.st_size)
       != test_file_stat.st_size)
@@ -182,12 +189,12 @@
       close (test_file);
       fprintf (stderr, "Error: failed to read test file\n",
                curl_easy_strerror (errornum));
-      return 1;
+      return 4;
     }
   close (test_file);
 
   if (NULL == (cbc.buf = malloc (sizeof (char) * test_file_stat.st_size)))
-    return 1;
+    return 8;
   cbc.size = test_file_stat.st_size;
   cbc.pos = 0;
 
@@ -198,7 +205,7 @@
                         MHD_OPTION_HTTPS_MEM_CERT, cert_pem, MHD_OPTION_END);
 
   if (d == NULL)
-    return 1;
+    return 16;
 
   /* construct url - this might use doc_path */
   sprintf (url, "%s%s/%s", "https://localhost:42433";, doc_path,
@@ -230,8 +237,8 @@
       fprintf (stderr, "curl_easy_perform failed: `%s'\n",
                curl_easy_strerror (errornum));
       curl_easy_cleanup (c);
-      //MHD_stop_daemon (d);
-      return 2;
+      MHD_stop_daemon (d);
+      return 32;
     }
 
   curl_easy_cleanup (c);
@@ -240,7 +247,7 @@
   if (memcmp (cbc.buf, mem_test_file_local, test_file_stat.st_size) != 0)
     {
       // TODO find proper error code
-      return 1;
+      return 64;
     }
   return 0;
 }
@@ -260,8 +267,6 @@
   errorCount += test_HTTPS_Get ();
   if (errorCount != 0)
     fprintf (stderr, "Error (code: %u)\n", errorCount);
-  else
-    fprintf (stdout, "looks ok\n", errorCount);
   curl_global_cleanup ();
-  return errorCount == 0;       /* 0 == pass */
+  return errorCount != 0;
 }





reply via email to

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