tidy-up: miscellaneous

- fix typos.
- badword: add two new words.
- cpp: drop parentheses from standalone `#if` expressions.
- libssh: vertical-align comment block with others.
- clang-format.

Closes #21880
This commit is contained in:
Viktor Szakats 2026-06-02 00:44:17 +02:00
parent 982e19f231
commit d3e9a815c4
No known key found for this signature in database
31 changed files with 246 additions and 252 deletions

View file

@ -67,11 +67,11 @@ Go: [go-curl](https://github.com/andelf/go-curl) by ShuYu Wang
[Julia](https://github.com/JuliaWeb/LibCURL.jl) Written by Amit Murthy
[Kapito](https://github.com/puzza007/katipo) is an Erlang HTTP library around libcurl.
[Katipo](https://github.com/puzza007/katipo) is an Erlang HTTP library around libcurl.
[Lisp](https://common-lisp.net/project/cl-curl/) Written by Liam Healy
[LibQurl](https://github.com/Qriist/LibQurl) a feature rich AutoHotKey v2 (AHKv2) wrapper around libcurl.
[LibQurl](https://github.com/Qriist/LibQurl) a feature-rich AutoHotKey v2 (AHKv2) wrapper around libcurl.
Lua: [luacurl](https://web.archive.org/web/20201205052437/luacurl.luaforge.net/) by Alexander Marinov, [Lua-curl](https://github.com/Lua-cURL) by Jürgen Hötzel
@ -110,7 +110,7 @@ Bailiff and Bálint Szilakszi,
[R](https://cran.r-project.org/package=curl)
[Rexx](https://rexxcurl.sourceforge.net/) Written Mark Hessling
[Rexx](https://rexxcurl.sourceforge.net/) Written by Mark Hessling
[Ring](https://ring-lang.github.io/doc1.24/libcurl.html) RingLibCurl by Mahmoud Fayed

View file

@ -33,7 +33,7 @@ platforms. The [internals document](https://curl.se/docs/install.html#Ports)
lists more than 110 operating systems and 28 CPU architectures on which curl
has been reported to run.
libcurl is free, thread-safe, IPv6 compatible, feature rich, well supported
libcurl is free, thread-safe, IPv6 compatible, feature-rich, well supported
and fast.
### curl

View file

@ -157,7 +157,7 @@ made public.
# Severity levels
The curl project's security team rates security problems using four severity
levels depending how serious we consider the problem to be. We use **Low**,
levels depending on how serious we consider the problem to be. We use **Low**,
**Medium**, **High** and **Critical**. We refrain from using numerical scoring
of vulnerabilities.
@ -453,7 +453,7 @@ for all internal communication.
Existing vulnerability disclosure process are followed for any embargoes
and fixes.
Where possible, public communication are provided:
Where possible, public communications are provided:
* regular communication from communication lead (for example daily update)
* asynchronous communication from incident lead

View file

@ -40,7 +40,7 @@ specified, the *name* is ignored.
If neither *id* nor *name* are specified, the function fails with
**CURLSSLSET_UNKNOWN_BACKEND** and set the *avail* pointer to the
NULL-terminated list of available backends. The available backends are those
null-terminated list of available backends. The available backends are those
that this particular build of libcurl supports.
Since libcurl 7.60.0, the *avail* pointer is always set to the list of
@ -50,7 +50,7 @@ Upon success, the function returns **CURLSSLSET_OK**.
If the specified SSL backend is not available, the function returns
**CURLSSLSET_UNKNOWN_BACKEND** and sets the *avail* pointer to a
NULL-terminated list of available SSL backends. In this case, you may call the
null-terminated list of available SSL backends. In this case, you may call the
function again to try to select a different backend.
The SSL backend can be set only once. If it has already been set, a subsequent

View file

@ -2812,14 +2812,14 @@ struct curl_slist {
* backend can also be specified via the name parameter (passing -1 as id). If
* both id and name are specified, the name is ignored. If neither id nor
* name are specified, the function fails with CURLSSLSET_UNKNOWN_BACKEND
* and set the "avail" pointer to the NULL-terminated list of available
* and set the "avail" pointer to the null-terminated list of available
* backends.
*
* Upon success, the function returns CURLSSLSET_OK.
*
* If the specified SSL backend is not available, the function returns
* CURLSSLSET_UNKNOWN_BACKEND and sets the "avail" pointer to a
* NULL-terminated list of available SSL backends.
* null-terminated list of available SSL backends.
*
* The SSL backend can be set only once. If it has already been set, a
* subsequent attempt to change it results in a CURLSSLSET_TOO_LATE.

View file

@ -297,7 +297,7 @@
/* ===================================== */
#elif defined(_MSC_VER)
# if (_MSC_VER >= 1800)
# if _MSC_VER >= 1800
# include <inttypes.h>
# define CURL_FORMAT_CURL_OFF_T PRId64
# define CURL_FORMAT_CURL_OFF_TU PRIu64

View file

@ -587,7 +587,7 @@
# endif
#endif
#if (SIZEOF_CURL_OFF_T < 8)
#if SIZEOF_CURL_OFF_T < 8
#error "too small curl_off_t"
#else
/* assume SIZEOF_CURL_OFF_T == 8 */
@ -598,7 +598,7 @@
#define FMT_OFF_T CURL_FORMAT_CURL_OFF_T
#define FMT_OFF_TU CURL_FORMAT_CURL_OFF_TU
#if (SIZEOF_TIME_T == 4)
#if SIZEOF_TIME_T == 4
# ifdef HAVE_TIME_T_UNSIGNED
# define TIME_T_MAX UINT_MAX
# define TIME_T_MIN 0

View file

@ -244,7 +244,7 @@ static int parse_flags(const char **fmtp, unsigned int *flagsp, int use_dollar,
fmt += 2;
}
else {
#if (SIZEOF_CURL_OFF_T > SIZEOF_LONG)
#if SIZEOF_CURL_OFF_T > SIZEOF_LONG
flags |= FLAGS_LONGLONG;
#else
flags |= FLAGS_LONG;
@ -267,14 +267,14 @@ static int parse_flags(const char **fmtp, unsigned int *flagsp, int use_dollar,
case 'z':
/* the code below generates a warning if -Wunreachable-code is
used */
#if (SIZEOF_SIZE_T > SIZEOF_LONG)
#if SIZEOF_SIZE_T > SIZEOF_LONG
flags |= FLAGS_LONGLONG;
#else
flags |= FLAGS_LONG;
#endif
break;
case 'O':
#if (SIZEOF_CURL_OFF_T > SIZEOF_LONG)
#if SIZEOF_CURL_OFF_T > SIZEOF_LONG
flags |= FLAGS_LONGLONG;
#else
flags |= FLAGS_LONG;

View file

@ -105,7 +105,7 @@ static CURLcode capsule_cf_send(struct Curl_cfilter *cf,
ctx->pending_offset += nwritten;
if(ctx->pending_offset < ctx->pending_len)
return CURLE_AGAIN;
/* pending capsule has been fully flusehd */
/* pending capsule has been fully flushed */
*pnwritten = ctx->pending_payload;
curlx_safefree(ctx->pending);
return CURLE_OK;

View file

@ -3161,23 +3161,23 @@ void Curl_ssh_version(char *buffer, size_t buflen)
* SCP.
*/
const struct Curl_protocol Curl_protocol_scp = {
myssh_setup_connection, /* setup_connection */
myssh_do_it, /* do_it */
scp_done, /* done */
ZERO_NULL, /* do_more */
myssh_connect, /* connect_it */
myssh_multi_statemach, /* connecting */
scp_doing, /* doing */
myssh_pollset, /* proto_pollset */
myssh_pollset, /* doing_pollset */
ZERO_NULL, /* domore_pollset */
myssh_pollset, /* perform_pollset */
scp_disconnect, /* disconnect */
ZERO_NULL, /* write_resp */
ZERO_NULL, /* write_resp_hd */
ZERO_NULL, /* connection_is_dead */
ZERO_NULL, /* attach connection */
ZERO_NULL, /* follow */
myssh_setup_connection, /* setup_connection */
myssh_do_it, /* do_it */
scp_done, /* done */
ZERO_NULL, /* do_more */
myssh_connect, /* connect_it */
myssh_multi_statemach, /* connecting */
scp_doing, /* doing */
myssh_pollset, /* proto_pollset */
myssh_pollset, /* doing_pollset */
ZERO_NULL, /* domore_pollset */
myssh_pollset, /* perform_pollset */
scp_disconnect, /* disconnect */
ZERO_NULL, /* write_resp */
ZERO_NULL, /* write_resp_hd */
ZERO_NULL, /* connection_is_dead */
ZERO_NULL, /* attach connection */
ZERO_NULL, /* follow */
};
/*

View file

@ -3586,7 +3586,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
#ifdef CURL_LIBSSH2_DEBUG
libssh2_trace(sshc->ssh_session, ~0);
infof(data, "SSH socket: %d", (int)sock);
#endif /* CURL_LIBSSH2_DEBUG */
#endif
myssh_to(data, sshc, SSH_INIT);

View file

@ -435,17 +435,17 @@ OM_uint32 Curl_gss_display_status_a(OM_uint32 *minor_status,
return rc;
}
OM_uint32
Curl_gss_init_sec_context_a(OM_uint32 *minor_status,
gss_cred_id_t cred_handle,
gss_ctx_id_t *context_handle,
gss_name_t target_name, gss_OID mech_type,
gss_flags_t req_flags, OM_uint32 time_req,
gss_channel_bindings_t input_chan_bindings,
gss_buffer_t input_token,
gss_OID *actual_mech_type,
gss_buffer_t output_token, gss_flags_t *ret_flags,
OM_uint32 *time_rec)
OM_uint32 Curl_gss_init_sec_context_a(
OM_uint32 *minor_status,
gss_cred_id_t cred_handle,
gss_ctx_id_t *context_handle,
gss_name_t target_name, gss_OID mech_type,
gss_flags_t req_flags, OM_uint32 time_req,
gss_channel_bindings_t input_chan_bindings,
gss_buffer_t input_token,
gss_OID *actual_mech_type,
gss_buffer_t output_token, gss_flags_t *ret_flags,
OM_uint32 *time_rec)
{
int rc;
gss_buffer_desc in;

View file

@ -27,6 +27,7 @@ null terminate:null-terminate
zero terminate:null-terminate
nul terminated:null-terminated
null terminated:null-terminated
NULL-terminated=null-terminated
zero terminated:null-terminated
nul terminator:null-terminator
null terminator:null-terminator
@ -104,6 +105,7 @@ will:rewrite to present tense
63 bit:63-bit
64 bit:64-bit
128 bit:128-bit
256 bit:256-bit
8-bits:8 bits
16-bits:16 bits
32-bits:32 bits

View file

@ -195,14 +195,14 @@ static const char *disabled[] = {
#endif
,
"large-time: "
#if (SIZEOF_TIME_T < 5)
#if SIZEOF_TIME_T < 5
"OFF"
#else
"ON"
#endif
,
"large-size: "
#if (SIZEOF_SIZE_T < 5)
#if SIZEOF_SIZE_T < 5
"OFF"
#else
"ON"

View file

@ -197,14 +197,13 @@ static ParameterError extract_param(char *line,
* Updates *configp if a new operation config is allocated.
* Returns PARAM_OK if processing should continue, or an error code.
*/
static ParameterError
process_config_result(ParameterError res,
struct OperationConfig **configp,
const char *param,
bool usedarg,
const char *filename,
int lineno,
const char *option)
static ParameterError process_config_result(ParameterError res,
struct OperationConfig **configp,
const char *param,
bool usedarg,
const char *filename,
int lineno,
const char *option)
{
if(!res && param && *param && !usedarg)
/* we passed in a parameter that was not used! */

View file

@ -45,8 +45,7 @@ static CURLcode test_lib1538(const char *URL)
for(easyret = CURLE_OK; easyret <= CURL_LAST; easyret++) {
curl_mprintf("e%d: %s\n", easyret, curl_easy_strerror(easyret));
}
for(mresult = CURLM_CALL_MULTI_PERFORM; mresult <= CURLM_LAST;
mresult++) {
for(mresult = CURLM_CALL_MULTI_PERFORM; mresult <= CURLM_LAST; mresult++) {
curl_mprintf("m%d: %s\n", mresult, curl_multi_strerror(mresult));
}
for(shareret = CURLSHE_OK; shareret <= CURLSHE_LAST; shareret++) {

View file

@ -1943,8 +1943,7 @@ static int scopeid(void)
curl_free(url);
}
rc = curl_url_set(u, CURLUPART_HOST,
"[fe80::20c:29ff:fe9c:409b%25eth0]", 0);
rc = curl_url_set(u, CURLUPART_HOST, "[fe80::20c:29ff:fe9c:409b%25eth0]", 0);
if(rc != CURLUE_OK) {
curl_mfprintf(stderr,
"%s:%d curl_url_set CURLUPART_HOST returned %d (%s)\n",
@ -2228,8 +2227,7 @@ static int urldup(void)
goto err;
for(i = 0; url[i]; i++) {
CURLUcode rc = curl_url_set(h, CURLUPART_URL, url[i],
CURLU_GUESS_SCHEME);
CURLUcode rc = curl_url_set(h, CURLUPART_URL, url[i], CURLU_GUESS_SCHEME);
if(rc)
goto err;
copy = curl_url_dup(h);

View file

@ -25,13 +25,7 @@
static size_t t1901_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
{
static const char *chunks[] = {
"one",
"two",
"three",
"four",
NULL
};
static const char *chunks[] = { "one", "two", "three", "four", NULL };
static int ix = 0;
(void)stream;
if(chunks[ix]) {

View file

@ -33,7 +33,7 @@ static CURLcode test_lib1902(const char *URL)
curl = curl_easy_init();
if(curl) {
easy_setopt(curl, CURLOPT_COOKIEFILE, URL);
easy_setopt(curl, CURLOPT_COOKIEJAR, URL);
easy_setopt(curl, CURLOPT_COOKIEJAR, URL);
/* Do not perform any actual network operation,
the issue occur when not calling curl.*perform */

View file

@ -38,7 +38,7 @@ static CURLSTScode hstsread(CURL *curl, struct curl_hstsentry *e, void *userp)
};
static const struct entry preload_hosts[] = {
#if (SIZEOF_TIME_T < 5)
#if SIZEOF_TIME_T < 5
{ "1.example.com", "20370320 01:02:03" },
{ "2.example.com.", "20370320 03:02:01" },
{ "3.example.com", "20370319 01:02:03" },

View file

@ -33,9 +33,9 @@ static CURLcode test_lib1920(const char *URL)
curl = curl_easy_init();
if(curl) {
easy_setopt(curl, CURLOPT_COOKIEFILE, libtest_arg2);
easy_setopt(curl, CURLOPT_COOKIEJAR, libtest_arg2);
easy_setopt(curl, CURLOPT_URL, URL);
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
easy_setopt(curl, CURLOPT_COOKIEJAR, libtest_arg2);
easy_setopt(curl, CURLOPT_URL, URL);
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
result = curl_easy_perform(curl);
@ -44,7 +44,7 @@ static CURLcode test_lib1920(const char *URL)
curl_easy_reset(curl);
/* set the cookie jar name so that curl knows where to store the
cookies after reset */
easy_setopt(curl, CURLOPT_COOKIEJAR, libtest_arg2);
easy_setopt(curl, CURLOPT_COOKIEJAR, libtest_arg2);
}
}

View file

@ -53,10 +53,10 @@
goto test_cleanup; \
}
#define test_run_check(option, expected_fds) \
do { \
result = test_run(URL, option, &fd_count); \
test_check(expected_fds); \
#define test_run_check(option, expected_fds) \
do { \
result = test_run(URL, option, &fd_count); \
test_check(expected_fds); \
} while(0)
/* ---------------------------------------------------------------- */

View file

@ -50,7 +50,7 @@ static CURLcode send_header(CURL *curl, int flags, size_t size)
retry:
result = curl_ws_send(curl, NULL, 0, &nsent, (curl_off_t)size,
flags | CURLWS_OFFSET);
flags | CURLWS_OFFSET);
if(result == CURLE_AGAIN) {
assert(nsent == 0);
goto retry;

View file

@ -415,7 +415,7 @@ static int test_unsigned_long_formatting(void)
int num_ulong_tests = 0;
int failed = 0;
#if (SIZEOF_LONG == 4)
#if SIZEOF_LONG == 4
i = 1; ul_test[i].num = 0xFFFFFFFFUL; ul_test[i].expected = "4294967295";
i++; ul_test[i].num = 0xFFFF0000UL; ul_test[i].expected = "4294901760";
@ -449,7 +449,7 @@ static int test_unsigned_long_formatting(void)
num_ulong_tests = i;
#elif (SIZEOF_LONG == 8)
#elif SIZEOF_LONG == 8
/* !checksrc! disable LONGLINE all */
i = 1; ul_test[i].num = 0xFFFFFFFFFFFFFFFFUL; ul_test[i].expected = "18446744073709551615";
i++; ul_test[i].num = 0xFFFFFFFF00000000UL; ul_test[i].expected = "18446744069414584320";
@ -541,7 +541,7 @@ static int test_signed_long_formatting(void)
int num_slong_tests = 0;
int failed = 0;
#if (SIZEOF_LONG == 4)
#if SIZEOF_LONG == 4
i = 1; sl_test[i].num = 0x7FFFFFFFL; sl_test[i].expected = "2147483647";
i++; sl_test[i].num = 0x7FFFFFFEL; sl_test[i].expected = "2147483646";
@ -608,7 +608,7 @@ static int test_signed_long_formatting(void)
num_slong_tests = i;
#elif (SIZEOF_LONG == 8)
#elif SIZEOF_LONG == 8
i = 1; sl_test[i].num = 0x7FFFFFFFFFFFFFFFL; sl_test[i].expected = "9223372036854775807";
i++; sl_test[i].num = 0x7FFFFFFFFFFFFFFEL; sl_test[i].expected = "9223372036854775806";
@ -1186,11 +1186,11 @@ static int test_oct_hex_formatting(void)
0xFABC1230U, 0xFABC1230U, 0xFABC1230U, 1234U);
errors += string_check(buf, "37257011060 fabc1230 FABC1230 +2322");
#if (SIZEOF_LONG == 4)
#if SIZEOF_LONG == 4
curl_msnprintf(buf, sizeof(buf), "%lo %lx %lX %+lo",
0xFABC1230UL, 0xFABC1230UL, 0xFABC1230UL, 1234UL);
errors += string_check(buf, "37257011060 fabc1230 FABC1230 +2322");
#elif (SIZEOF_LONG == 8)
#elif SIZEOF_LONG == 8
curl_msnprintf(buf, sizeof(buf), "%lo %lx %lX %+lo",
0xFABCDEF123456780UL, 0xFABCDEF123456780UL,
0xFABCDEF123456780UL, 1234UL);

View file

@ -45,7 +45,7 @@ static CURLcode test_lib583(const char *URL)
easy_init(curl);
easy_setopt(curl, CURLOPT_USERPWD, libtest_arg2);
easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, test_argv[3]);
easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE, test_argv[3]);
easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE, test_argv[4]);
easy_setopt(curl, CURLOPT_UPLOAD, 1L);

View file

@ -79,7 +79,7 @@ static CURLcode test_lib599(const char *URL)
if(!result) {
FILE *moo;
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
&content_length);
&content_length);
moo = curlx_fopen(libtest_arg2, "wb");
if(moo) {
curl_mfprintf(moo, "CL %.0f\n", content_length);

View file

@ -140,7 +140,7 @@ static CURLcode test_lib670(const char *URL)
formrc = curl_formadd(&formpost, &lastptr,
CURLFORM_COPYNAME, testname,
CURLFORM_STREAM, &pooh,
CURLFORM_CONTENTLEN, (curl_off_t) 2,
CURLFORM_CONTENTLEN, (curl_off_t)2,
CURLFORM_END);
if(formrc) {
curl_mfprintf(stderr, "curl_formadd() = %d\n", formrc);

View file

@ -49,10 +49,13 @@ static void t1303_stop(struct Curl_easy *easy)
#define BASE 1000000
/* macro to set the pretended current time */
#define NOW(x, y) now.tv_sec = x; now.tv_usec = y
#define NOW(x, y) \
now.tv_sec = x; \
now.tv_usec = y
/* macro to set the millisecond based timeouts to use */
#define TIMEOUTS(x, y) easy->set.timeout = x; \
easy->set.connecttimeout = y
#define TIMEOUTS(x, y) \
easy->set.timeout = x; \
easy->set.connecttimeout = y
/*
* To test:
@ -83,57 +86,56 @@ static CURLcode test_unit1303(const char *arg)
};
const struct timetest run[] = {
/* both timeouts set, not connecting */
{BASE + 4, 0, 10000, 8000, FALSE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 10000, 8000, FALSE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 10000, 8000, FALSE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 10000, 8000, FALSE, -2000, "-2000, overdue 2 seconds"},
/* both timeouts set, not connecting */
{BASE + 4, 0, 10000, 8000, FALSE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 10000, 8000, FALSE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 10000, 8000, FALSE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 10000, 8000, FALSE, -2000, "-2000, overdue 2 seconds"},
/* both timeouts set, connecting */
{BASE + 4, 0, 10000, 8000, TRUE, 4000, "4 seconds should be left"},
{BASE + 4, 990000, 10000, 8000, TRUE, 3010, "3010 ms should be left"},
{BASE + 8, 0, 10000, 8000, TRUE, -1, "timeout is -1, expired"},
{BASE + 10, 0, 10000, 8000, TRUE, -2000, "-2000, overdue 2 seconds"},
/* both timeouts set, connecting */
{BASE + 4, 0, 10000, 8000, TRUE, 4000, "4 seconds should be left"},
{BASE + 4, 990000, 10000, 8000, TRUE, 3010, "3010 ms should be left"},
{BASE + 8, 0, 10000, 8000, TRUE, -1, "timeout is -1, expired"},
{BASE + 10, 0, 10000, 8000, TRUE, -2000, "-2000, overdue 2 seconds"},
/* no connect timeout set, not connecting */
{BASE + 4, 0, 10000, 0, FALSE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 10000, 0, FALSE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 10000, 0, FALSE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 10000, 0, FALSE, -2000, "-2000, overdue 2 seconds"},
/* no connect timeout set, not connecting */
{BASE + 4, 0, 10000, 0, FALSE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 10000, 0, FALSE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 10000, 0, FALSE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 10000, 0, FALSE, -2000, "-2000, overdue 2 seconds"},
/* no connect timeout set, connecting */
{BASE + 4, 0, 10000, 0, TRUE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 10000, 0, TRUE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 10000, 0, TRUE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 10000, 0, TRUE, -2000, "-2000, overdue 2 seconds"},
/* no connect timeout set, connecting */
{BASE + 4, 0, 10000, 0, TRUE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 10000, 0, TRUE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 10000, 0, TRUE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 10000, 0, TRUE, -2000, "-2000, overdue 2 seconds"},
/* only connect timeout set, not connecting */
{BASE + 4, 0, 0, 10000, FALSE, 0, "no timeout active"},
{BASE + 4, 990000, 0, 10000, FALSE, 0, "no timeout active"},
{BASE + 10, 0, 0, 10000, FALSE, 0, "no timeout active"},
{BASE + 12, 0, 0, 10000, FALSE, 0, "no timeout active"},
/* only connect timeout set, not connecting */
{BASE + 4, 0, 0, 10000, FALSE, 0, "no timeout active"},
{BASE + 4, 990000, 0, 10000, FALSE, 0, "no timeout active"},
{BASE + 10, 0, 0, 10000, FALSE, 0, "no timeout active"},
{BASE + 12, 0, 0, 10000, FALSE, 0, "no timeout active"},
/* only connect timeout set, connecting */
{BASE + 4, 0, 0, 10000, TRUE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 0, 10000, TRUE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 0, 10000, TRUE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 0, 10000, TRUE, -2000, "-2000, overdue 2 seconds"},
/* only connect timeout set, connecting */
{BASE + 4, 0, 0, 10000, TRUE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 0, 10000, TRUE, 5010, "5010 ms should be left"},
{BASE + 10, 0, 0, 10000, TRUE, -1, "timeout is -1, expired"},
{BASE + 12, 0, 0, 10000, TRUE, -2000, "-2000, overdue 2 seconds"},
/* no timeout set, not connecting */
{BASE + 4, 0, 0, 0, FALSE, 0, "no timeout active"},
{BASE + 4, 990000, 0, 0, FALSE, 0, "no timeout active"},
{BASE + 10, 0, 0, 0, FALSE, 0, "no timeout active"},
{BASE + 12, 0, 0, 0, FALSE, 0, "no timeout active"},
/* no timeout set, not connecting */
{BASE + 4, 0, 0, 0, FALSE, 0, "no timeout active"},
{BASE + 4, 990000, 0, 0, FALSE, 0, "no timeout active"},
{BASE + 10, 0, 0, 0, FALSE, 0, "no timeout active"},
{BASE + 12, 0, 0, 0, FALSE, 0, "no timeout active"},
/* no timeout set, connecting */
{BASE + 4, 0, 0, 0, TRUE, 296000, "no timeout active"},
{BASE + 4, 990000, 0, 0, TRUE, 295010, "no timeout active"},
{BASE + 10, 0, 0, 0, TRUE, 290000, "no timeout active"},
{BASE + 12, 0, 0, 0, TRUE, 288000, "no timeout active"},
/* both timeouts set, connecting, connect timeout the longer one */
{BASE + 4, 0, 10000, 12000, TRUE, 6000, "6 seconds should be left"},
/* no timeout set, connecting */
{BASE + 4, 0, 0, 0, TRUE, 296000, "no timeout active"},
{BASE + 4, 990000, 0, 0, TRUE, 295010, "no timeout active"},
{BASE + 10, 0, 0, 0, TRUE, 290000, "no timeout active"},
{BASE + 12, 0, 0, 0, TRUE, 288000, "no timeout active"},
/* both timeouts set, connecting, connect timeout the longer one */
{BASE + 4, 0, 10000, 12000, TRUE, 6000, "6 seconds should be left"},
};
/* this is the pretended start time of the transfer */

View file

@ -80,7 +80,7 @@ static CURLcode test_unit1627(const char *arg)
break;
}
Curl_strntolower(buffer, okay[i], strlen(okay[i]));
buffer[ strlen(okay[i]) ] = 0;
buffer[strlen(okay[i])] = 0;
if(strcmp(buffer, get->name)) {
curl_mprintf("Input: %s is not lowercase: %s\n", buffer, get->name);
break;

View file

@ -39,71 +39,71 @@ static CURLcode test_unit1675(const char *arg)
const char *out;
};
const struct ipv4_test tests[] = {
{"0x.0x.0x.0x", NULL}, /* invalid hex */
{"0x.0x.0x", NULL}, /* invalid hex */
{"0x.0x", NULL}, /* invalid hex */
{"0x", NULL}, /* invalid hex */
{"0", "0.0.0.0"},
{"00", "0.0.0.0"},
{"00000000000", "0.0.0.0"},
{"127.0.0.1", "127.0.0.1"},
{"0177.0.0.1", "127.0.0.1"},
{"00177.0.0.1", "127.0.0.1"},
{"0x7f.0.0.1", "127.0.0.1"},
{"0x07f.0.0.1", "127.0.0.1"},
{"1", "0.0.0.1"},
{"010", "0.0.0.8"},
{"001", "0.0.0.1"},
{"127", "0.0.0.127"},
{"127.1", "127.0.0.1"},
{"127.0.1", "127.0.0.1"},
{"1.16777215", "1.255.255.255"},
{"1.16777216", NULL}, /* overflow */
{"1.1.65535", "1.1.255.255"},
{"1.1.65536", NULL}, /* overflow */
{"0x7f000001", "127.0.0.1"},
{"0x7F000001", "127.0.0.1"},
{"0x7g000001", NULL}, /* bad hex */
{"2130706433", "127.0.0.1"},
{"017700000001", "127.0.0.1"},
{"000000000017700000001", "127.0.0.1"},
{"192.168.0.1", "192.168.0.1"},
{"0300.0250.0000.0001", "192.168.0.1"},
{"0xc0.0xa8.0.1", "192.168.0.1"},
{"0xc0a80001", "192.168.0.1"},
{"3232235521", "192.168.0.1"},
{"4294967294", "255.255.255.254"},
{"4294967295", "255.255.255.255"},
{"037777777777", "255.255.255.255"},
{"0xFFFFFFFF", "255.255.255.255"},
{"0xFFFFFfff", "255.255.255.255"},
{"1.2.3.4.5", NULL}, /* too many parts */
{"256.0.0.1", NULL}, /* overflow */
{"1.256.0.1", NULL}, /* overflow */
{"1.1.256.1", NULL}, /* overflow */
{"1.0.0.256", NULL}, /* overflow */
{"0x100.0.0.1", NULL}, /* overflow */
{"1.0x100.0.1", NULL}, /* overflow */
{"1.1.0x100.1", NULL}, /* overflow */
{"1.1.1.0x100", NULL}, /* overflow */
{"0400.0.0.1", NULL}, /* overflow */
{"4.0400.0.1", NULL}, /* overflow */
{"4.4.0400.1", NULL}, /* overflow */
{"4.4.4.0400", NULL}, /* overflow */
{"4294967296", NULL}, /* overflow */
{"040000000000", NULL}, /* overflow */
{"0x100000000", NULL}, /* overflow */
{"1.2.3.-4", NULL}, /* negative */
{"1.2.-3.4", NULL}, /* negative */
{"1.-2.3.4", NULL}, /* negative */
{"-1.2.3.4", NULL}, /* negative */
{"-12", NULL}, /* negative */
{"-12.1", NULL}, /* negative */
{"-12.2.3", NULL}, /* negative */
{" 1.2.3.4", NULL}, /* space */
{"1. 2.3.4", NULL}, /* space */
{"1.2. 3.4", NULL}, /* space */
{"1.2.3. 4", NULL}, /* space */
{ "0x.0x.0x.0x", NULL }, /* invalid hex */
{ "0x.0x.0x", NULL }, /* invalid hex */
{ "0x.0x", NULL }, /* invalid hex */
{ "0x", NULL }, /* invalid hex */
{ "0", "0.0.0.0" },
{ "00", "0.0.0.0" },
{ "00000000000", "0.0.0.0" },
{ "127.0.0.1", "127.0.0.1" },
{ "0177.0.0.1", "127.0.0.1" },
{ "00177.0.0.1", "127.0.0.1" },
{ "0x7f.0.0.1", "127.0.0.1" },
{ "0x07f.0.0.1", "127.0.0.1" },
{ "1", "0.0.0.1" },
{ "010", "0.0.0.8" },
{ "001", "0.0.0.1" },
{ "127", "0.0.0.127" },
{ "127.1", "127.0.0.1" },
{ "127.0.1", "127.0.0.1" },
{ "1.16777215", "1.255.255.255" },
{ "1.16777216", NULL }, /* overflow */
{ "1.1.65535", "1.1.255.255" },
{ "1.1.65536", NULL }, /* overflow */
{ "0x7f000001", "127.0.0.1" },
{ "0x7F000001", "127.0.0.1" },
{ "0x7g000001", NULL }, /* bad hex */
{ "2130706433", "127.0.0.1" },
{ "017700000001", "127.0.0.1" },
{ "000000000017700000001", "127.0.0.1" },
{ "192.168.0.1", "192.168.0.1" },
{ "0300.0250.0000.0001", "192.168.0.1" },
{ "0xc0.0xa8.0.1", "192.168.0.1" },
{ "0xc0a80001", "192.168.0.1" },
{ "3232235521", "192.168.0.1" },
{ "4294967294", "255.255.255.254" },
{ "4294967295", "255.255.255.255" },
{ "037777777777", "255.255.255.255" },
{ "0xFFFFFFFF", "255.255.255.255" },
{ "0xFFFFFfff", "255.255.255.255" },
{ "1.2.3.4.5", NULL }, /* too many parts */
{ "256.0.0.1", NULL }, /* overflow */
{ "1.256.0.1", NULL }, /* overflow */
{ "1.1.256.1", NULL }, /* overflow */
{ "1.0.0.256", NULL }, /* overflow */
{ "0x100.0.0.1", NULL }, /* overflow */
{ "1.0x100.0.1", NULL }, /* overflow */
{ "1.1.0x100.1", NULL }, /* overflow */
{ "1.1.1.0x100", NULL }, /* overflow */
{ "0400.0.0.1", NULL }, /* overflow */
{ "4.0400.0.1", NULL }, /* overflow */
{ "4.4.0400.1", NULL }, /* overflow */
{ "4.4.4.0400", NULL }, /* overflow */
{ "4294967296", NULL }, /* overflow */
{ "040000000000", NULL }, /* overflow */
{ "0x100000000", NULL }, /* overflow */
{ "1.2.3.-4", NULL }, /* negative */
{ "1.2.-3.4", NULL }, /* negative */
{ "1.-2.3.4", NULL }, /* negative */
{ "-1.2.3.4", NULL }, /* negative */
{ "-12", NULL }, /* negative */
{ "-12.1", NULL }, /* negative */
{ "-12.2.3", NULL }, /* negative */
{ " 1.2.3.4", NULL }, /* space */
{ "1. 2.3.4", NULL }, /* space */
{ "1.2. 3.4", NULL }, /* space */
{ "1.2.3. 4", NULL }, /* space */
};
curlx_dyn_init(&host, 256);
@ -148,33 +148,33 @@ static CURLcode test_unit1675(const char *arg)
const char *out;
};
const struct urlencode_test tests[] = {
{"http://leave\x01/hello\x01world", FALSE, QUERY_NO,
"http://leave\x01/hello%01world"},
{"http://leave/hello\x01world", FALSE, QUERY_NO,
"http://leave/hello%01world"},
{"http://le ave/hello\x01world", FALSE, QUERY_NO,
"http://le ave/hello%01world"},
{"hello\x01world", TRUE, QUERY_NO, "hello%01world"},
{"hello\xf0world", TRUE, QUERY_NO, "hello%F0world"},
{"hello world", TRUE, QUERY_NO, "hello%20world"},
{"hello%20world", TRUE, QUERY_NO, "hello%20world"},
{"hello world", TRUE, QUERY_YES, "hello+world"},
{"a+b c", TRUE, QUERY_NO, "a+b%20c"},
{"a%20b%20c", TRUE, QUERY_NO, "a%20b%20c"},
{"a%aab%aac", TRUE, QUERY_NO, "a%AAb%AAc"},
{"a%aab%AAc", TRUE, QUERY_NO, "a%AAb%AAc"},
{"w%w%x", TRUE, QUERY_NO, "w%w%x"},
{"w%wf%xf", TRUE, QUERY_NO, "w%wf%xf"},
{"w%fw%fw", TRUE, QUERY_NO, "w%fw%fw"},
{"a+b c", TRUE, QUERY_YES, "a+b+c"},
{"/foo/bar", TRUE, QUERY_NO, "/foo/bar"},
{"/foo/bar", TRUE, QUERY_YES, "/foo/bar"},
{"/foo/ bar", TRUE, QUERY_NO, "/foo/%20bar"},
{"/foo/ bar", TRUE, QUERY_YES, "/foo/+bar"},
{"~-._", TRUE, QUERY_NO, "~-._"},
{"~-._", TRUE, QUERY_YES, "~-._"},
{"foo bar?foo bar", TRUE, QUERY_NO, "foo%20bar?foo%20bar"},
{"foo bar?foo bar", TRUE, QUERY_NOT_YET, "foo%20bar?foo+bar"},
{ "http://leave\x01/hello\x01world", FALSE, QUERY_NO,
"http://leave\x01/hello%01world" },
{ "http://leave/hello\x01world", FALSE, QUERY_NO,
"http://leave/hello%01world" },
{ "http://le ave/hello\x01world", FALSE, QUERY_NO,
"http://le ave/hello%01world" },
{ "hello\x01world", TRUE, QUERY_NO, "hello%01world" },
{ "hello\xf0world", TRUE, QUERY_NO, "hello%F0world" },
{ "hello world", TRUE, QUERY_NO, "hello%20world" },
{ "hello%20world", TRUE, QUERY_NO, "hello%20world" },
{ "hello world", TRUE, QUERY_YES, "hello+world" },
{ "a+b c", TRUE, QUERY_NO, "a+b%20c" },
{ "a%20b%20c", TRUE, QUERY_NO, "a%20b%20c" },
{ "a%aab%aac", TRUE, QUERY_NO, "a%AAb%AAc" },
{ "a%aab%AAc", TRUE, QUERY_NO, "a%AAb%AAc" },
{ "w%w%x", TRUE, QUERY_NO, "w%w%x" },
{ "w%wf%xf", TRUE, QUERY_NO, "w%wf%xf" },
{ "w%fw%fw", TRUE, QUERY_NO, "w%fw%fw" },
{ "a+b c", TRUE, QUERY_YES, "a+b+c" },
{ "/foo/bar", TRUE, QUERY_NO, "/foo/bar" },
{ "/foo/bar", TRUE, QUERY_YES, "/foo/bar" },
{ "/foo/ bar", TRUE, QUERY_NO, "/foo/%20bar" },
{ "/foo/ bar", TRUE, QUERY_YES, "/foo/+bar" },
{ "~-._", TRUE, QUERY_NO, "~-._" },
{ "~-._", TRUE, QUERY_YES, "~-._" },
{ "foo bar?foo bar", TRUE, QUERY_NO, "foo%20bar?foo%20bar" },
{ "foo bar?foo bar", TRUE, QUERY_NOT_YET, "foo%20bar?foo+bar" },
};
curlx_dyn_init(&out, 256);
@ -206,11 +206,11 @@ static CURLcode test_unit1675(const char *arg)
const char *out_zone;
};
const struct ipv6_test tests[] = {
{"[::1]", "[::1]", NULL},
{"[fe80::1%eth0]", "[fe80::1]", "eth0"},
{"[fe80::1%25eth0]", "[fe80::1]", "eth0"},
{"[::1", NULL, NULL}, /* missing bracket */
{"[]", NULL, NULL}, /* empty */
{ "[::1]", "[::1]", NULL },
{ "[fe80::1%eth0]", "[fe80::1]", "eth0" },
{ "[fe80::1%25eth0]", "[fe80::1]", "eth0" },
{ "[::1", NULL, NULL }, /* missing bracket */
{ "[]", NULL, NULL }, /* empty */
};
for(i = 0; i < CURL_ARRAYSIZE(tests); i++) {
@ -264,16 +264,16 @@ static CURLcode test_unit1675(const char *arg)
bool fine;
};
const struct file_test tests[] = {
{"file:///etc/hosts", "/etc/hosts", TRUE},
{"file://localhost/etc/hosts", "/etc/hosts", TRUE},
{"file://apple/etc/hosts", "/etc/hosts", FALSE},
{"file:foo", NULL, FALSE},
{"file:./", NULL, FALSE},
{"file:?q", NULL, FALSE},
{"file:#f", NULL, FALSE},
{ "file:///etc/hosts", "/etc/hosts", TRUE },
{ "file://localhost/etc/hosts", "/etc/hosts", TRUE },
{ "file://apple/etc/hosts", "/etc/hosts", FALSE },
{ "file:foo", NULL, FALSE },
{ "file:./", NULL, FALSE },
{ "file:?q", NULL, FALSE },
{ "file:#f", NULL, FALSE },
#ifdef _WIN32
{"file:///c:/windows/system32", "c:/windows/system32", TRUE},
{"file://localhost/c:/windows/system32", "c:/windows/system32", TRUE},
{ "file:///c:/windows/system32", "c:/windows/system32", TRUE },
{ "file://localhost/c:/windows/system32", "c:/windows/system32", TRUE },
#endif
};
@ -321,16 +321,16 @@ static CURLcode test_unit1675(const char *arg)
bool expect_match;
};
const struct origin_test tests[] = {
{"http://host:123/x", "http", "host", "123", "/y", TRUE},
{"http://host:123/x", NULL, "host", "123", "/y", TRUE},
{"http://host:123/x", NULL, NULL, NULL, "/y", TRUE},
{"http://host:80/x", "http", "host", "123", "/y", FALSE},
{"http://host:80/x", "http", "host", NULL, "/y", TRUE},
{"http://host/x", "http", "host", "80", "/y", TRUE},
{ "http://host:123/x", "http", "host", "123", "/y", TRUE },
{ "http://host:123/x", NULL, "host", "123", "/y", TRUE },
{ "http://host:123/x", NULL, NULL, NULL, "/y", TRUE },
{ "http://host:80/x", "http", "host", "123", "/y", FALSE },
{ "http://host:80/x", "http", "host", NULL, "/y", TRUE },
{ "http://host/x", "http", "host", "80", "/y", TRUE },
#ifdef USE_SSL
{"http://host:123/x", "https", "host", "123", "/y", FALSE},
{"https://host/x", "http", "host", "443", "/y", FALSE},
{"https://host/x", "https", "host", "443", "/y", TRUE},
{ "http://host:123/x", "https", "host", "123", "/y", FALSE },
{ "https://host/x", "http", "host", "443", "/y", FALSE },
{ "https://host/x", "https", "host", "443", "/y", TRUE },
#endif
};

View file

@ -284,7 +284,7 @@ static void check_result(const struct test_case *tc, struct test_result *tr)
fail(msg);
}
if(tr->cf6.creations && tr->cf4.creations && tc->pref_family) {
/* did ipv4 and ipv6 both, expect the preferred family to start right arway
/* did ipv4 and ipv6 both, expect the preferred family to start right away
* with the other being delayed by the happy_eyeball_timeout */
struct ai_family_stats *stats1 = !strcmp(tc->pref_family, "v6") ?
&tr->cf6 : &tr->cf4;