aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libtest
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/Makefile.inc11
-rw-r--r--tests/libtest/chkdecimalpoint.c2
-rw-r--r--tests/libtest/first.c4
-rw-r--r--tests/libtest/lib1156.c2
-rw-r--r--tests/libtest/lib1502.c4
-rw-r--r--tests/libtest/lib1506.c12
-rw-r--r--tests/libtest/lib1510.c12
-rw-r--r--tests/libtest/lib1512.c12
-rw-r--r--tests/libtest/lib1515.c10
-rw-r--r--tests/libtest/lib1518.c74
-rw-r--r--tests/libtest/lib1529.c5
-rw-r--r--tests/libtest/lib1560.c29
-rw-r--r--tests/libtest/lib1900.c4
-rw-r--r--tests/libtest/lib518.c64
-rw-r--r--tests/libtest/lib530.c4
-rw-r--r--tests/libtest/lib537.c66
-rw-r--r--tests/libtest/lib540.c4
-rw-r--r--tests/libtest/lib553.c4
-rw-r--r--tests/libtest/lib658.c76
-rw-r--r--tests/libtest/libauthretry.c4
-rw-r--r--tests/libtest/libntlmconnect.c4
-rw-r--r--tests/libtest/stub_gssapi.c9
-rw-r--r--tests/libtest/testtrace.c6
23 files changed, 304 insertions, 118 deletions
diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc
index 7a3cd166..080421b2 100644
--- a/tests/libtest/Makefile.inc
+++ b/tests/libtest/Makefile.inc
@@ -21,11 +21,11 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
lib559 lib560 lib562 lib564 lib565 lib566 lib567 lib568 lib569 lib570 \
lib571 lib572 lib573 lib574 lib575 lib576 lib578 lib579 lib582 \
lib583 lib585 lib586 lib587 lib589 lib590 lib591 lib597 lib598 lib599 \
- lib643 lib644 lib645 lib650 lib651 lib652 lib653 lib654 lib655 \
+ lib643 lib644 lib645 lib650 lib651 lib652 lib653 lib654 lib655 lib658 \
lib1156 \
lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \
lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 lib1517 \
- lib1520 lib1521 lib1522 \
+ lib1518 lib1520 lib1521 lib1522 \
lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 lib1532 lib1533 \
lib1534 lib1535 lib1536 lib1537 lib1538 \
lib1540 \
@@ -339,6 +339,10 @@ lib654_CPPFLAGS = $(AM_CPPFLAGS)
lib655_SOURCES = lib655.c $(SUPPORTFILES)
lib655_CPPFLAGS = $(AM_CPPFLAGS)
+lib658_SOURCES = lib658.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
+lib658_LDADD = $(TESTUTIL_LIBS)
+lib658_CPPFLAGS = $(AM_CPPFLAGS)
+
lib1500_SOURCES = lib1500.c $(SUPPORTFILES) $(TESTUTIL)
lib1500_LDADD = $(TESTUTIL_LIBS)
lib1500_CPPFLAGS = $(AM_CPPFLAGS)
@@ -410,6 +414,9 @@ lib1515_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1515
lib1517_SOURCES = lib1517.c $(SUPPORTFILES)
lib1517_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1517
+lib1518_SOURCES = lib1518.c $(SUPPORTFILES)
+lib1518_CPPFLAGS = $(AM_CPPFLAGS)
+
lib1520_SOURCES = lib1520.c $(SUPPORTFILES)
lib1520_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1520
diff --git a/tests/libtest/chkdecimalpoint.c b/tests/libtest/chkdecimalpoint.c
index b5f5070c..7bb77150 100644
--- a/tests/libtest/chkdecimalpoint.c
+++ b/tests/libtest/chkdecimalpoint.c
@@ -33,7 +33,7 @@ int main(void)
int chars;
setlocale(LC_NUMERIC, "");
- chars = snprintf(zero, TOTAL_STR_LEN, "%.1f", 0.0);
+ chars = msnprintf(zero, TOTAL_STR_LEN, "%.1f", 0.0);
if((chars == (TOTAL_STR_LEN - 1)) && (strcmp(zero, "0.0") == 0))
return 0;
else
diff --git a/tests/libtest/first.c b/tests/libtest/first.c
index 86d84cac..405e6f84 100644
--- a/tests/libtest/first.c
+++ b/tests/libtest/first.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -124,7 +124,7 @@ char *hexdump(const unsigned char *buffer, size_t len)
if(len > 200)
return NULL;
for(i = 0; i<len; i++, p += 3)
- snprintf(p, 4, "%02x ", buffer[i]);
+ msnprintf(p, 4, "%02x ", buffer[i]);
return dump;
}
diff --git a/tests/libtest/lib1156.c b/tests/libtest/lib1156.c
index 63348de7..cb8878c2 100644
--- a/tests/libtest/lib1156.c
+++ b/tests/libtest/lib1156.c
@@ -91,7 +91,7 @@ static int onetest(CURL *curl, const char *url, const testparams *p)
replyselector = p->flags & F_CONTENTRANGE? 1: 0;
if(p->flags & F_HTTP416)
replyselector += 2;
- snprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
+ msnprintf(urlbuf, sizeof(urlbuf), "%s%04u", url, replyselector);
test_setopt(curl, CURLOPT_URL, urlbuf);
test_setopt(curl, CURLOPT_RESUME_FROM, (p->flags & F_RESUME)? 3: 0);
test_setopt(curl, CURLOPT_RANGE, !(p->flags & F_RESUME)?
diff --git a/tests/libtest/lib1502.c b/tests/libtest/lib1502.c
index bd7c7c86..6bde00a8 100644
--- a/tests/libtest/lib1502.c
+++ b/tests/libtest/lib1502.c
@@ -50,8 +50,8 @@ int test(char *URL)
/* DNS cache injection */
struct curl_slist *dns_cache_list;
- snprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
- libtest_arg3);
+ msnprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2,
+ libtest_arg3);
start_test_timing();
diff --git a/tests/libtest/lib1506.c b/tests/libtest/lib1506.c
index d456bc95..1d5e8de4 100644
--- a/tests/libtest/lib1506.c
+++ b/tests/libtest/lib1506.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -46,8 +46,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */
for(i = 0; i < NUM_HANDLES; i++) {
- snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
- i + 1, port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s",
+ i + 1, port, address);
printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) {
@@ -70,9 +70,9 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server%d.example.com:%s/path/1506%04i",
- i + 1, port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server%d.example.com:%s/path/1506%04i",
+ i + 1, port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib1510.c b/tests/libtest/lib1510.c
index d72749b2..4c7b670a 100644
--- a/tests/libtest/lib1510.c
+++ b/tests/libtest/lib1510.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013, 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -44,8 +44,8 @@ int test(char *URL)
/* Create fake DNS entries for serverX.example.com for all handles */
for(i = 0; i < NUM_URLS; i++) {
- snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
- port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1,
+ port, address);
printf("%s\n", dnsentry);
slist2 = curl_slist_append(slist, dnsentry);
if(!slist2) {
@@ -74,9 +74,9 @@ int test(char *URL)
/* get NUM_HANDLES easy handles */
for(i = 0; i < NUM_URLS; i++) {
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server%d.example.com:%s/path/1510%04i",
- i + 1, port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server%d.example.com:%s/path/1510%04i",
+ i + 1, port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl, CURLOPT_URL, target_url);
diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c
index 1c257895..0b71ad3f 100644
--- a/tests/libtest/lib1512.c
+++ b/tests/libtest/lib1512.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013 - 2017, Linus Nielsen Feltzing <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -49,8 +49,8 @@ int test(char *URL)
return TEST_ERR_MAJOR_BAD;
}
- snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
- port, address);
+ msnprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s",
+ port, address);
printf("%s\n", dnsentry);
slist = curl_slist_append(slist, dnsentry);
@@ -59,9 +59,9 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url),
- "http://server.example.curl:%s/path/1512%04i",
- port, i + 1);
+ msnprintf(target_url, sizeof(target_url),
+ "http://server.example.curl:%s/path/1512%04i",
+ port, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib1515.c b/tests/libtest/lib1515.c
index 39bccc59..c72554a3 100644
--- a/tests/libtest/lib1515.c
+++ b/tests/libtest/lib1515.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -123,8 +123,8 @@ int test(char *URL)
int i;
int count = 2;
- snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
- port, address);
+ msnprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s",
+ port, address);
start_test_timing();
@@ -133,8 +133,8 @@ int test(char *URL)
for(i = 1; i <= count; i++) {
char target_url[256];
- snprintf(target_url, sizeof(target_url),
- "http://testserver.example.com:%s/%s%04d", port, path, i);
+ msnprintf(target_url, sizeof(target_url),
+ "http://testserver.example.com:%s/%s%04d", port, path, i);
/* second request must succeed like the first one */
res = do_one_request(multi, target_url, dns_entry);
diff --git a/tests/libtest/lib1518.c b/tests/libtest/lib1518.c
new file mode 100644
index 00000000..1751b583
--- /dev/null
+++ b/tests/libtest/lib1518.c
@@ -0,0 +1,74 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "test.h"
+
+#include "memdebug.h"
+
+/* Test inspired by github issue 3340 */
+
+int test(char *URL)
+{
+ CURL *curl;
+ CURLcode res = CURLE_OK;
+ long curlResponseCode;
+ long curlRedirectCount;
+ char *effectiveUrl = NULL;
+ char *redirectUrl = NULL;
+
+ curl = curl_easy_init();
+ if(!curl) {
+ fprintf(stderr, "curl_easy_init() failed\n");
+ curl_global_cleanup();
+ return TEST_ERR_MAJOR_BAD;
+ }
+
+ test_setopt(curl, CURLOPT_URL, URL);
+ /* just to make it explicit and visible in this test: */
+ test_setopt(curl, CURLOPT_FOLLOWLOCATION, 0L);
+
+ /* Perform the request, res will get the return code */
+ res = curl_easy_perform(curl);
+
+ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &curlResponseCode);
+ curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &curlRedirectCount);
+ curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effectiveUrl);
+ curl_easy_getinfo(curl, CURLINFO_REDIRECT_URL, &redirectUrl);
+
+ printf("res: %d\n"
+ "status: %d\n"
+ "redirects: %d\n"
+ "effectiveurl: %s\n"
+ "redirecturl: %s\n",
+ (int)res,
+ (int)curlResponseCode,
+ (int)curlRedirectCount,
+ effectiveUrl,
+ redirectUrl);
+
+test_cleanup:
+
+ /* always cleanup */
+ curl_easy_cleanup(curl);
+ curl_global_cleanup();
+
+ return res;
+}
diff --git a/tests/libtest/lib1529.c b/tests/libtest/lib1529.c
index c63a109b..8d2210e2 100644
--- a/tests/libtest/lib1529.c
+++ b/tests/libtest/lib1529.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -29,7 +29,8 @@ int test(char *URL)
CURL *curl = NULL;
CURLcode res = CURLE_FAILED_INIT;
char bURL[512];
- snprintf(bURL, sizeof(bURL), "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
+ msnprintf(bURL, sizeof(bURL),
+ "%s HTTP/1.1\r\nGET http://1529.com/1529", URL);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c
index e0faa12b..7ae1025b 100644
--- a/tests/libtest/lib1560.c
+++ b/tests/libtest/lib1560.c
@@ -67,10 +67,10 @@ static int checkparts(CURLU *u, const char *in, const char *wanted,
size_t n;
rc = curl_url_get(u, parts[i].part, &p, getflags);
if(!rc && p) {
- snprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
+ msnprintf(bufp, len, "%s%s", buf[0]?" | ":"", p);
}
else
- snprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
+ msnprintf(bufp, len, "%s[%d]", buf[0]?" | ":"", (int)rc);
n = strlen(bufp);
bufp += n;
@@ -128,6 +128,29 @@ struct querycase {
};
static struct testcase get_parts_list[] ={
+#ifdef WIN32
+ {"file:/C:\\programs\\foo",
+ "file | [11] | [12] | [13] | [14] | [15] | C:\\programs\\foo | [16] | [17]",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
+ {"file://C:\\programs\\foo",
+ "file | [11] | [12] | [13] | [14] | [15] | C:\\programs\\foo | [16] | [17]",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
+ {"file:///C:\\programs\\foo",
+ "file | [11] | [12] | [13] | [14] | [15] | C:\\programs\\foo | [16] | [17]",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
+#endif
+ {"boing:80",
+ "https | [11] | [12] | [13] | boing | 80 | / | [16] | [17]",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
+ {"http://[fd00:a41::50]:8080",
+ "http | [11] | [12] | [13] | [fd00:a41::50] | 8080 | / | [16] | [17]",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
+ {"http://[fd00:a41::50]/",
+ "http | [11] | [12] | [13] | [fd00:a41::50] | [15] | / | [16] | [17]",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
+ {"http://[fd00:a41::50]",
+ "http | [11] | [12] | [13] | [fd00:a41::50] | [15] | / | [16] | [17]",
+ CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
{"https://[::1%252]:1234",
"https | [11] | [12] | [13] | [::1%252] | 1234 | / | [16] | [17]",
CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
@@ -700,7 +723,7 @@ static int get_parts(void)
static struct querycase append_list[] = {
{"HTTP://test/?s", "name=joe\x02", "http://test/?s&name=joe%02",
0, CURLU_URLENCODE, CURLUE_OK},
- {"HTTP://test/?size=2#f", "name=joe=", "http://test/?size=2&name=joe=#f",
+ {"HTTP://test/?size=2#f", "name=joe=", "http://test/?size=2&name=joe%3d#f",
0, CURLU_URLENCODE, CURLUE_OK},
{"HTTP://test/?size=2#f", "name=joe doe",
"http://test/?size=2&name=joe+doe#f",
diff --git a/tests/libtest/lib1900.c b/tests/libtest/lib1900.c
index cf55fb33..1e10bdf3 100644
--- a/tests/libtest/lib1900.c
+++ b/tests/libtest/lib1900.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013 - 2017, Linus Nielsen Feltzing, <linus@haxx.se>
+ * Copyright (C) 2013 - 2018, Linus Nielsen Feltzing, <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -113,7 +113,7 @@ static void setup_handle(char *base_url, CURLM *m, int handlenum)
{
char urlbuf[256];
- snprintf(urlbuf, sizeof(urlbuf), "%s%s", base_url, urlstring[handlenum]);
+ msnprintf(urlbuf, sizeof(urlbuf), "%s%s", base_url, urlstring[handlenum]);
curl_easy_setopt(handles[handlenum], CURLOPT_URL, urlbuf);
curl_easy_setopt(handles[handlenum], CURLOPT_VERBOSE, 1L);
curl_easy_setopt(handles[handlenum], CURLOPT_FAILONERROR, 1L);
diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c
index 81c5a5fa..1a3091fc 100644
--- a/tests/libtest/lib518.c
+++ b/tests/libtest/lib518.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -55,10 +55,10 @@ static char msgbuff[256];
static void store_errmsg(const char *msg, int err)
{
if(!err)
- snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+ msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
else
- snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
- err, strerror(err));
+ msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg,
+ err, strerror(err));
}
static void close_file_descriptors(void)
@@ -132,7 +132,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "initial soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -140,7 +140,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "initial hard limit: %s\n", strbuff);
/* show our constants */
@@ -198,7 +198,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "current soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -206,7 +206,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "current hard limit: %s\n", strbuff);
} /* (rl.rlim_cur != rl.rlim_max) */
@@ -233,10 +233,10 @@ static int rlimit(int keep_open)
(rl.rlim_cur != RLIM_INFINITY) &&
#endif
(rl.rlim_cur <= num_open.rlim_cur)) {
- snprintf(strbuff2, sizeof(strbuff2), fmt, rl.rlim_cur);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
- strbuff1, strbuff2);
+ msnprintf(strbuff2, sizeof(strbuff2), fmt, rl.rlim_cur);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
+ strbuff1, strbuff2);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
return -4;
@@ -257,7 +257,7 @@ static int rlimit(int keep_open)
nitems = 0x40000;
do {
num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
if(!memchunk) {
@@ -285,9 +285,9 @@ static int rlimit(int keep_open)
/* verify that we won't overflow size_t in malloc() */
if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
- "file descriptors, would overflow size_t", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
+ "file descriptors, would overflow size_t", strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
@@ -296,7 +296,7 @@ static int rlimit(int keep_open)
/* allocate array for file descriptors */
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
@@ -316,14 +316,14 @@ static int rlimit(int keep_open)
num_open.rlim_cur++)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
/* open a dummy descriptor */
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
- snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+ msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
@@ -344,20 +344,20 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
fprintf(stderr, "%s\n", strbuff);
- snprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+ msnprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
strbuff1);
fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = NUM_NEEDED;
- snprintf(strbuff2, sizeof(strbuff2), fmt, num_open.rlim_max);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
+ msnprintf(strbuff2, sizeof(strbuff2), fmt, num_open.rlim_max);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s",
strbuff2, strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -375,7 +375,7 @@ static int rlimit(int keep_open)
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "%s file descriptors open\n", strbuff);
#if !defined(HAVE_POLL_FINE) && \
@@ -395,7 +395,7 @@ static int rlimit(int keep_open)
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
if(num_open.rlim_max > num_open.rlim_cur) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -410,7 +410,7 @@ static int rlimit(int keep_open)
rl.rlim_cur++) {
if((fd[rl.rlim_cur] > 0) &&
((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
@@ -432,12 +432,12 @@ static int rlimit(int keep_open)
*/
if(!fopen_works()) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff),
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff),
"fopen fails with %s fds open()",
strbuff1);
fprintf(stderr, "%s\n", msgbuff);
- snprintf(strbuff, sizeof(strbuff),
+ msnprintf(strbuff, sizeof(strbuff),
"fopen fails with lots of fds open()");
store_errmsg(strbuff, 0);
close_file_descriptors();
diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c
index 7b71fa5e..8581303a 100644
--- a/tests/libtest/lib530.c
+++ b/tests/libtest/lib530.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -53,7 +53,7 @@ int test(char *URL)
/* get an easy handle */
easy_init(curl[i]);
/* specify target */
- snprintf(target_url, sizeof(target_url), "%s%04i", URL, i + 1);
+ msnprintf(target_url, sizeof(target_url), "%s%04i", URL, i + 1);
target_url[sizeof(target_url) - 1] = '\0';
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go verbose */
diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c
index bdc2e62e..e8fb16a4 100644
--- a/tests/libtest/lib537.c
+++ b/tests/libtest/lib537.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -56,10 +56,10 @@ static char msgbuff[256];
static void store_errmsg(const char *msg, int err)
{
if(!err)
- snprintf(msgbuff, sizeof(msgbuff), "%s", msg);
+ msnprintf(msgbuff, sizeof(msgbuff), "%s", msg);
else
- snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err,
- strerror(err));
+ msnprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err,
+ strerror(err));
}
static void close_file_descriptors(void)
@@ -133,7 +133,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "initial soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -141,7 +141,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "initial hard limit: %s\n", strbuff);
/*
@@ -193,7 +193,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur);
fprintf(stderr, "current soft limit: %s\n", strbuff);
#ifdef RLIM_INFINITY
@@ -201,7 +201,7 @@ static int rlimit(int keep_open)
strcpy(strbuff, "INFINITY");
else
#endif
- snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max);
fprintf(stderr, "current hard limit: %s\n", strbuff);
} /* (rl.rlim_cur != rl.rlim_max) */
@@ -231,7 +231,7 @@ static int rlimit(int keep_open)
nitems = 0x40000;
do {
num_open.rlim_max = sizeof(*memchunk) * nitems;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating memchunk %s byte array\n", strbuff);
memchunk = malloc(sizeof(*memchunk) * (size_t)nitems);
if(!memchunk) {
@@ -274,9 +274,9 @@ static int rlimit(int keep_open)
/* verify that we won't overflow size_t in malloc() */
if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
- "file descriptors, would overflow size_t", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s "
+ "file descriptors, would overflow size_t", strbuff1);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
@@ -286,7 +286,7 @@ static int rlimit(int keep_open)
/* allocate array for file descriptors */
do {
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "allocating array for %s file descriptors\n", strbuff);
fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
if(!fd) {
@@ -310,14 +310,14 @@ static int rlimit(int keep_open)
num_open.rlim_cur++)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "trying to open %s file descriptors\n", strbuff);
/* open a dummy descriptor */
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
- snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
+ msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
@@ -338,21 +338,21 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1);
fprintf(stderr, "%s\n", strbuff);
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s",
+ strbuff1);
fprintf(stderr, "%s\n", strbuff);
num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN;
num_open.rlim_cur -= num_open.rlim_max;
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
- snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur);
+ msnprintf(strbuff, sizeof(strbuff), "closing %s file descriptors",
+ strbuff1);
fprintf(stderr, "%s\n", strbuff);
for(num_open.rlim_cur = num_open.rlim_max;
@@ -362,7 +362,7 @@ static int rlimit(int keep_open)
fd[num_open.rlim_cur] = -1;
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "shrinking array for %s file descriptors\n", strbuff);
/* we don't care if we can't shrink it */
@@ -379,7 +379,7 @@ static int rlimit(int keep_open)
}
- snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max);
fprintf(stderr, "%s file descriptors open\n", strbuff);
#if !defined(HAVE_POLL_FINE) && \
@@ -399,8 +399,8 @@ static int rlimit(int keep_open)
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
if(num_open.rlim_max > num_open.rlim_cur) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
- FD_SETSIZE);
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors();
@@ -414,8 +414,8 @@ static int rlimit(int keep_open)
rl.rlim_cur++) {
if((fd[rl.rlim_cur] > 0) &&
((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) {
- snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
- FD_SETSIZE);
+ msnprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d",
+ FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors();
@@ -436,11 +436,11 @@ static int rlimit(int keep_open)
*/
if(!fopen_works()) {
- snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
- snprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
- strbuff1);
+ msnprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max);
+ msnprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open",
+ strbuff1);
fprintf(stderr, "%s\n", msgbuff);
- snprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
+ msnprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open");
store_errmsg(strbuff, 0);
close_file_descriptors();
free(memchunk);
diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c
index ff8a9b05..a52d8c50 100644
--- a/tests/libtest/lib540.c
+++ b/tests/libtest/lib540.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -198,7 +198,7 @@ int test(char *URL)
if(test_argc < 4)
return 99;
- snprintf(buffer, sizeof(buffer), "Host: %s", HOST);
+ msnprintf(buffer, sizeof(buffer), "Host: %s", HOST);
/* now add a custom Host: header */
headers = curl_slist_append(headers, buffer);
diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c
index c06561e1..95b5ac39 100644
--- a/tests/libtest/lib553.c
+++ b/tests/libtest/lib553.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -75,7 +75,7 @@ int test(char *URL)
}
for(i = 0; i < NUM_HEADERS; i++) {
- int len = snprintf(buf, sizeof(buf), "Header%d: ", i);
+ int len = msnprintf(buf, sizeof(buf), "Header%d: ", i);
memset(&buf[len], 'A', SIZE_HEADERS);
buf[len + SIZE_HEADERS] = 0; /* zero terminate */
hl = curl_slist_append(headerlist, buf);
diff --git a/tests/libtest/lib658.c b/tests/libtest/lib658.c
new file mode 100644
index 00000000..98e0db4b
--- /dev/null
+++ b/tests/libtest/lib658.c
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2011, 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+#include "test.h"
+
+#include "testutil.h"
+#include "warnless.h"
+#include "memdebug.h"
+
+/*
+ * Get a single URL without select().
+ */
+
+int test(char *URL)
+{
+ CURL *handle = NULL;
+ CURLcode res = 0;
+ CURLU *urlp = NULL;
+ CURLUcode uc = 0;
+
+ global_init(CURL_GLOBAL_ALL);
+ easy_init(handle);
+
+ urlp = curl_url();
+
+ if(!urlp) {
+ fprintf(stderr, "problem init URL api.");
+ goto test_cleanup;
+ }
+
+ uc = curl_url_set(urlp, CURLUPART_URL, URL, 0);
+ if(uc) {
+ fprintf(stderr, "problem setting CURLUPART_URL.");
+ goto test_cleanup;
+ }
+
+ /* demonstrate override behavior */
+ easy_setopt(handle, CURLOPT_URL, "http://www.example.com");
+
+ easy_setopt(handle, CURLOPT_CURLU, urlp);
+ easy_setopt(handle, CURLOPT_VERBOSE, 1L);
+
+ res = curl_easy_perform(handle);
+
+ if(res) {
+ fprintf(stderr, "%s:%d curl_easy_perform() failed with code %d (%s)\n",
+ __FILE__, __LINE__, res, curl_easy_strerror(res));
+ goto test_cleanup;
+ }
+
+test_cleanup:
+
+ curl_url_cleanup(urlp);
+ curl_easy_cleanup(handle);
+ curl_global_cleanup();
+
+ return res;
+}
diff --git a/tests/libtest/libauthretry.c b/tests/libtest/libauthretry.c
index 8e348ad1..cfad6f3e 100644
--- a/tests/libtest/libauthretry.c
+++ b/tests/libtest/libauthretry.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -38,7 +38,7 @@ static CURLcode send_request(CURL *curl, const char *url, int seq,
return CURLE_OUT_OF_MEMORY;
}
- snprintf(full_url, len, "%s%04d", url, seq);
+ msnprintf(full_url, len, "%s%04d", url, seq);
fprintf(stderr, "Sending new request %d to %s with credential %s "
"(auth %ld)\n", seq, full_url, userpwd, auth_scheme);
test_setopt(curl, CURLOPT_URL, full_url);
diff --git a/tests/libtest/libntlmconnect.c b/tests/libtest/libntlmconnect.c
index e17b991a..426f6f24 100644
--- a/tests/libtest/libntlmconnect.c
+++ b/tests/libtest/libntlmconnect.c
@@ -135,11 +135,11 @@ int test(char *url)
easy_init(easy[num_handles]);
if(num_handles % 3 == 2) {
- snprintf(full_url, urllen, "%s0200", url);
+ msnprintf(full_url, urllen, "%s0200", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
}
else {
- snprintf(full_url, urllen, "%s0100", url);
+ msnprintf(full_url, urllen, "%s0100", url);
easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
}
easy_setopt(easy[num_handles], CURLOPT_FRESH_CONNECT, 1L);
diff --git a/tests/libtest/stub_gssapi.c b/tests/libtest/stub_gssapi.c
index aaa7796b..254a01b3 100644
--- a/tests/libtest/stub_gssapi.c
+++ b/tests/libtest/stub_gssapi.c
@@ -28,6 +28,11 @@
#include "stub_gssapi.h"
+#define ENABLE_CURLX_PRINTF
+/* make the curlx header define all printf() functions to use the curlx_*
+ versions instead */
+#include "curlx.h" /* from the private lib dir */
+
#define MAX_CREDS_LENGTH 250
#define APPROX_TOKEN_LEN 250
@@ -202,8 +207,8 @@ OM_uint32 gss_init_sec_context(OM_uint32 *min,
}
/* Token format: creds:target:type:padding */
- used = snprintf(token, length, "%s:%s:%d:", creds,
- (char *) target_name, ctx->sent);
+ used = msnprintf(token, length, "%s:%s:%d:", creds,
+ (char *) target_name, ctx->sent);
if(used >= length) {
free(token);
diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c
index 0a98d006..2718ef93 100644
--- a/tests/libtest/testtrace.c
+++ b/tests/libtest/testtrace.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -108,8 +108,8 @@ int libtest_debug_cb(CURL *handle, curl_infotype type,
}
secs = epoch_offset + tv.tv_sec;
now = localtime(&secs); /* not thread safe but we don't care */
- snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
- now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
+ msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
+ now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
}
switch(type) {