gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 20/31: testcurl/https: some simplifications and clean-up


From: gnunet
Subject: [libmicrohttpd] 20/31: testcurl/https: some simplifications and clean-ups
Date: Mon, 10 Oct 2022 13:01:05 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 3330f10e6242d4ef542a67e0d5af31a0251127ab
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 6 20:10:42 2022 +0300

    testcurl/https: some simplifications and clean-ups
---
 src/testcurl/https/test_https_get.c          |  9 +++-----
 src/testcurl/https/test_https_get_iovec.c    |  7 +++---
 src/testcurl/https/test_https_session_info.c |  6 ++---
 src/testcurl/https/test_tls_options.c        |  7 +++---
 src/testcurl/https/tls_test_common.c         | 34 ++++++++++++++--------------
 src/testcurl/https/tls_test_common.h         | 31 +++++--------------------
 6 files changed, 35 insertions(+), 59 deletions(-)

diff --git a/src/testcurl/https/test_https_get.c 
b/src/testcurl/https/test_https_get.c
index a0cdb82f..13865502 100644
--- a/src/testcurl/https/test_https_get.c
+++ b/src/testcurl/https/test_https_get.c
@@ -26,8 +26,6 @@
 
 #include "platform.h"
 #include "microhttpd.h"
-#include <limits.h>
-#include <sys/stat.h>
 #include <curl/curl.h>
 #ifdef MHD_HTTPS_REQUIRE_GCRYPT
 #include <gcrypt.h>
@@ -41,8 +39,7 @@ static uint16_t global_port;
 
 /* perform a HTTP GET request via SSL/TLS */
 static unsigned int
