[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.
- [libmicrohttpd] 14/31: microhttpd.h: improved doxy for MHD_USE_THREAD_PER_CONNECTION, (continued)
- [libmicrohttpd] 14/31: microhttpd.h: improved doxy for MHD_USE_THREAD_PER_CONNECTION, gnunet, 2022/10/10
- [libmicrohttpd] 15/31: MHD_run_wait(): improved readability, gnunet, 2022/10/10
- [libmicrohttpd] 11/31: daemon: fixed delayed notification callback in thread-per-connection mode, gnunet, 2022/10/10
- [libmicrohttpd] 16/31: daemon: small refactoring for more compact code when poll() is not supported, gnunet, 2022/10/10
- [libmicrohttpd] 17/31: MHD_poll(): removed unneeded check, gnunet, 2022/10/10
- [libmicrohttpd] 18/31: testcurl/https: significantly simplified test URI, gnunet, 2022/10/10
- [libmicrohttpd] 25/31: test_https_get_parallel_threads: removed libcurl-GnuTLS requirement, gnunet, 2022/10/10
- [libmicrohttpd] 09/31: testcurl/https: enable verbose libcurl on debug builds, gnunet, 2022/10/10
- [libmicrohttpd] 21/31: test_tls_extensions: removed unused test, gnunet, 2022/10/10
- [libmicrohttpd] 29/31: https tests: updated self-signed certificate, gnunet, 2022/10/10
- [libmicrohttpd] 20/31: testcurl/https: some simplifications and clean-ups,
gnunet <=
- [libmicrohttpd] 23/31: microhttpd.h: minor doxy fix, gnunet, 2022/10/10
- [libmicrohttpd] 24/31: digestauth.h: removed leftover in doxy, gnunet, 2022/10/10
- [libmicrohttpd] 30/31: test_tls_authentication: fixed to really test TLS authentication, gnunet, 2022/10/10
- [libmicrohttpd] 19/31: testcurl/https: added proper check for snprintf() result, gnunet, 2022/10/10
- [libmicrohttpd] 22/31: test_https_session_info: removed hardcoded TLS version, gnunet, 2022/10/10
- [libmicrohttpd] 31/31: testcurl/https: updated copyright year in modified files, fixed some doxy, gnunet, 2022/10/10
- [libmicrohttpd] 26/31: tls_test_common: fixed comments and error messages, gnunet, 2022/10/10
- [libmicrohttpd] 27/31: test_tls_options: re-implemented, removed hardcoded TLS versions, gnunet, 2022/10/10
- [libmicrohttpd] 28/31: https tests: renamed private key variable to match certificate name, gnunet, 2022/10/10