mirror of
https://github.com/curl/curl.git
synced 2026-07-28 18:13:06 +03:00
badwords: rework exceptions, fix many of them
Also: - support per-directory and per-upper-directory whitelist entries. - convert badlist input grep tweak into the above format. (except for 'And' which had just a few hits.) - fix many code exceptions, but do not enforce. (there also remain about 350 'will' uses in lib) - fix badwords in example code, drop exceptions. - badwords-all: convert to Perl. To make it usable from CMake. - FAQ: reword to not use 'will'. Drop exception. Closes #20886
This commit is contained in:
parent
11c14b5ca5
commit
435eabeac8
89 changed files with 367 additions and 344 deletions
|
|
@ -66,7 +66,7 @@ if(CURL_CA_EMBED_SET)
|
|||
list(APPEND _curl_cfiles_gen "tool_ca_embed.c")
|
||||
list(APPEND _curl_definitions "CURL_CA_EMBED")
|
||||
else()
|
||||
message(WARNING "Perl not found. Will not embed the CA bundle.")
|
||||
message(WARNING "Perl not found. Cannot embed the CA bundle.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -845,8 +845,8 @@ CURLcode config2setopts(struct OperationConfig *config,
|
|||
|
||||
#ifndef DEBUGBUILD
|
||||
/* On most modern OSes, exiting works thoroughly,
|
||||
we will clean everything up via exit(), so do not bother with
|
||||
slow cleanups. Crappy ones might need to skip this.
|
||||
we clean everything up via exit(), so do not bother with slow
|
||||
cleanups. Crappy ones might need to skip this.
|
||||
Note: avoid having this setopt added to the --libcurl source
|
||||
output. */
|
||||
result = curl_easy_setopt(curl, CURLOPT_QUICK_EXIT, 1L);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct slist_wc {
|
|||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Appends a string to a linked list. If no list exists, it will be created
|
||||
* Appends a string to a linked list. If no list exists, it is created
|
||||
* first. Returns the new list, after appending.
|
||||
*/
|
||||
struct slist_wc *slist_wc_append(struct slist_wc *list, const char *data);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
/*
|
||||
* get_terminal_columns() returns the number of columns in the current
|
||||
* terminal. It will return 79 on failure. Also, the number can be big.
|
||||
* terminal. It returns 79 on failure. Also, the number can be big.
|
||||
*/
|
||||
unsigned int get_terminal_columns(void)
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ unsigned int get_terminal_columns(void)
|
|||
GetConsoleScreenBufferInfo(stderr_hnd, &console_info)) {
|
||||
/*
|
||||
* Do not use +1 to get the true screen-width since writing a
|
||||
* character at the right edge will cause a line wrap.
|
||||
* character at the right edge causes a line wrap.
|
||||
*/
|
||||
cols = (int)(console_info.srWindow.Right - console_info.srWindow.Left);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
|
|||
|
||||
if(curl_lseek(per->infd, offset, whence) == LSEEK_ERROR)
|
||||
/* could not rewind, the reason is in errno but errno is not portable
|
||||
enough and we do not actually care that much why we failed. We will let
|
||||
enough and we do not actually care that much why we failed. We let
|
||||
libcurl know that it may try other means if it wants to. */
|
||||
return CURL_SEEKFUNC_CANTSEEK;
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ struct OperationConfig {
|
|||
by using the default behavior for -o, -O, and -J.
|
||||
If those options would have overwritten files, like
|
||||
-o and -O would, then overwrite them. In the case of
|
||||
-J, this will not overwrite any files. */
|
||||
-J, this does not overwrite any files. */
|
||||
CLOBBER_NEVER, /* If the file exists, always fail */
|
||||
CLOBBER_ALWAYS /* If the file exists, always overwrite it */
|
||||
} file_clobber_mode;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static void show_dir_errno(const char *name)
|
|||
#endif
|
||||
#ifdef ENOSPC
|
||||
case ENOSPC:
|
||||
errorf("No space left on the file system that will "
|
||||
errorf("No space left on the file system that would "
|
||||
"contain the directory %s", name);
|
||||
break;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ char **__crt0_glob_function(char *arg)
|
|||
#endif
|
||||
|
||||
/*
|
||||
* Test if truncating a path to a file will leave at least a single character
|
||||
* Test if truncating a path to a file leaves at least a single character
|
||||
* in the filename. Filenames suffixed by an alternate data stream cannot be
|
||||
* truncated. This performs a dry run, nothing is modified.
|
||||
*
|
||||
|
|
@ -599,7 +599,7 @@ struct curl_slist *GetLoadedModulePaths(void)
|
|||
|
||||
#ifdef UNICODE
|
||||
/* sizeof(mod.szExePath) is the max total bytes of wchars. the max total
|
||||
bytes of multibyte chars will not be more than twice that. */
|
||||
bytes of multibyte chars is not more than twice that. */
|
||||
char buffer[sizeof(mod.szExePath) * 2];
|
||||
if(!WideCharToMultiByte(CP_ACP, 0, mod.szExePath, -1,
|
||||
buffer, sizeof(buffer), NULL, NULL))
|
||||
|
|
@ -783,8 +783,8 @@ curl_socket_t win32_stdin_read_thread(void)
|
|||
errorf("curlx_calloc() error");
|
||||
break;
|
||||
}
|
||||
/* Create the listening socket for the thread. When it starts, it will
|
||||
* accept our connection and begin writing STDIN data to the connection. */
|
||||
/* Create the listening socket for the thread. When it starts, it accepts
|
||||
* our connection and begin writing STDIN data to the connection. */
|
||||
tdata->socket_l = CURL_SOCKET(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if(tdata->socket_l == CURL_SOCKET_BAD) {
|
||||
errorf("socket() error: %d", SOCKERRNO);
|
||||
|
|
@ -822,7 +822,7 @@ curl_socket_t win32_stdin_read_thread(void)
|
|||
|
||||
/* Start up the thread. We do not bother keeping a reference to it
|
||||
because it runs until program termination. From here on out all reads
|
||||
from the stdin handle or file descriptor 0 will be reading from the
|
||||
from the stdin handle or file descriptor 0 is reading from the
|
||||
socket that is fed by the thread. */
|
||||
stdin_thread = CreateThread(NULL, 0, win_stdin_thread_func,
|
||||
tdata, 0, NULL);
|
||||
|
|
|
|||
|
|
@ -690,14 +690,14 @@ static int get_param_part(char endchar,
|
|||
* 'name=foo;headers=@headerfile' or why not
|
||||
* 'name=@filemame;headers=@headerfile'
|
||||
*
|
||||
* To upload a file, but to fake the filename that will be included in the
|
||||
* To upload a file, but to fake the filename that is included in the
|
||||
* formpost, do like this:
|
||||
*
|
||||
* 'name=@filename;filename=/dev/null' or quote the faked filename like:
|
||||
* 'name=@filename;filename="play, play, and play.txt"'
|
||||
*
|
||||
* If filename/path contains ',' or ';', it must be quoted by double-quotes,
|
||||
* else curl will fail to figure out the correct filename. if the filename
|
||||
* else curl fails to figure out the correct filename. if the filename
|
||||
* tobe quoted contains '"' or '\', '"' and '\' must be escaped by backslash.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
|
@ -716,8 +716,8 @@ int formparse(const char *input,
|
|||
struct tool_mime **mimecurrent,
|
||||
bool literal_value)
|
||||
{
|
||||
/* input MUST be a string in the format 'name=contents' and we will
|
||||
build a linked list with the info */
|
||||
/* input MUST be a string in the format 'name=contents' and we build
|
||||
a linked list with the info */
|
||||
char *name = NULL;
|
||||
char *contents = NULL;
|
||||
char *contp;
|
||||
|
|
|
|||
|
|
@ -1439,8 +1439,8 @@ static ParameterError parse_range(struct OperationConfig *config,
|
|||
}
|
||||
if(!curlx_str_number(&nextarg, &value, CURL_OFF_T_MAX) &&
|
||||
curlx_str_single(&nextarg, '-')) {
|
||||
/* Specifying a range WITHOUT A DASH will create an illegal HTTP range
|
||||
(and will not actually be range by definition). The man page previously
|
||||
/* Specifying a range WITHOUT A DASH does create an illegal HTTP range
|
||||
(and does not actually be range by definition). The man page previously
|
||||
claimed that to be a good way, why this code is added to work-around
|
||||
it. */
|
||||
char buffer[32];
|
||||
|
|
@ -1529,7 +1529,7 @@ static ParameterError parse_verbose(bool toggle)
|
|||
if(!global->trace_set && set_trace_config("-all"))
|
||||
return PARAM_NO_MEM;
|
||||
}
|
||||
/* the '%' thing here will cause the trace get sent to stderr */
|
||||
/* the '%' thing here causes the trace get sent to stderr */
|
||||
switch(global->verbosity) {
|
||||
case 0:
|
||||
global->verbosity = 1;
|
||||
|
|
@ -2789,7 +2789,7 @@ static ParameterError opt_string(struct OperationConfig *config,
|
|||
case C_FTP_PORT: /* --ftp-port */
|
||||
/* This makes the FTP sessions use PORT instead of PASV */
|
||||
/* use <eth0> or <192.168.10.10> style addresses. Anything except
|
||||
this will make us try to get the "default" address.
|
||||
this makes us try to get the "default" address.
|
||||
NOTE: this is a changed behavior since the released 4.1!
|
||||
*/
|
||||
err = getstr(&config->ftpport, nextarg, DENY_BLANK);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
also found in one of the standard headers. */
|
||||
|
||||
/*
|
||||
* Returning NULL will abort the continued operation!
|
||||
* Returning NULL aborts the continued operation!
|
||||
*/
|
||||
char *getpass_r(const char *prompt, char *buffer, size_t buflen);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ void tool_version_info(void)
|
|||
/* we have ipfs and ipns support if libcurl has http support */
|
||||
for(builtin = built_in_protos; *builtin; ++builtin) {
|
||||
if(insert) {
|
||||
/* update insertion so ipfs will be printed in alphabetical order */
|
||||
/* update insertion so ipfs is printed in alphabetical order */
|
||||
if(strcmp(*builtin, "ipfs") < 0)
|
||||
insert = *builtin;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url,
|
|||
goto clean;
|
||||
|
||||
/* We might have a --ipfs-gateway argument. Check it first and use it. Error
|
||||
* if we do have something but if it is an invalid url.
|
||||
* if we do have something but if it is an invalid URL.
|
||||
*/
|
||||
if(config->ipfs_gateway) {
|
||||
if(!curl_url_set(gatewayurl, CURLUPART_URL, config->ipfs_gateway,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ int _CRT_glob = 0;
|
|||
* Ensure that file descriptors 0, 1 and 2 (stdin, stdout, stderr) are
|
||||
* open before starting to run. Otherwise, the first three network
|
||||
* sockets opened by curl could be used for input sources, downloaded data
|
||||
* or error logs as they will effectively be stdin, stdout and/or stderr.
|
||||
* or error logs as they are effectively stdin, stdout and/or stderr.
|
||||
*
|
||||
* fcntl's F_GETFD instruction returns -1 if the file descriptor is closed,
|
||||
* otherwise it returns "the file descriptor flags (which typically can only
|
||||
|
|
@ -111,7 +111,7 @@ static void memory_tracking_init(void)
|
|||
curl_free(env);
|
||||
curl_dbg_memdebug(fname);
|
||||
/* this weird stuff here is to make curl_free() get called before
|
||||
curl_dbg_memdebug() as otherwise memory tracking will log a curlx_free()
|
||||
curl_dbg_memdebug() as otherwise memory tracking logs a curlx_free()
|
||||
without an alloc! */
|
||||
}
|
||||
/* if CURL_MEMLIMIT is set, this enables fail-on-alloc-number-N feature */
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ static bool is_pkcs11_uri(const char *string)
|
|||
* For fixed files, find out the size of the EOF block and adjust.
|
||||
*
|
||||
* For all others, have to read the entire file in, discarding the contents.
|
||||
* Most posted text files will be small, and binary files like zlib archives
|
||||
* Most posted text files are small, and binary files like zlib archives
|
||||
* and CD/DVD images should be either a STREAM_LF format or a fixed format.
|
||||
*
|
||||
*/
|
||||
|
|
@ -248,7 +248,7 @@ static CURLcode pre_transfer(struct per_transfer *per)
|
|||
/* VMS Note:
|
||||
*
|
||||
* Reading binary from files can be a problem... Only FIXED, VAR
|
||||
* etc WITHOUT implied CC will work. Others need a \n appended to
|
||||
* etc WITHOUT implied CC do work. Others need a \n appended to
|
||||
* a line
|
||||
*
|
||||
* - Stat gives a size but this is UNRELIABLE in VMS. E.g.
|
||||
|
|
@ -487,7 +487,7 @@ static CURLcode retrycheck(struct OperationConfig *config,
|
|||
if(!sleeptime)
|
||||
sleeptime = per->retry_sleep;
|
||||
warnf("Problem %s. "
|
||||
"Will retry in %ld%s%.*ld second%s. "
|
||||
"Retrying in %ld%s%.*ld second%s. "
|
||||
"%ld retr%s left.",
|
||||
m[retry], sleeptime / 1000L,
|
||||
(sleeptime % 1000L ? "." : ""),
|
||||
|
|
@ -554,7 +554,7 @@ static CURLcode retrycheck(struct OperationConfig *config,
|
|||
/* truncate file at the position where we started appending */
|
||||
#if defined(HAVE_FTRUNCATE) && !defined(__DJGPP__) && !defined(__AMIGA__)
|
||||
if(ftruncate(fileno(outs->stream), outs->init)) {
|
||||
/* when truncate fails, we cannot append as then we will
|
||||
/* when truncate fails, we cannot append as then we
|
||||
create something strange, bail out */
|
||||
errorf("Failed to truncate file");
|
||||
return CURLE_WRITE_ERROR;
|
||||
|
|
@ -1141,7 +1141,7 @@ static void check_stdin_upload(struct OperationConfig *config,
|
|||
if(!strcmp(per->uploadfile, ".")) {
|
||||
#if defined(USE_WINSOCK) && !defined(CURL_WINDOWS_UWP)
|
||||
/* non-blocking stdin behavior on Windows is challenging
|
||||
Spawn a new thread that will read from stdin and write
|
||||
Spawn a new thread that reads from stdin and write
|
||||
out to a socket */
|
||||
curl_socket_t f = win32_stdin_read_thread();
|
||||
|
||||
|
|
@ -1344,7 +1344,7 @@ static CURLcode create_single(struct OperationConfig *config,
|
|||
}
|
||||
|
||||
if(config->resume_from_current)
|
||||
config->resume_from = -1; /* -1 will then force get-it-yourself */
|
||||
config->resume_from = -1; /* -1 then forces get-it-yourself */
|
||||
}
|
||||
|
||||
if(!outs->out_null && output_expected(per->url, per->uploadfile) &&
|
||||
|
|
@ -1489,7 +1489,7 @@ static CURLcode add_parallel_transfers(CURLM *multi, CURLSH *share,
|
|||
return result;
|
||||
|
||||
/* parallel connect means that we do not set PIPEWAIT since pipewait
|
||||
will make libcurl prefer multiplexing */
|
||||
makes libcurl prefer multiplexing */
|
||||
(void)curl_easy_setopt(per->curl, CURLOPT_PIPEWAIT,
|
||||
global->parallel_connect ? 0L : 1L);
|
||||
(void)curl_easy_setopt(per->curl, CURLOPT_PRIVATE, per);
|
||||
|
|
@ -1746,7 +1746,7 @@ static CURLcode parallel_event(struct parastate *s)
|
|||
}
|
||||
|
||||
/* We need to cleanup the multi here, since the uv context lives on the
|
||||
* stack and will be gone. multi_cleanup can trigger events! */
|
||||
* stack and about to be gone. multi_cleanup can trigger events! */
|
||||
curl_multi_cleanup(s->multi);
|
||||
|
||||
#if DEBUG_UV
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ struct per_transfer {
|
|||
BIT(added); /* set TRUE when added to the multi handle */
|
||||
BIT(abort); /* when doing parallel transfers and this is TRUE then a critical
|
||||
error (eg --fail-early) has occurred in another transfer and
|
||||
this transfer will be aborted in the progress callback */
|
||||
this transfer gets aborted in the progress callback */
|
||||
BIT(skip); /* considered already done */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ CURLcode urlerr_cvt(CURLUcode ucode)
|
|||
|
||||
/*
|
||||
* Adds the filename to the URL if it does not already have one.
|
||||
* URL will be freed before return if the returned pointer is different
|
||||
* URL is freed before return if the returned pointer is different
|
||||
*/
|
||||
CURLcode add_file_name_to_url(CURL *curl, char **inurlp, const char *filename)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
* 'regular_file' member is TRUE when output goes to a regular file, this also
|
||||
* implies that output is 'seekable' and 'appendable' and also that member
|
||||
* 'filename' points to filename's string. For any standard stream member
|
||||
* 'regular_file' will be FALSE.
|
||||
* 'regular_file' is FALSE.
|
||||
*
|
||||
* 'fopened' member is TRUE when output goes to a regular file and it
|
||||
* has been fopen'ed, requiring it to be closed later on. In any other
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
* _LARGE_FILES in order to support files larger than 2 GB. On platforms
|
||||
* where this happens it is mandatory that these macros are defined before
|
||||
* any system header file is included, otherwise file handling function
|
||||
* prototypes will be misdeclared and curl tool may not build properly;
|
||||
* prototypes are misdeclared and curl tool may not build properly;
|
||||
* therefore we must include curl_setup.h before curl.h when building curl.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void tool_set_stderr_file(const char *filename)
|
|||
}
|
||||
|
||||
/* precheck that filename is accessible to lessen the chance that the
|
||||
subsequent freopen will fail. */
|
||||
subsequent freopen fails. */
|
||||
fp = curlx_fopen(filename, FOPEN_WRITETEXT);
|
||||
if(!fp) {
|
||||
warnf("Warning: Failed to open %s", filename);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ static CURLcode glob_set(struct URLGlob *glob, const char **patternp,
|
|||
goto error;
|
||||
}
|
||||
|
||||
/* add 1 to size since it will be incremented below */
|
||||
/* add 1 to size since it is to be incremented below */
|
||||
if(multiply(amount, size + 1)) {
|
||||
result = globerror(glob, "range overflow", 0, CURLE_URL_MALFORMAT);
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue