badwords: fix issues found in tests

There remain some false positives, hits in test data, and `dir` use,
around 100 issues in total.

There is no plan to enforce badwords on tests.

Also:
- badwords.txt: let a few `manpage[s]` occurrences through
  (in Perl code).

Closes #19541
This commit is contained in:
Viktor Szakats 2025-11-15 00:27:38 +01:00
parent f0de14168a
commit a87383828e
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
247 changed files with 594 additions and 595 deletions

View file

@ -150,7 +150,7 @@ extern curl_socket_t sockdaemon(curl_socket_t sock,
bool bind_only);
/* global variables */
static const char *srcpath = "."; /* pointing to the test dir */
static const char *srcpath = "."; /* pointing to the test directory */
static const char *pidname = NULL;
static const char *portname = NULL; /* none by default */
static const char *serverlogfile = NULL;

View file

@ -50,7 +50,7 @@ static size_t line_length(const char *buffer, int bytestocheck)
}
if(*buffer != '\n') {
/*
* We didn't find a new line so the last byte must be a
* We did not find a new line so the last byte must be a
* '\0' character inserted by fgets() which we should not
* count.
*/

View file

@ -563,7 +563,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
memcpy(topic, &buffer[4], topic_len);
topic[topic_len] = 0;
/* there's a QoS byte (two bits) after the topic */
/* there is a QoS byte (two bits) after the topic */
logmsg("SUBSCRIBE to '%s' [%d]", topic, packet_id);
stream = test2fopen(testno, logdir);
@ -572,7 +572,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
error = errno;
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg("Couldn't open test file %ld", testno);
logmsg("Could not open test file %ld", testno);
goto end;
}
error = getpart(&data, &datalen, "reply", "data", stream);
@ -679,7 +679,7 @@ static bool mqttd_incoming(curl_socket_t listenfd)
FD_ZERO(&fds_write);
FD_ZERO(&fds_err);
/* there's always a socket to wait for */
/* there is always a socket to wait for */
#ifdef __DJGPP__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"

View file

@ -93,7 +93,7 @@ static int test_resolve(int argc, char *argv[])
/* Check that the system has IPv6 enabled before checking the resolver */
curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);
if(s == CURL_SOCKET_BAD)
/* an IPv6 address was requested and we can't get/use one */
/* an IPv6 address was requested and we cannot get/use one */
rc = -1;
else {
sclose(s);
@ -128,7 +128,7 @@ static int test_resolve(int argc, char *argv[])
#endif
if(rc)
printf("Resolving %s '%s' didn't work\n", ipv_inuse, host);
printf("Resolving %s '%s' did not work\n", ipv_inuse, host);
return !!rc;
}

View file