-test_secure_get (FILE *test_fd,
-                 const char *cipher_suite,
+test_secure_get (const char *cipher_suite,
                  int proto_version)
 {
   unsigned int ret;
@@ -80,7 +77,7 @@ test_secure_get (FILE *test_fd,
     port = dinfo->port;
   }
 
-  ret = test_https_transfer (test_fd,
+  ret = test_https_transfer (NULL,
                              port,
                              cipher_suite,
                              proto_version);
@@ -252,7 +249,7 @@ main (int argc, char *const *argv)
     return 77;
   }
   errorCount +=
-    test_secure_get (NULL, NULL, CURL_SSLVERSION_DEFAULT);
+    test_secure_get (NULL, CURL_SSLVERSION_DEFAULT);
   errorCount += testEmptyGet (0);
   curl_global_cleanup ();
 
diff --git a/src/testcurl/https/test_https_get_iovec.c 
b/src/testcurl/https/test_https_get_iovec.c
index 90ed5a07..d4e5821e 100644
--- a/src/testcurl/https/test_https_get_iovec.c
+++ b/src/testcurl/https/test_https_get_iovec.c
@@ -161,9 +161,9 @@ test_iovec_transfer (void *cls,
   cbc.size = len;
   cbc.pos = 0;
 
-  if (gen_test_file_url (url,
-                         sizeof (url),
-                         port))
+  if (gen_test_uri (url,
+                    sizeof (url),
+                    port))
   {
     ret = 1;
     goto cleanup;
@@ -176,7 +176,6 @@ test_iovec_transfer (void *cls,
     goto cleanup;
   }
 
-  /* compare test file & daemon response */
   if ((cbc.pos != TESTSTR_SIZE) ||
       (0 != check_read_data (cbc.buf, cbc.pos)))
   {
diff --git a/src/testcurl/https/test_https_session_info.c 
b/src/testcurl/https/test_https_session_info.c
index c1bb31ef..c3ddae4f 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -141,9 +141,9 @@ test_query_session (void)
     port = dinfo->port;
   }
 
-  gen_test_file_url (url,
-                     sizeof (url),
-                     port);
+  gen_test_uri (url,
+                sizeof (url),
+                port);
   c = curl_easy_init ();
 #ifdef _DEBUG
   curl_easy_setopt (c, CURLOPT_VERBOSE, 1L);
diff --git a/src/testcurl/https/test_tls_options.c 
b/src/testcurl/https/test_tls_options.c
index 7390b89a..f6fa477a 100644
--- a/src/testcurl/https/test_tls_options.c
+++ b/src/testcurl/https/test_tls_options.c
@@ -54,9 +54,9 @@ test_unmatching_ssl_version (void *cls, uint16_t port, const 
char *cipher_suite,
   cbc.size = 256;
   cbc.pos = 0;
 
-  if (gen_test_file_url (url,
-                         sizeof (url),
-                         port))
+  if (gen_test_uri (url,
+                    sizeof (url),
+                    port))
   {
     free (cbc.buf);
     fprintf (stderr,
@@ -79,7 +79,6 @@ test_unmatching_ssl_version (void *cls, uint16_t port, const 
char *cipher_suite,
 }
 
 
-/* setup a temporary transfer test file */
 int
 main (int argc, char *const *argv)
 {
diff --git a/src/testcurl/https/tls_test_common.c 
b/src/testcurl/https/tls_test_common.c
index f27813a2..da62b267 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -55,9 +55,9 @@ test_daemon_get (void *cls,
   cbc.pos = 0;
 
   /* construct url - this might use doc_path */
-  gen_test_file_url (url,
-                     sizeof (url),
-                     port);
+  gen_test_uri (url,
+                sizeof (url),
+                port);
 
   c = curl_easy_init ();
 #ifdef _DEBUG
@@ -308,27 +308,27 @@ send_curl_req (char *url,
 
 
 /**
- * compile test file url pointing to the current running directory path
+ * compile test URI
  *
- * @param[out] url - char buffer into which the url is compiled
- * @param url_len number of bytes available in url
+ * @param[out] uri - char buffer into which the url is compiled
+ * @param uri_len number of bytes available in @a url
  * @param port port to use for the test
  * @return 1 on error
  */
 unsigned int
-gen_test_file_url (char *url,
-                   size_t url_len,
-                   uint16_t port)
+gen_test_uri (char *uri,
+              size_t uri_len,
+              uint16_t port)
 {
   int res;
 
-  res = snprintf (url,
-                  url_len,
+  res = snprintf (uri,
+                  uri_len,
                   "https://127.0.0.1:%u/urlpath";,
                   (unsigned int) port);
   if (res <= 0)
     return 1;
-  if ((size_t) res >= url_len)
+  if ((size_t) res >= uri_len)
     return 1;
 
   return 0;
@@ -359,9 +359,9 @@ test_https_transfer (void *cls,
   cbc.size = len;
   cbc.pos = 0;
 
-  if (gen_test_file_url (url,
-                         sizeof (url),
-                         port))
+  if (gen_test_uri (url,
+                    sizeof (url),
+                    port))
   {
     ret = 1;
     goto cleanup;
@@ -397,7 +397,7 @@ cleanup:
  * @param arg_list
  * @return port number on success or zero on failure
  */
-uint16_t
+static uint16_t
 setup_testcase (struct MHD_Daemon **d, uint16_t port, unsigned int 
daemon_flags,
                 va_list arg_list)
 {
@@ -426,7 +426,7 @@ setup_testcase (struct MHD_Daemon **d, uint16_t port, 
unsigned int daemon_flags,
 }
 
 
-void
+static void
 teardown_testcase (struct MHD_Daemon *d)
 {
   MHD_stop_daemon (d);
diff --git a/src/testcurl/https/tls_test_common.h 
b/src/testcurl/https/tls_test_common.h
index 5192b774..a3fcc5dc 100644
--- a/src/testcurl/https/tls_test_common.h
+++ b/src/testcurl/https/tls_test_common.h
@@ -44,7 +44,6 @@
 #define MHD_E_FAILED_TO_CONNECT \
   "Error: server connection could not be established\n"
 
-/* TODO rm if unused */
 struct https_test_data
 {
   void *cls;
@@ -60,16 +59,6 @@ struct CBC
   size_t size;
 };
 
-struct CipherDef
-{
-  int options[2];
-  char *curlname;
-};
-
-
-int
-curl_check_version (const char *req_version, ...);
-
 int
 curl_tls_is_gnutls (void);
 
@@ -113,17 +102,17 @@ http_dummy_ahc (void *cls, struct MHD_Connection 
*connection,
 
 
 /**
- * compile test file url pointing to the current running directory path
+ * compile test URI
  *
- * @param[out] url - char buffer into which the url is compiled
- * @param url_len number of bytes available in @a url
+ * @param[out] uri - char buffer into which the url is compiled
+ * @param uri_len number of bytes available in @a url
  * @param port port to use for the test
  * @return 1 on error
  */
 unsigned int
-gen_test_file_url (char *url,
-                   size_t url_len,
-                   uint16_t port);
+gen_test_uri (char *uri,
+              size_t uri_len,
+              uint16_t port);
 
 CURLcode
 send_curl_req (char *url,
@@ -137,14 +126,6 @@ test_https_transfer (void *cls,
                      const char *cipher_suite,
                      int proto_version);
 
-uint16_t
-setup_testcase (struct MHD_Daemon **d, uint16_t port, unsigned int 
daemon_flags,
-                va_list arg_list);
-
-void
-teardown_testcase (struct MHD_Daemon *d);
-
-
 unsigned int
 setup_session (gnutls_session_t *session,
                gnutls_certificate_credentials_t *xcred);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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