aboutsummaryrefslogtreecommitdiff
path: root/tests/server/sws.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-11-22 09:01:24 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-23 08:26:51 +0100
commitdcd6f810255785d52b89150e18460fb0899d4f7e (patch)
treec3cb7cdcb79dbf752edcd997934e44a2e9998397 /tests/server/sws.c
parent9944d6ba334f07b0b6199bdb5bb82091c88c16ed (diff)
snprintf: renamed and we now only use msnprintf()
The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
Diffstat (limited to 'tests/server/sws.c')
-rw-r--r--tests/server/sws.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c
index 8df4d76e4..cf3d291d9 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -509,11 +509,11 @@ static int ProcessRequest(struct httprequest *req)
/* get the number after it */
if(ptr) {
if((strlen(doc) + strlen(request)) < 400)
- snprintf(logbuf, sizeof(logbuf), "Got request: %s %s HTTP/%d.%d",
- request, doc, prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf), "Got request: %s %s HTTP/%d.%d",
+ request, doc, prot_major, prot_minor);
else
- snprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request HTTP/%d.%d",
- prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request HTTP/%d.%d",
+ prot_major, prot_minor);
logmsg("%s", logbuf);
if(!strncmp("/verifiedserver", ptr, 15)) {
@@ -545,8 +545,8 @@ static int ProcessRequest(struct httprequest *req)
if(req->testno) {
- snprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld",
- req->testno, req->partno);
+ msnprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld",
+ req->testno, req->partno);
logmsg("%s", logbuf);
/* find and parse <servercmd> for this test */
@@ -565,9 +565,9 @@ static int ProcessRequest(struct httprequest *req)
doc, &prot_major, &prot_minor) == 3) {
char *portp = NULL;
- snprintf(logbuf, sizeof(logbuf),
- "Received a CONNECT %s HTTP/%d.%d request",
- doc, prot_major, prot_minor);
+ msnprintf(logbuf, sizeof(logbuf),
+ "Received a CONNECT %s HTTP/%d.%d request",
+ doc, prot_major, prot_minor);
logmsg("%s", logbuf);
req->connect_request = TRUE;
@@ -645,9 +645,9 @@ static int ProcessRequest(struct httprequest *req)
else
req->partno = 0;
- snprintf(logbuf, sizeof(logbuf),
- "Requested test number %ld part %ld (from host name)",
- req->testno, req->partno);
+ msnprintf(logbuf, sizeof(logbuf),
+ "Requested test number %ld part %ld (from host name)",
+ req->testno, req->partno);
logmsg("%s", logbuf);
}
@@ -696,9 +696,9 @@ static int ProcessRequest(struct httprequest *req)
else
req->partno = 0;
- snprintf(logbuf, sizeof(logbuf),
- "Requested GOPHER test number %ld part %ld",
- req->testno, req->partno);
+ msnprintf(logbuf, sizeof(logbuf),
+ "Requested GOPHER test number %ld part %ld",
+ req->testno, req->partno);
logmsg("%s", logbuf);
}
}
@@ -1117,14 +1117,14 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
case DOCNUMBER_WERULEZ:
/* we got a "friends?" question, reply back that we sure are */
logmsg("Identifying ourselves as friends");
- snprintf(msgbuf, sizeof(msgbuf), "WE ROOLZ: %ld\r\n", (long)getpid());
+ msnprintf(msgbuf, sizeof(msgbuf), "WE ROOLZ: %ld\r\n", (long)getpid());
msglen = strlen(msgbuf);
if(use_gopher)
- snprintf(weare, sizeof(weare), "%s", msgbuf);
+ msnprintf(weare, sizeof(weare), "%s", msgbuf);
else
- snprintf(weare, sizeof(weare),
- "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s",
- msglen, msgbuf);
+ msnprintf(weare, sizeof(weare),
+ "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s",
+ msglen, msgbuf);
buffer = weare;
break;
case DOCNUMBER_404:
@@ -1145,9 +1145,9 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
const char *section = req->connect_request?"connect":"data";
if(req->partno)
- snprintf(partbuf, sizeof(partbuf), "%s%ld", section, req->partno);
+ msnprintf(partbuf, sizeof(partbuf), "%s%ld", section, req->partno);
else
- snprintf(partbuf, sizeof(partbuf), "%s", section);
+ msnprintf(partbuf, sizeof(partbuf), "%s", section);
logmsg("Send response test%ld section <%s>", req->testno, partbuf);
@@ -2118,7 +2118,7 @@ int main(int argc, char *argv[])
}
}
- snprintf(port_str, sizeof(port_str), "port %hu", port);
+ msnprintf(port_str, sizeof(port_str), "port %hu", port);
#ifdef WIN32
win32_init();