libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit f8441dac5fed1ce873728a9b71276c9321999aec
parent 43e10b9088806877ad1ad2c685e205d731333f0f
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Thu,  6 Oct 2022 19:10:06 +0300

testcurl/https: significantly simplified test URI

The set URI was overcomplicated without any practical reasons.
Fixed compiler warning on W32.

Diffstat:
Msrc/testcurl/https/tls_test_common.c | 53++++-------------------------------------------------
1 file changed, 4 insertions(+), 49 deletions(-)

diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c @@ -321,58 +321,13 @@ gen_test_file_url (char *url, uint16_t port) { unsigned int ret = 0; - char *doc_path; - size_t doc_path_len; -#ifdef WINDOWS - size_t i; -#endif /* ! WINDOWS */ - /* setup test file path, url */ -#ifdef PATH_MAX - doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX; -#else /* ! PATH_MAX */ - doc_path_len = 4096; -#endif /* ! PATH_MAX */ - if (NULL == (doc_path = malloc (doc_path_len))) - { - fprintf (stderr, MHD_E_MEM); - return 1; - } - if (NULL == getcwd (doc_path, doc_path_len)) - { - fprintf (stderr, - "Error: failed to get working directory. %s\n", - strerror (errno)); - free (doc_path); - return 1; - } -#ifdef WINDOWS - for (i = 0; i < doc_path_len; i++) - { - if (doc_path[i] == 0) - break; - if (doc_path[i] == '\\') - { - doc_path[i] = '/'; - } - if (doc_path[i] != ':') - continue; - if (i == 0) - break; - doc_path[i] = doc_path[i - 1]; - doc_path[i - 1] = '/'; - } -#endif /* construct url */ - if (snprintf (url, - url_len, - "%s:%u%s/%s", - "https://127.0.0.1", - (unsigned int) port, - doc_path, - "urlpath") >= (long long) url_len) + if ((size_t) snprintf (url, + url_len, + "https://127.0.0.1:%u/urlpath", + (unsigned int) port) >= url_len) ret = 1; - free (doc_path); return ret; }