gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 18/31: testcurl/https: significantly simplified test URI


From: gnunet
Subject: [libmicrohttpd] 18/31: testcurl/https: significantly simplified test URI
Date: Mon, 10 Oct 2022 13:01:03 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

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

    testcurl/https: significantly simplified test URI
    
    The set URI was overcomplicated without any practical reasons.
    Fixed compiler warning on W32.
---
 src/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
index b44ded1e..639bccf1 100644
--- 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;
 }
 

-- 
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]