@ -62,8 +62,8 @@ struct rtspd_httprequest {
long testno; /* test number found in the request */
long partno; /* part number found in the request */
bool open; /* keep connection open info, as found in the request */
bool auth_req; /* authentication required, don't wait for body unless
there's an Authorization header */
bool auth_req; /* authentication required, do not wait for body unless
there is an Authorization header */
bool auth; /* Authorization header present in the incoming request */
size_t cl; /* Content-Length of the incoming request */
bool digest; /* Authorization digest header found */
@ -238,7 +238,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
int error = errno;
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg("Couldn't open test file %ld", req->testno);
logmsg("Could not open test file %ld", req->testno);
req->open = FALSE; /* closes connection */
return 1; /* done */
}
@ -285,7 +285,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
if(num < 0)
logmsg("negative pipe size ignored");
else if(num > 0)
req->pipe = num-1; /* decrease by one since we don't count the
req->pipe = num-1; /* decrease by one since we do not count the
first request in this number */
}
else if(sscanf(ptr, "skip: %d", &num) == 1) {
@ -362,10 +362,10 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
req->open = FALSE; /* HTTP 1.0 closes connection by default */
if(!strncmp(doc, "bad", 3))
/* if the host name starts with bad, we fake an error here */
/* if the hostname starts with bad, we fake an error here */
req->testno = DOCNUMBER_BADCONNECT;
else if(!strncmp(doc, "test", 4)) {
/* if the host name starts with test, the port number used in the
/* if the hostname starts with test, the port number used in the
CONNECT line will be used as test number! */
char *portp = strchr(doc, ':');
if(portp && (*(portp + 1) != '\0') && ISDIGIT(*(portp + 1))) {
@ -389,7 +389,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
}
if(!end) {
/* we don't have a complete request yet! */
/* we do not have a complete request yet! */
logmsg("rtspd_ProcessRequest returned without a complete request");
return 0; /* not complete yet */
}
@ -403,7 +403,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
/* **** Persistence ****
*
* If the request is an HTTP/1.0 one, we close the connection unconditionally
* when we're done.
* when we are done.
*
* If the request is an HTTP/1.1 one, we MUST check for a "Connection:"
* header that might say "close". If it does, we close a connection when
@ -416,8 +416,8 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
return 1; /* done */
if((req->cl == 0) && !CURL_STRNICMP("Content-Length:", line, 15)) {
/* If we don't ignore content-length, we read it and we read the whole
request including the body before we return. If we've been told to
/* If we do not ignore content-length, we read it and we read the whole
request including the body before we return. If we have been told to
ignore the content-length, we will return as soon as all headers
have been received */
curl_off_t clen;
@ -645,7 +645,7 @@ static int rtspd_get_request(curl_socket_t sock, struct rtspd_httprequest *req)
else {
if(req->skip)
/* we are instructed to not read the entire thing, so we make sure to
only read what we're supposed to and NOT read the entire thing the
only read what we are supposed to and NOT read the entire thing the
client wants to send! */
got = sread(sock, reqbuf + req->offset, req->cl);
else
@ -810,7 +810,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
error = errno;
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg("Couldn't open test file");
logmsg("Could not open test file");
return 0;
}
else {
@ -834,7 +834,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
error = errno;
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg("Couldn't open test file");
logmsg("Could not open test file");
free(ptr);
return 0;
}
@ -876,7 +876,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg("Error opening file '%s'", responsedump);
logmsg("couldn't create logfile '%s'", responsedump);
logmsg("could not create logfile '%s'", responsedump);
free(ptr);
free(cmd);
return -1;

View file

@ -901,7 +901,7 @@ static bool disc_handshake(void)
* The only other messages that could occur here are PING and PORT,
* and both of them occur at the start of a test when nothing should be
* trying to DISC. Therefore, we should not ever get here, but if we
* do, it's probably due to some kind of unclean shutdown situation so
* do, it is probably due to some kind of unclean shutdown situation so
* us shutting down is what we probably ought to be doing, anyway.
*/
return FALSE;
@ -970,7 +970,7 @@ static bool juggle(curl_socket_t *sockfdp,
/* server mode */
sockfd = listenfd;
/* there's always a socket to wait for */
/* there is always a socket to wait for */
#ifdef __DJGPP__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
@ -991,7 +991,7 @@ static bool juggle(curl_socket_t *sockfdp,
maxfd = 0; /* stdin */
}
else {
/* there's always a socket to wait for */
/* there is always a socket to wait for */
#ifdef __DJGPP__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"
@ -1150,7 +1150,7 @@ static bool juggle(curl_socket_t *sockfdp,
if((sockfd != CURL_SOCKET_BAD) && (FD_ISSET(sockfd, &fds_read)) ) {
ssize_t nread_socket;
if(*mode == PASSIVE_LISTEN) {
/* there's no stream set up yet, this is an indication that there's a
/* there is no stream set up yet, this is an indication that there is a
client connecting. */
curl_socket_t newfd = accept(sockfd, NULL, NULL);
if(CURL_SOCKET_BAD == newfd) {

View file

@ -42,7 +42,7 @@
* state
* "nmethods_max [number: 3]" - the minimum numberf NMETHODS the client must
* state
* "user [string]" - the user name that must match (if method is 2)
* "user [string]" - the username that must match (if method is 2)
* "password [string]" - the password that must match (if method is 2)
* "backend [IPv4]" - numerical IPv4 address of backend to connect to
* "backendport [number:0]" - TCP port of backend to connect to. 0 means use
@ -644,7 +644,7 @@ static bool socksd_incoming(curl_socket_t listenfd)
FD_ZERO(&fds_write);
FD_ZERO(&fds_err);
/* there's always a socket to wait for */
/* there is always a socket to wait for */
#ifdef __DJGPP__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warith-conversion"

View file

@ -59,8 +59,8 @@ struct sws_httprequest {
long testno; /* test number found in the request */
long partno; /* part number found in the request */
bool open; /* keep connection open info, as found in the request */
bool auth_req; /* authentication required, don't wait for body unless
there's an Authorization header */
bool auth_req; /* authentication required, do not wait for body unless
there is an Authorization header */
bool auth; /* Authorization header present in the incoming request */
size_t cl; /* Content-Length of the incoming request */
bool digest; /* Authorization digest header found */
@ -76,7 +76,7 @@ struct sws_httprequest {
int prot_version; /* HTTP version * 10 */
int callcount; /* times sws_ProcessRequest() gets called */
bool skipall; /* skip all incoming data */
bool noexpect; /* refuse Expect: (don't read the body) */
bool noexpect; /* refuse Expect: (do not read the body) */
bool connmon; /* monitor the state of the connection, log disconnects */
bool upgrade; /* test case allows upgrade */
bool upgrade_request; /* upgrade request found and allowed */
@ -208,7 +208,7 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
error = errno;
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg(" Couldn't open test file %ld", req->testno);
logmsg(" Could not open test file %ld", req->testno);
req->open = FALSE; /* closes connection */
return 1; /* done */
}
@ -340,7 +340,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
if(http && sscanf(http, "HTTP/%d.%d",
&prot_major,
&prot_minor) == 2) {
/* between the request keyword and HTTP/ there's a path */
/* between the request keyword and HTTP/ there is a path */
httppath = line + strlen(request);
npath = http - httppath;
@ -414,7 +414,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
}
if(req->testno == DOCNUMBER_NOTHING) {
/* didn't find any in the first scan, try alternative test case
/* did not find any in the first scan, try alternative test case
number placements */
static char doc[MAXDOCNAMELEN];
if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d",
@ -485,7 +485,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
}
if(!end) {
/* we don't have a complete request yet! */
/* we do not have a complete request yet! */
logmsg("request not complete yet");
return 0; /* not complete yet */
}
@ -545,7 +545,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
/* **** Persistence ****
*
* If the request is an HTTP/1.0 one, we close the connection unconditionally
* when we're done.
* when we are done.
*
* If the request is an HTTP/1.1 one, we MUST check for a "Connection:"
* header that might say "close". If it does, we close a connection when
@ -558,8 +558,8 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
return 1; /* done */
if((req->cl == 0) && !CURL_STRNICMP("Content-Length:", line, 15)) {
/* If we don't ignore content-length, we read it and we read the whole
request including the body before we return. If we've been told to
/* If we do not ignore content-length, we read it and we read the whole
request including the body before we return. If we have been told to
ignore the content-length, we will return as soon as all headers
have been received */
curl_off_t clen;
@ -883,7 +883,7 @@ static int sws_get_request(curl_socket_t sock, struct sws_httprequest *req)
else {
if(req->skip)
/* we are instructed to not read the entire thing, so we make sure to
only read what we're supposed to and NOT read the entire thing the
only read what we are supposed to and NOT read the entire thing the
client wants to send! */
got = sread(sock, reqbuf + req->offset, req->cl);
else
@ -1955,7 +1955,7 @@ static int service_connection(curl_socket_t *msgsock,
if(req->connect_request) {
/* a CONNECT request, setup and talk the tunnel */
if(!is_proxy) {
logmsg("received CONNECT but isn't running as proxy!");
logmsg("received CONNECT but not running as proxy!");
return 1;
}
else {
@ -2419,7 +2419,7 @@ static int test_sws(int argc, char *argv[])
if(!req->open)
/* When instructed to close connection after server-reply we
wait a very small amount of time before doing so. If this
wait a small amount of time before doing so. If this
is not done client might get an ECONNRESET before reading
a single byte of server-reply. */
curlx_wait_ms(50);
@ -2437,7 +2437,7 @@ static int test_sws(int argc, char *argv[])
goto sws_cleanup;
}
/* Reset the request, unless we're still in the middle of reading */
/* Reset the request, unless we are still in the middle of reading */
if(rc && !req->upgrade_request)
/* Note: resetting the HTTP request here can cause problems if:
* 1) req->skipall is TRUE,
@ -2448,9 +2448,9 @@ static int test_sws(int argc, char *argv[])
* data (in service_connection()) as the first data received on
* this new HTTP request and report "** Unusual request" (skipall
* would have otherwise caused that data to be ignored). Normally,
* that socket will be closed by the client and there won't be any
* stale data to cause this, but stranger things have happened (see
* issue #11678).
* that socket will be closed by the client and there will not be
* any stale data to cause this, but stranger things have happened
* (see issue #11678).
*/
init_httprequest(req);
} while(rc > 0);

View file

@ -310,7 +310,7 @@ static struct tftphdr *rw_init(int x)
{
newline = 0; /* init crlf flag */
prevchar = -1;
bfs[0].counter = BF_ALLOC; /* pass out the first buffer */
bfs[0].counter = BF_ALLOC; /* pass out the first buffer */
current = 0;
bfs[1].counter = BF_FREE;
nextone = x; /* ahead or behind? */
@ -339,7 +339,7 @@ static int readit(struct testcase *test, struct tftphdr * volatile *dpp,
current = !current; /* "incr" current */
b = &bfs[current]; /* look at new buffer */
if(b->counter == BF_FREE) /* if it's empty */
if(b->counter == BF_FREE) /* if empty */
read_ahead(test, convert); /* fill it */
*dpp = &b->buf.hdr; /* set caller's ptr */
@ -360,7 +360,7 @@ static void read_ahead(struct testcase *test,
struct tftphdr *dp;
b = &bfs[nextone]; /* look at "next" buffer */
if(b->counter != BF_FREE) /* nop if not free */
if(b->counter != BF_FREE) /* nop if not free */
return;
nextone = !nextone; /* "incr" next buffer ptr */
@ -447,7 +447,7 @@ static ssize_t write_behind(struct testcase *test, int convert)
snprintf(outfile, sizeof(outfile), "%s/upload.%ld", logdir, test->testno);
test->ofile = open(outfile, O_CREAT|O_RDWR|CURL_O_BINARY, 0777);
if(test->ofile == -1) {
logmsg("Couldn't create and/or open file %s for upload!", outfile);
logmsg("Could not create and/or open file %s for upload!", outfile);
return -1; /* failure! */
}
}
@ -1017,7 +1017,7 @@ static int tftpd_parse_servercmd(struct testcase *req)
error = errno;
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg(" Couldn't open test file %ld", req->testno);
logmsg(" Could not open test file %ld", req->testno);
return 1; /* done */
}
else {
@ -1141,7 +1141,7 @@ static int validate_access(struct testcase *test,
int error = errno;
logmsg("fopen() failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
logmsg("Couldn't open test file for test: %ld", testno);
logmsg("Could not open test file for test: %ld", testno);
return TFTP_EACCESS;
}
else {

View file

@ -97,7 +97,7 @@ void logmsg(const char *msg, ...)
}
sec = epoch_offset + tv.tv_sec;
/* !checksrc! disable BANNEDFUNC 1 */
now = localtime(&sec); /* not thread safe but we don't care */
now = localtime(&sec); /* not thread safe but we do not care */
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
(int)now->tm_hour, (int)now->tm_min, (int)now->tm_sec,
@ -227,7 +227,7 @@ int write_pidfile(const char *filename)
pidfile = fopen(filename, "wb");
if(!pidfile) {
char errbuf[STRERROR_LEN];
logmsg("Couldn't write pid file: %s (%d) %s", filename,
logmsg("Could not write pid file: %s (%d) %s", filename,
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
return 0; /* fail */
}
@ -243,7 +243,7 @@ int write_portfile(const char *filename, int port)
FILE *portfile = fopen(filename, "wb");
if(!portfile) {
char errbuf[STRERROR_LEN];
logmsg("Couldn't write port file: %s (%d) %s", filename,
logmsg("Could not write port file: %s (%d) %s", filename,
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
return 0; /* fail */
}