From 0c6881c2b9b2a1d3bdfca39b3ffc0a226df6e7b3 Mon Sep 17 00:00:00 2001 From: Franz <48635806+fAuernigg@users.noreply.github.com> Date: Sat, 23 Nov 2024 09:50:36 +0100 Subject: [PATCH] test/http: decrease test runs from 20 to 3 to decrease test time (#1216) Multiple HTTP requests are sent in parallel. Processing of the responses are done asynchronously in the main thread. The test should ensure that there is no double free, memleak, mix-up of content, ... for multiple parallel requests. Fixes #1211 slow https test. --- test/http.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/test/http.c b/test/http.c index 2da471cee..8c5788543 100644 --- a/test/http.c +++ b/test/http.c @@ -15,7 +15,7 @@ enum large_body_test { REQ_BODY_CHUNK_SIZE = 26 * 42, REQ_BODY_SIZE = REQ_BODY_CHUNK_SIZE * 480 - 26, - REQ_HTTP_REQUESTS = 2 + REQ_HTTP_REQUESTS = 3 }; enum { @@ -514,10 +514,20 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn, dconf.cache_ttl_max = 1800; dconf.getaddrinfo = dnsc_getaddrinfo_enabled(dnsc); + if (dns_set_conf_test) { + err = dnsc_conf_set(dnsc, &dconf); + if (err) + goto out; + } + err = http_client_alloc(&cli, dnsc); if (err) goto out; + err = http_client_set_config(cli, &hconf); + if (err) + goto out; + #ifdef USE_TLS if (secure) { struct tls* cli_tls; @@ -590,23 +600,12 @@ static int test_http_loop_base(bool secure, const char *met, bool http_conn, sa_port(&srv), t.cert_auth ? "auth/" : ""); - for (i = 1; i <= 10*REQ_HTTP_REQUESTS; i++) { + for (i = 1; i <= REQ_HTTP_REQUESTS; i++) { t.i_req_body = 0; - err = http_client_set_config(cli, &hconf); - if (err) - goto out; - - if (dns_set_conf_test) { - err = dnsc_conf_set(dnsc, &dconf); - if (err) - goto out; - } - t.clen = put ? REQ_BODY_SIZE : 2 * strlen("abcdefghijklmnopqrstuvwxyz"); - if (http_conn) { err = http_reqconn_alloc(&conn, cli, http_resp_handler, http_data_handler, &t);