tidy-up: miscellaneous

- examples: sync debug output printf masks.
- INSTALL-CMAKE.md: tidy up section for some options.
- curl_sha512_256: delete comment suggesting an optimization.
- vtls/keylog: scope a variable.
- vtls/openssl: make a source code URL a permalink.
- vtls/schannel: drop redundant parentheses.
- test1119.pl: robustify `$1` -> `$s`.
- sync arg names in comments to match the code.
- tidy up and minor fixes to comments.
- fix formatting/indenting/comment/newline/include nits.
- move `UNITTEST` protos next to definitions, sync their argument names.
- make variables static.
- add parentheses to Perl `open()` calls.
- drop unnecessary double quotes in Perl.
- clang-format.

Closes #21000
This commit is contained in:
Viktor Szakats 2026-03-09 12:27:12 +01:00
parent 3512b673dd
commit e0dd6eb4a4
No known key found for this signature in database
148 changed files with 612 additions and 684 deletions

View file

@ -8,7 +8,7 @@
Checks: Checks:
- clang-analyzer-* - clang-analyzer-*
- -clang-analyzer-optin.performance.Padding - -clang-analyzer-optin.performance.Padding
- -clang-analyzer-security.ArrayBound # due to false positives with clang-tidy v21.1.0 - -clang-analyzer-security.ArrayBound # due to false positives with clang-tidy v21.1.0+
- -clang-analyzer-security.insecureAPI.bzero # for FD_ZERO() (seen on macOS) - -clang-analyzer-security.insecureAPI.bzero # for FD_ZERO() (seen on macOS)
- -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling - -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
- -clang-diagnostic-nullability-extension - -clang-diagnostic-nullability-extension

View file

@ -427,7 +427,8 @@ jobs:
- name: 'openssl4' - name: 'openssl4'
install_steps: skipall install_steps: skipall
LDFLAGS: -Wl,-rpath,/home/runner/openssl4/build/lib LDFLAGS: -Wl,-rpath,/home/runner/openssl4/build/lib
PKG_CONFIG_PATH: "/home/runner/openssl4/build/lib/pkgconfig:\ PKG_CONFIG_PATH: "\
/home/runner/openssl4/build/lib/pkgconfig:\
/home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\
/home/runner/nghttp2-openssl4/build/lib/pkgconfig" /home/runner/nghttp2-openssl4/build/lib/pkgconfig"
configure: >- configure: >-
@ -435,7 +436,8 @@ jobs:
- name: 'openssl4' - name: 'openssl4'
tflags: '--min=1640' tflags: '--min=1640'
PKG_CONFIG_PATH: "/home/runner/openssl4/build/lib/pkgconfig:\ PKG_CONFIG_PATH: "\
/home/runner/openssl4/build/lib/pkgconfig:\
/home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\
/home/runner/ngtcp2-openssl4/build/lib/pkgconfig:\ /home/runner/ngtcp2-openssl4/build/lib/pkgconfig:\
/home/runner/nghttp2/build/lib/pkgconfig" /home/runner/nghttp2/build/lib/pkgconfig"
@ -483,7 +485,8 @@ jobs:
- name: 'boringssl' - name: 'boringssl'
tflags: '--min=1790' tflags: '--min=1790'
PKG_CONFIG_PATH: "/home/runner/boringssl/build/lib/pkgconfig:\ PKG_CONFIG_PATH: "\
/home/runner/boringssl/build/lib/pkgconfig:\
/home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\
/home/runner/ngtcp2-boringssl/build/lib/pkgconfig:\ /home/runner/ngtcp2-boringssl/build/lib/pkgconfig:\
/home/runner/nghttp2/build/lib/pkgconfig" /home/runner/nghttp2/build/lib/pkgconfig"
@ -503,7 +506,8 @@ jobs:
install_packages: libp11-kit-dev libssh-dev install_packages: libp11-kit-dev libssh-dev
tflags: '--min=1840' tflags: '--min=1840'
LDFLAGS: -Wl,-rpath,/home/runner/gnutls/build/lib LDFLAGS: -Wl,-rpath,/home/runner/gnutls/build/lib
PKG_CONFIG_PATH: "/home/runner/nettle/build/lib64/pkgconfig:\ PKG_CONFIG_PATH: "\
/home/runner/nettle/build/lib64/pkgconfig:\
/home/runner/gnutls/build/lib/pkgconfig:\ /home/runner/gnutls/build/lib/pkgconfig:\
/home/runner/nghttp3/build/lib/pkgconfig:\ /home/runner/nghttp3/build/lib/pkgconfig:\
/home/runner/ngtcp2/build/lib/pkgconfig:\ /home/runner/ngtcp2/build/lib/pkgconfig:\

View file

@ -309,7 +309,8 @@ jobs:
-Wl,-rpath,/home/runner/rustls/lib -Wl,-rpath,/home/runner/rustls/lib
-Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/gsasl/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/gsasl/lib
PKG_CONFIG_PATH: "/home/runner/wolfssl-opensslextra/lib/pkgconfig:\ PKG_CONFIG_PATH: "\
/home/runner/wolfssl-opensslextra/lib/pkgconfig:\
/home/runner/mbedtls/lib/pkgconfig:\ /home/runner/mbedtls/lib/pkgconfig:\
/home/runner/rustls/lib/pkgconfig:\ /home/runner/rustls/lib/pkgconfig:\
/home/linuxbrew/.linuxbrew/opt/gsasl/lib/pkgconfig" /home/linuxbrew/.linuxbrew/opt/gsasl/lib/pkgconfig"
@ -330,7 +331,8 @@ jobs:
-Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libnghttp3/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libnghttp3/lib
-Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/c-ares/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/c-ares/lib
PKG_CONFIG_PATH: "/home/linuxbrew/.linuxbrew/opt/libngtcp2/lib/pkgconfig:\ PKG_CONFIG_PATH: "\
/home/linuxbrew/.linuxbrew/opt/libngtcp2/lib/pkgconfig:\
/home/linuxbrew/.linuxbrew/opt/libnghttp3/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/libnghttp3/lib/pkgconfig:\
/home/linuxbrew/.linuxbrew/opt/c-ares/lib/pkgconfig" /home/linuxbrew/.linuxbrew/opt/c-ares/lib/pkgconfig"
generate: >- generate: >-
@ -354,7 +356,8 @@ jobs:
CC: clang-20 CC: clang-20
CFLAGS: -fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g CFLAGS: -fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g
LDFLAGS: -fsanitize=address,undefined -fno-sanitize-recover=undefined,integer -ldl -lubsan -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/c-ares/lib LDFLAGS: -fsanitize=address,undefined -fno-sanitize-recover=undefined,integer -ldl -lubsan -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/c-ares/lib
PKG_CONFIG_PATH: "/home/linuxbrew/.linuxbrew/opt/libssh2/lib/pkgconfig:\ PKG_CONFIG_PATH: "\
/home/linuxbrew/.linuxbrew/opt/libssh2/lib/pkgconfig:\
/home/linuxbrew/.linuxbrew/opt/libngtcp2/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/libngtcp2/lib/pkgconfig:\
/home/linuxbrew/.linuxbrew/opt/libnghttp3/lib/pkgconfig:\ /home/linuxbrew/.linuxbrew/opt/libnghttp3/lib/pkgconfig:\
/home/linuxbrew/.linuxbrew/opt/c-ares/lib/pkgconfig" /home/linuxbrew/.linuxbrew/opt/c-ares/lib/pkgconfig"

View file

@ -350,7 +350,7 @@ if(PICKY_COMPILER)
endif() endif()
endif() endif()
# # Assemble list of flags
set(_picky_skipped "") set(_picky_skipped "")
foreach(_ccopt IN LISTS _picky_enable) foreach(_ccopt IN LISTS _picky_enable)

View file

@ -247,7 +247,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `SHARE_LIB_OBJECT`: Build shared and static libcurl in a single pass (requires CMake 3.12 or newer). Default: `ON` for Windows - `SHARE_LIB_OBJECT`: Build shared and static libcurl in a single pass (requires CMake 3.12 or newer). Default: `ON` for Windows
- `STATIC_LIB_SUFFIX`: Static library suffix. Default: (empty) - `STATIC_LIB_SUFFIX`: Static library suffix. Default: (empty)
## CA bundle options ## Root CA options
- `CURL_CA_BUNDLE`: Absolute path to the CA bundle. Set `none` to disable or `auto` for auto-detection. Default: `auto` - `CURL_CA_BUNDLE`: Absolute path to the CA bundle. Set `none` to disable or `auto` for auto-detection. Default: `auto`
- `CURL_CA_EMBED`: Absolute path to the CA bundle to embed in the curl tool. Default: (disabled) - `CURL_CA_EMBED`: Absolute path to the CA bundle to embed in the curl tool. Default: (disabled)
@ -257,6 +257,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `CURL_CA_PATH`: Absolute path to a directory containing CA certificates stored individually. - `CURL_CA_PATH`: Absolute path to a directory containing CA certificates stored individually.
Set `none` to disable or `auto` for auto-detection. Default: `auto` Set `none` to disable or `auto` for auto-detection. Default: `auto`
- `CURL_CA_SEARCH_SAFE`: Enable safe CA bundle search (within the curl tool directory) on Windows. Default: `OFF` - `CURL_CA_SEARCH_SAFE`: Enable safe CA bundle search (within the curl tool directory) on Windows. Default: `OFF`
- `USE_APPLE_SECTRUST`: Use Apple OS-native certificate verification. Default: `OFF`
## Enabling features ## Enabling features
@ -267,9 +268,12 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `ENABLE_THREADED_RESOLVER`: Enable threaded DNS lookup. Default: `ON` if c-ares is not enabled and target supports threading. - `ENABLE_THREADED_RESOLVER`: Enable threaded DNS lookup. Default: `ON` if c-ares is not enabled and target supports threading.
- `ENABLE_UNICODE`: Use the Unicode version of the Windows API functions. Default: `OFF` - `ENABLE_UNICODE`: Use the Unicode version of the Windows API functions. Default: `OFF`
- `ENABLE_UNIX_SOCKETS`: Enable Unix domain sockets support. Default: `ON` - `ENABLE_UNIX_SOCKETS`: Enable Unix domain sockets support. Default: `ON`
- `USE_APPLE_IDN`: Use Apple built-in IDN support. Default: `OFF`
- `USE_ECH`: Enable ECH support. Default: `OFF` - `USE_ECH`: Enable ECH support. Default: `OFF`
- `USE_HTTPSRR`: Enable HTTPS RR support. Default: `OFF` - `USE_HTTPSRR`: Enable HTTPS RR support. Default: `OFF`
- `USE_SSLS_EXPORT`: Enable experimental SSL session import/export. Default: `OFF` - `USE_SSLS_EXPORT`: Enable experimental SSL session import/export. Default: `OFF`
- `USE_WIN32_IDN`: Use WinIDN for IDN support. Default: `OFF`
- `USE_WIN32_LDAP`: Use Windows LDAP implementation. Default: `ON`
## Disabling features ## Disabling features
@ -369,14 +373,10 @@ Details via CMake
- `CURL_ZLIB`: Use zlib (`ON`, `OFF` or `AUTO`). Default: `AUTO` - `CURL_ZLIB`: Use zlib (`ON`, `OFF` or `AUTO`). Default: `AUTO`
- `CURL_ZSTD`: Use zstd (`ON`, `OFF` or `AUTO`). Default: `AUTO` - `CURL_ZSTD`: Use zstd (`ON`, `OFF` or `AUTO`). Default: `AUTO`
- `ENABLE_ARES`: Enable c-ares support. Default: `OFF` - `ENABLE_ARES`: Enable c-ares support. Default: `OFF`
- `USE_APPLE_IDN`: Use Apple built-in IDN support. Default: `OFF`
- `USE_APPLE_SECTRUST`: Use Apple OS-native certificate verification. Default: `OFF`
- `USE_LIBIDN2`: Use libidn2 for IDN support. Default: `ON` - `USE_LIBIDN2`: Use libidn2 for IDN support. Default: `ON`
- `USE_NGHTTP2`: Use nghttp2 library. Default: `ON` - `USE_NGHTTP2`: Use nghttp2 library. Default: `ON`
- `USE_NGTCP2`: Use ngtcp2 and nghttp3 libraries for HTTP/3 support. Default: `OFF` - `USE_NGTCP2`: Use ngtcp2 and nghttp3 libraries for HTTP/3 support. Default: `OFF`
- `USE_QUICHE`: Use quiche library for HTTP/3 support. Default: `OFF` - `USE_QUICHE`: Use quiche library for HTTP/3 support. Default: `OFF`
- `USE_WIN32_IDN`: Use WinIDN for IDN support. Default: `OFF`
- `USE_WIN32_LDAP`: Use Windows LDAP implementation. Default: `ON`
## Dependency options (via CMake) ## Dependency options (via CMake)

View file

@ -45,7 +45,7 @@ static void dump(const char *text, const unsigned char *ptr,
/* without the hex output, we can fit more on screen */ /* without the hex output, we can fit more on screen */
width = 0x40; width = 0x40;
fprintf(stderr, "%s, %10.10lu bytes (0x%8.8lx)\n", fprintf(stderr, "%s, %lu bytes (0x%lx)\n",
text, (unsigned long)size, (unsigned long)size); text, (unsigned long)size, (unsigned long)size);
for(i = 0; i < size; i += width) { for(i = 0; i < size; i += width) {

View file

@ -42,7 +42,7 @@ static void dump(const char *text, const unsigned char *ptr,
/* without the hex output, we can fit more on screen */ /* without the hex output, we can fit more on screen */
width = 0x40; width = 0x40;
fprintf(stderr, "%s, %10.10lu bytes (0x%8.8lx)\n", fprintf(stderr, "%s, %lu bytes (0x%lx)\n",
text, (unsigned long)size, (unsigned long)size); text, (unsigned long)size, (unsigned long)size);
for(i = 0; i < size; i += width) { for(i = 0; i < size; i += width) {

View file

@ -118,7 +118,7 @@ static void dump(const char *text,
size_t c; size_t c;
unsigned int width = 0x10; unsigned int width = 0x10;
fprintf(stream, "%s, %10.10ld bytes (0x%8.8lx)\n", fprintf(stream, "%s, %lu bytes (0x%lx)\n",
text, (long)size, (long)size); text, (long)size, (long)size);
for(i = 0; i < size; i += width) { for(i = 0; i < size; i += width) {

View file

@ -208,7 +208,7 @@ static void async_ares_cleanup(struct Curl_resolv_async *async)
} }
void Curl_async_ares_shutdown(struct Curl_easy *data, void Curl_async_ares_shutdown(struct Curl_easy *data,
struct Curl_resolv_async *async) struct Curl_resolv_async *async)
{ {
/* c-ares has a method to "cancel" operations on a channel, but /* c-ares has a method to "cancel" operations on a channel, but
* as reported in #18216, this does not totally reset the channel * as reported in #18216, this does not totally reset the channel
@ -330,10 +330,10 @@ static timediff_t async_ares_poll_timeout(struct async_ares_ctx *ares,
int itimeout_ms; int itimeout_ms;
#if TIMEDIFF_T_MAX > INT_MAX #if TIMEDIFF_T_MAX > INT_MAX
itimeout_ms = (timeout_ms > INT_MAX) ? INT_MAX : itimeout_ms = (timeout_ms > INT_MAX) ? INT_MAX :
((timeout_ms < 0) ? -1 : (int)timeout_ms); ((timeout_ms < 0) ? -1 : (int)timeout_ms);
#else #else
itimeout_ms = (int)timeout_ms; itimeout_ms = (int)timeout_ms;
#endif #endif
max_timeout.tv_sec = itimeout_ms / 1000; max_timeout.tv_sec = itimeout_ms / 1000;
max_timeout.tv_usec = (itimeout_ms % 1000) * 1000; max_timeout.tv_usec = (itimeout_ms % 1000) * 1000;
@ -349,9 +349,10 @@ static timediff_t async_ares_poll_timeout(struct async_ares_ctx *ares,
return 1000; return 1000;
} }
static const struct Curl_addrinfo * static const struct Curl_addrinfo *async_ares_get_ai(
async_ares_get_ai(const struct Curl_addrinfo *ai, const struct Curl_addrinfo *ai,
int ai_family, unsigned int index) int ai_family,
unsigned int index)
{ {
unsigned int i = 0; unsigned int i = 0;
for(i = 0; ai; ai = ai->ai_next) { for(i = 0; ai; ai = ai->ai_next) {
@ -364,10 +365,10 @@ async_ares_get_ai(const struct Curl_addrinfo *ai,
return NULL; return NULL;
} }
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data,
Curl_async_get_ai(struct Curl_easy *data, struct Curl_resolv_async *async,
struct Curl_resolv_async *async, int ai_family,
int ai_family, unsigned int index) unsigned int index)
{ {
struct async_ares_ctx *ares = &async->ares; struct async_ares_ctx *ares = &async->ares;
@ -388,9 +389,9 @@ Curl_async_get_ai(struct Curl_easy *data,
} }
#ifdef USE_HTTPSRR #ifdef USE_HTTPSRR
const struct Curl_https_rrinfo * const struct Curl_https_rrinfo *Curl_async_get_https(
Curl_async_get_https(struct Curl_easy *data, struct Curl_easy *data,
struct Curl_resolv_async *async) struct Curl_resolv_async *async)
{ {
if(Curl_async_knows_https(data, async)) if(Curl_async_knows_https(data, async))
return &async->ares.hinfo; return &async->ares.hinfo;
@ -415,7 +416,7 @@ bool Curl_async_knows_https(struct Curl_easy *data,
* Waits for a resolve to finish. This function should be avoided since using * Waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang". * this risk getting the multi interface to "hang".
* *
* 'entry' MUST be non-NULL. * 'pdns' MUST be non-NULL.
* *
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors. * CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
@ -479,8 +480,8 @@ CURLcode Curl_async_await(struct Curl_easy *data, uint32_t resolv_id,
* async_ares_node2addr() converts an address list provided by c-ares * async_ares_node2addr() converts an address list provided by c-ares
* to an internal libcurl compatible list. * to an internal libcurl compatible list.
*/ */
static struct Curl_addrinfo * static struct Curl_addrinfo *async_ares_node2addr(
async_ares_node2addr(struct ares_addrinfo_node *node) struct ares_addrinfo_node *node)
{ {
/* traverse the ares_addrinfo_node list */ /* traverse the ares_addrinfo_node list */
struct ares_addrinfo_node *ai; struct ares_addrinfo_node *ai;

View file

@ -135,11 +135,11 @@ static void async_thrdd_item_destroy(struct async_thrdd_item *item)
} }
/* Initialize context for threaded resolver */ /* Initialize context for threaded resolver */
static struct async_thrdd_item * static struct async_thrdd_item *async_thrdd_item_create(
async_thrdd_item_create(struct Curl_easy *data, struct Curl_easy *data,
uint32_t resolv_id, uint8_t dns_queries, uint32_t resolv_id, uint8_t dns_queries,
const char *hostname, uint16_t port, const char *hostname, uint16_t port,
uint8_t transport) uint8_t transport)
{ {
size_t hostlen = strlen(hostname); size_t hostlen = strlen(hostname);
struct async_thrdd_item *item; struct async_thrdd_item *item;
@ -252,7 +252,7 @@ static CURLcode async_rr_start(struct Curl_easy *data,
#endif #endif
void Curl_async_thrdd_shutdown(struct Curl_easy *data, void Curl_async_thrdd_shutdown(struct Curl_easy *data,
struct Curl_resolv_async *async) struct Curl_resolv_async *async)
{ {
Curl_async_thrdd_destroy(data, async); Curl_async_thrdd_destroy(data, async);
} }
@ -389,13 +389,13 @@ static void async_thrdd_item_process(void *item)
struct async_thrdd_item *item = arg; struct async_thrdd_item *item = arg;
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
if(item->delay_ms) { if(item->delay_ms) {
curlx_wait_ms(item->delay_ms); curlx_wait_ms(item->delay_ms);
} }
if(item->delay_fail_ms) { if(item->delay_fail_ms) {
curlx_wait_ms(item->delay_fail_ms); curlx_wait_ms(item->delay_fail_ms);
return; return;
} }
#endif #endif
item->res = Curl_ipv4_resolve_r(item->hostname, item->port); item->res = Curl_ipv4_resolve_r(item->hostname, item->port);
if(!item->res) { if(!item->res) {
@ -496,10 +496,9 @@ static void async_thrdd_report_item(struct Curl_easy *data,
} }
} }
infof(data, "Host %s:%u resolved IPv%c: %s", infof(data, "Host %s:%u resolved IPv%c: %s", item->hostname, item->port,
item->hostname, item->port, (item->dns_queries & CURL_DNSQ_AAAA) ? '6' : '4',
(item->dns_queries & CURL_DNSQ_AAAA) ? '6' : '4', (curlx_dyn_len(&tmp) ? curlx_dyn_ptr(&tmp) : "(none)"));
(curlx_dyn_len(&tmp) ? curlx_dyn_ptr(&tmp) : "(none)"));
out: out:
curlx_dyn_free(&tmp); curlx_dyn_free(&tmp);
} }
@ -758,9 +757,9 @@ out:
return result; return result;
} }
static const struct Curl_addrinfo * static const struct Curl_addrinfo *async_thrdd_get_ai(
async_thrdd_get_ai(const struct Curl_addrinfo *ai, const struct Curl_addrinfo *ai,
int ai_family, unsigned int index) int ai_family, unsigned int index)
{ {
unsigned int i = 0; unsigned int i = 0;
for(i = 0; ai; ai = ai->ai_next) { for(i = 0; ai; ai = ai->ai_next) {
@ -773,10 +772,10 @@ async_thrdd_get_ai(const struct Curl_addrinfo *ai,
return NULL; return NULL;
} }
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data,
Curl_async_get_ai(struct Curl_easy *data, struct Curl_resolv_async *async,
struct Curl_resolv_async *async, int ai_family,
int ai_family, unsigned int index) unsigned int index)
{ {
struct async_thrdd_ctx *thrdd = &async->thrdd; struct async_thrdd_ctx *thrdd = &async->thrdd;
@ -797,9 +796,9 @@ Curl_async_get_ai(struct Curl_easy *data,
} }
#ifdef USE_HTTPSRR #ifdef USE_HTTPSRR
const struct Curl_https_rrinfo * const struct Curl_https_rrinfo *Curl_async_get_https(
Curl_async_get_https(struct Curl_easy *data, struct Curl_easy *data,
struct Curl_resolv_async *async) struct Curl_resolv_async *async)
{ {
#ifdef USE_HTTPSRR_ARES #ifdef USE_HTTPSRR_ARES
if(Curl_async_knows_https(data, async)) if(Curl_async_knows_https(data, async))

View file

@ -82,15 +82,15 @@ void Curl_async_global_cleanup(void);
CURLcode Curl_async_getaddrinfo(struct Curl_easy *data, CURLcode Curl_async_getaddrinfo(struct Curl_easy *data,
struct Curl_resolv_async *async); struct Curl_resolv_async *async);
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data,
Curl_async_get_ai(struct Curl_easy *data, struct Curl_resolv_async *async,
struct Curl_resolv_async *async, int ai_family,
int ai_family, unsigned int index); unsigned int index);
#ifdef USE_HTTPSRR #ifdef USE_HTTPSRR
const struct Curl_https_rrinfo * const struct Curl_https_rrinfo *Curl_async_get_https(
Curl_async_get_https(struct Curl_easy *data, struct Curl_easy *data,
struct Curl_resolv_async *async); struct Curl_resolv_async *async);
bool Curl_async_knows_https(struct Curl_easy *data, bool Curl_async_knows_https(struct Curl_easy *data,
struct Curl_resolv_async *async); struct Curl_resolv_async *async);
#endif /* USE_HTTPSRR */ #endif /* USE_HTTPSRR */
@ -125,7 +125,7 @@ struct async_ares_ctx {
}; };
void Curl_async_ares_shutdown(struct Curl_easy *data, void Curl_async_ares_shutdown(struct Curl_easy *data,
struct Curl_resolv_async *async); struct Curl_resolv_async *async);
void Curl_async_ares_destroy(struct Curl_easy *data, void Curl_async_ares_destroy(struct Curl_easy *data,
struct Curl_resolv_async *async); struct Curl_resolv_async *async);
@ -176,7 +176,7 @@ struct doh_probes;
* Waits for a resolve to finish. This function should be avoided since using * Waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang". * this risk getting the multi interface to "hang".
* *
* On return 'entry' is assigned the resolved dns (CURLE_OK or NULL otherwise. * On return 'dns' is assigned the resolved dns (CURLE_OK or NULL otherwise.
* *
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, * Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors. * CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
@ -210,8 +210,8 @@ CURLcode Curl_async_pollset(struct Curl_easy *data,
/* convert these functions if an asynch resolver is not used */ /* convert these functions if an asynch resolver is not used */
#define Curl_async_global_init() CURLE_OK #define Curl_async_global_init() CURLE_OK
#define Curl_async_global_cleanup() Curl_nop_stmt #define Curl_async_global_cleanup() Curl_nop_stmt
#define Curl_async_get_ai(a,b,c,d) NULL #define Curl_async_get_ai(a, b, c, d) NULL
#define Curl_async_await(a,b,c) CURLE_COULDNT_RESOLVE_HOST #define Curl_async_await(a, b, c) CURLE_COULDNT_RESOLVE_HOST
#define Curl_async_take_result(x, y, z) CURLE_COULDNT_RESOLVE_HOST #define Curl_async_take_result(x, y, z) CURLE_COULDNT_RESOLVE_HOST
#define Curl_async_pollset(x, y, z) CURLE_OK #define Curl_async_pollset(x, y, z) CURLE_OK
#endif /* !CURLRES_ASYNCH */ #endif /* !CURLRES_ASYNCH */
@ -263,7 +263,7 @@ void Curl_async_destroy(struct Curl_easy *data,
struct Curl_resolv_async *async); struct Curl_resolv_async *async);
#else /* !USE_CURL_ASYNC */ #else /* !USE_CURL_ASYNC */
#define Curl_async_shutdown(x,y) Curl_nop_stmt #define Curl_async_shutdown(x, y) Curl_nop_stmt
#endif /* USE_CURL_ASYNC */ #endif /* USE_CURL_ASYNC */
/********** end of generic resolver interface functions *****************/ /********** end of generic resolver interface functions *****************/

View file

@ -47,11 +47,12 @@ struct cf_dns_ctx {
char hostname[1]; char hostname[1];
}; };
static struct cf_dns_ctx * static struct cf_dns_ctx *cf_dns_ctx_create(struct Curl_easy *data,
cf_dns_ctx_create(struct Curl_easy *data, uint8_t dns_queries, uint8_t dns_queries,
const char *hostname, uint16_t port, uint8_t transport, const char *hostname,
bool abstract_unix_socket, uint16_t port, uint8_t transport,
struct Curl_dns_entry *dns) bool abstract_unix_socket,
struct Curl_dns_entry *dns)
{ {
struct cf_dns_ctx *ctx; struct cf_dns_ctx *ctx;
size_t hlen = strlen(hostname); size_t hlen = strlen(hostname);
@ -399,7 +400,7 @@ static CURLcode cf_dns_conn_create(struct Curl_cfilter **pcf,
* there, thus overriding any defaults that might have been set above. */ * there, thus overriding any defaults that might have been set above. */
hostname = ehost->name; hostname = ehost->name;
port = conn->bits.conn_to_port ? port = conn->bits.conn_to_port ?
conn->conn_to_port : (uint16_t)conn->remote_port; conn->conn_to_port : (uint16_t)conn->remote_port;
} }
if(!hostname) { if(!hostname) {
@ -500,9 +501,10 @@ CURLcode Curl_conn_dns_result(struct connectdata *conn, int sockindex)
return Curl_cf_dns_result(conn->cfilter[sockindex]); return Curl_cf_dns_result(conn->cfilter[sockindex]);
} }
static const struct Curl_addrinfo * static const struct Curl_addrinfo *cf_dns_get_nth_ai(
cf_dns_get_nth_ai(struct Curl_cfilter *cf, const struct Curl_addrinfo *ai, struct Curl_cfilter *cf,
int ai_family, unsigned int index) const struct Curl_addrinfo *ai,
int ai_family, unsigned int index)
{ {
struct cf_dns_ctx *ctx = cf->ctx; struct cf_dns_ctx *ctx = cf->ctx;
unsigned int i = 0; unsigned int i = 0;
@ -551,11 +553,10 @@ bool Curl_conn_dns_has_any_ai(struct Curl_easy *data, int sockindex)
* first "resolve" filter underneath `cf`. If the DNS resolving is * first "resolve" filter underneath `cf`. If the DNS resolving is
* not done yet or if no address for the family exists, returns NULL. * not done yet or if no address for the family exists, returns NULL.
*/ */
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
Curl_cf_dns_get_ai(struct Curl_cfilter *cf, struct Curl_easy *data,
struct Curl_easy *data, int ai_family,
int ai_family, unsigned int index)
unsigned int index)
{ {
(void)data; (void)data;
for(; cf; cf = cf->next) { for(; cf; cf = cf->next) {
@ -576,15 +577,12 @@ Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
* first "resolve" filter at the connection. If the DNS resolving is * first "resolve" filter at the connection. If the DNS resolving is
* not done yet or if no address for the family exists, returns NULL. * not done yet or if no address for the family exists, returns NULL.
*/ */
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_conn_dns_get_ai(struct Curl_easy *data,
Curl_conn_dns_get_ai(struct Curl_easy *data, int sockindex, int ai_family,
int sockindex, unsigned int index)
int ai_family,
unsigned int index)
{ {
struct connectdata *conn = data->conn; struct connectdata *conn = data->conn;
return Curl_cf_dns_get_ai(conn->cfilter[sockindex], data, return Curl_cf_dns_get_ai(conn->cfilter[sockindex], data, ai_family, index);
ai_family, index);
} }
#ifdef USE_HTTPSRR #ifdef USE_HTTPSRR
@ -592,8 +590,8 @@ Curl_conn_dns_get_ai(struct Curl_easy *data,
* connection. If the DNS resolving is not done yet or if there * connection. If the DNS resolving is not done yet or if there
* is no HTTPS-RR info, returns NULL. * is no HTTPS-RR info, returns NULL.
*/ */
const struct Curl_https_rrinfo * const struct Curl_https_rrinfo *Curl_conn_dns_get_https(struct Curl_easy *data,
Curl_conn_dns_get_https(struct Curl_easy *data, int sockindex) int sockindex)
{ {
struct Curl_cfilter *cf = data->conn->cfilter[sockindex]; struct Curl_cfilter *cf = data->conn->cfilter[sockindex];
for(; cf; cf = cf->next) { for(; cf; cf = cf->next) {

View file

@ -51,28 +51,25 @@ CURLcode Curl_cf_dns_result(struct Curl_cfilter *cf);
* `Curl_conn_dns_get_ai()`. */ * `Curl_conn_dns_get_ai()`. */
bool Curl_conn_dns_has_any_ai(struct Curl_easy *data, int sockindex); bool Curl_conn_dns_has_any_ai(struct Curl_easy *data, int sockindex);
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_conn_dns_get_ai(struct Curl_easy *data,
Curl_conn_dns_get_ai(struct Curl_easy *data, int sockindex,
int sockindex, int ai_family,
int ai_family, unsigned int index);
unsigned int index);
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
Curl_cf_dns_get_ai(struct Curl_cfilter *cf, struct Curl_easy *data,
struct Curl_easy *data, int ai_family,
int ai_family, unsigned int index);
unsigned int index);
#ifdef USE_HTTPSRR #ifdef USE_HTTPSRR
const struct Curl_https_rrinfo * const struct Curl_https_rrinfo *Curl_conn_dns_get_https(struct Curl_easy *data,
Curl_conn_dns_get_https(struct Curl_easy *data, int sockindex); int sockindex);
bool Curl_conn_dns_resolved_https(struct Curl_easy *data, int sockindex); bool Curl_conn_dns_resolved_https(struct Curl_easy *data, int sockindex);
#else #else
#define Curl_conn_dns_get_https(a,b) NULL #define Curl_conn_dns_get_https(a, b) NULL
#define Curl_conn_dns_resolved_https(a,b) TRUE #define Curl_conn_dns_resolved_https(a, b) TRUE
#endif #endif
extern struct Curl_cftype Curl_cft_dns; extern struct Curl_cftype Curl_cft_dns;
#endif /* HEADER_CURL_CF_DNS_H */ #endif /* HEADER_CURL_CF_DNS_H */

View file

@ -685,15 +685,16 @@ static int proxy_h2_on_stream_close(nghttp2_session *session,
return 0; return 0;
} }
static CURLcode proxy_h2_submit(int32_t *pstream_id, static CURLcode proxy_h2_submit(
struct Curl_cfilter *cf, int32_t *pstream_id,
struct Curl_easy *data, struct Curl_cfilter *cf,
nghttp2_session *h2, struct Curl_easy *data,
struct httpreq *req, nghttp2_session *h2,
const nghttp2_priority_spec *pri_spec, struct httpreq *req,
void *stream_user_data, const nghttp2_priority_spec *pri_spec,
nghttp2_data_source_read_callback read_callback, void *stream_user_data,
void *read_ctx) nghttp2_data_source_read_callback read_callback,
void *read_ctx)
{ {
struct dynhds h2_headers; struct dynhds h2_headers;
nghttp2_nv *nva = NULL; nghttp2_nv *nva = NULL;

View file

@ -123,9 +123,8 @@ static void cf_ai_iter_init(struct cf_ai_iter *iter,
iter->n = 0; iter->n = 0;
} }
static const struct Curl_addrinfo * static const struct Curl_addrinfo *cf_ai_iter_next(struct cf_ai_iter *iter,
cf_ai_iter_next(struct cf_ai_iter *iter, struct Curl_easy *data)
struct Curl_easy *data)
{ {
const struct Curl_addrinfo *addr; const struct Curl_addrinfo *addr;

View file

@ -100,9 +100,9 @@ static void tcpnodelay(struct Curl_cfilter *cf,
defined(TCP_KEEPALIVE) || defined(TCP_KEEPALIVE_THRESHOLD) || \ defined(TCP_KEEPALIVE) || defined(TCP_KEEPALIVE_THRESHOLD) || \
defined(TCP_KEEPINTVL) || defined(TCP_KEEPALIVE_ABORT_THRESHOLD) defined(TCP_KEEPINTVL) || defined(TCP_KEEPALIVE_ABORT_THRESHOLD)
#if defined(USE_WINSOCK) || \ #if defined(USE_WINSOCK) || \
(defined(__sun) && !defined(TCP_KEEPIDLE)) || \ (defined(__sun) && !defined(TCP_KEEPIDLE)) || \
(defined(__DragonFly__) && __DragonFly_version < 500702) || \ (defined(__DragonFly__) && __DragonFly_version < 500702) || \
(defined(_WIN32) && !defined(TCP_KEEPIDLE)) (defined(_WIN32) && !defined(TCP_KEEPIDLE))
/* Solaris < 11.4, DragonFlyBSD < 500702 and Windows < 10.0.16299 /* Solaris < 11.4, DragonFlyBSD < 500702 and Windows < 10.0.16299
* use millisecond units. */ * use millisecond units. */
#define KEEPALIVE_FACTOR(x) ((x) *= 1000) #define KEEPALIVE_FACTOR(x) ((x) *= 1000)
@ -638,7 +638,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
* to take a type parameter instead. * to take a type parameter instead.
*/ */
uint8_t dns_queries = (af == AF_INET) ? uint8_t dns_queries = (af == AF_INET) ?
CURL_DNSQ_A : (CURL_DNSQ_A|CURL_DNSQ_AAAA); CURL_DNSQ_A : (CURL_DNSQ_A | CURL_DNSQ_AAAA);
#ifdef USE_IPV6 #ifdef USE_IPV6
if(af == AF_INET6) if(af == AF_INET6)
dns_queries = CURL_DNSQ_AAAA; dns_queries = CURL_DNSQ_AAAA;

View file

@ -30,7 +30,6 @@
#pragma enum(int) #pragma enum(int)
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* Global configuration parameters: normally generated by autoconf. */ /* Global configuration parameters: normally generated by autoconf. */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

View file

@ -262,7 +262,7 @@
/* Default define to enable threaded asynchronous DNS lookups. */ /* Default define to enable threaded asynchronous DNS lookups. */
#if !defined(USE_SYNC_DNS) && !defined(USE_ARES) && \ #if !defined(USE_SYNC_DNS) && !defined(USE_ARES) && \
!defined(USE_RESOLV_THREADED) !defined(USE_RESOLV_THREADED)
# define USE_RESOLV_THREADED 1 # define USE_RESOLV_THREADED 1
#endif #endif
@ -275,7 +275,7 @@
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
#ifndef CURL_WINDOWS_UWP #ifndef CURL_WINDOWS_UWP
#define HAVE_LDAP_SSL 1 #define HAVE_LDAP_SSL 1
#define USE_WIN32_LDAP 1 #define USE_WIN32_LDAP 1
/* Define to use the Windows crypto library. */ /* Define to use the Windows crypto library. */

View file

@ -423,18 +423,17 @@ static CURLcode storecookie(struct Cookie *co, struct Curl_str *cp,
/* this function return errors on OOM etc, not on plain cookie format /* this function return errors on OOM etc, not on plain cookie format
problems */ problems */
static CURLcode static CURLcode parse_cookie_header(
parse_cookie_header(struct Curl_easy *data, struct Curl_easy *data,
struct Cookie *co, struct Cookie *co,
struct CookieInfo *ci, struct CookieInfo *ci,
bool *okay, /* if the cookie was fine */ bool *okay, /* if the cookie was fine */
const char *ptr, const char *ptr,
const char *domain, /* default domain */ const char *domain, /* default domain */
const char *path, /* full path used when this cookie is const char *path, /* full path used when this cookie is
set, used to get default path for set, used to get default path for
the cookie unless set */ the cookie unless set */
bool secure) /* TRUE if connection is over secure bool secure) /* TRUE if connection is over secure origin */
origin */
{ {
/* This line was read off an HTTP-header */ /* This line was read off an HTTP-header */
time_t now = 0; time_t now = 0;
@ -930,17 +929,16 @@ static bool replace_existing(struct Curl_easy *data,
* IPv6 address. * IPv6 address.
* *
*/ */
CURLcode CURLcode Curl_cookie_add(
Curl_cookie_add(struct Curl_easy *data, struct Curl_easy *data,
struct CookieInfo *ci, struct CookieInfo *ci,
bool httpheader, /* TRUE if HTTP header-style line */ bool httpheader, /* TRUE if HTTP header-style line */
bool noexpire, /* if TRUE, skip remove_expired() */ bool noexpire, /* if TRUE, skip remove_expired() */
const char *lineptr, /* first character of the line */ const char *lineptr, /* first character of the line */
const char *domain, /* default domain */ const char *domain, /* default domain */
const char *path, /* full path used when this cookie is set, const char *path, /* full path used when this cookie is set, used
used to get default path for the cookie to get default path for the cookie unless set */
unless set */ bool secure) /* TRUE if connection is over secure origin */
bool secure) /* TRUE if connection is over secure origin */
{ {
struct Cookie comem; struct Cookie comem;
struct Cookie *co; struct Cookie *co;

View file

@ -125,11 +125,11 @@ void Curl_cookie_clearall(struct CookieInfo *ci);
void Curl_cookie_clearsess(struct CookieInfo *ci); void Curl_cookie_clearsess(struct CookieInfo *ci);
#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES) #if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)
#define Curl_cookie_list(x) NULL #define Curl_cookie_list(x) NULL
#define Curl_cookie_loadfiles(x) CURLE_OK #define Curl_cookie_loadfiles(x) CURLE_OK
#define Curl_cookie_init() NULL #define Curl_cookie_init() NULL
#define Curl_cookie_run(x) Curl_nop_stmt #define Curl_cookie_run(x) Curl_nop_stmt
#define Curl_cookie_cleanup(x) Curl_nop_stmt #define Curl_cookie_cleanup(x) Curl_nop_stmt
#define Curl_flush_cookies(x, y) Curl_nop_stmt #define Curl_flush_cookies(x, y) Curl_nop_stmt
#else #else
void Curl_flush_cookies(struct Curl_easy *data, bool cleanup); void Curl_flush_cookies(struct Curl_easy *data, bool cleanup);

View file

@ -44,9 +44,9 @@
#define ISDIGIT(x) (((x) >= '0') && ((x) <= '9')) #define ISDIGIT(x) (((x) >= '0') && ((x) <= '9'))
#define ISBLANK(x) (((x) == ' ') || ((x) == '\t')) #define ISBLANK(x) (((x) == ' ') || ((x) == '\t'))
#define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d))) #define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d)))
#define ISURLPUNTCS(x) (((x) == '-') || ((x) == '.') || ((x) == '_') || \ #define ISURLPUNTCS(x) \
((x) == '~')) (((x) == '-') || ((x) == '.') || ((x) == '_') || ((x) == '~'))
#define ISUNRESERVED(x) (ISALNUM(x) || ISURLPUNTCS(x)) #define ISUNRESERVED(x) (ISALNUM(x) || ISURLPUNTCS(x))
#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r') #define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
#endif /* HEADER_CURL_CTYPE_H */ #endif /* HEADER_CURL_CTYPE_H */

View file

@ -93,20 +93,20 @@ struct stub_gss_ctx_id_t_desc {
char creds[250]; char creds[250];
}; };
static OM_uint32 static OM_uint32 stub_gss_init_sec_context(
stub_gss_init_sec_context(OM_uint32 *min, OM_uint32 *min,
gss_cred_id_t initiator_cred_handle, gss_cred_id_t initiator_cred_handle,
struct stub_gss_ctx_id_t_desc **context, struct stub_gss_ctx_id_t_desc **context,
gss_name_t target_name, gss_name_t target_name,
const gss_OID mech_type, const gss_OID mech_type,
OM_uint32 req_flags, OM_uint32 req_flags,
OM_uint32 time_req, OM_uint32 time_req,
const gss_channel_bindings_t input_chan_bindings, const gss_channel_bindings_t input_chan_bindings,
gss_buffer_desc *input_token, gss_buffer_desc *input_token,
gss_OID *actual_mech_type, gss_OID *actual_mech_type,
gss_buffer_desc *output_token, gss_buffer_desc *output_token,
OM_uint32 *ret_flags, OM_uint32 *ret_flags,
OM_uint32 *time_rec) OM_uint32 *time_rec)
{ {
struct stub_gss_ctx_id_t_desc *ctx = NULL; struct stub_gss_ctx_id_t_desc *ctx = NULL;
@ -283,10 +283,10 @@ stub_gss_init_sec_context(OM_uint32 *min,
return GSS_S_CONTINUE_NEEDED; return GSS_S_CONTINUE_NEEDED;
} }
static OM_uint32 static OM_uint32 stub_gss_delete_sec_context(
stub_gss_delete_sec_context(OM_uint32 *min, OM_uint32 *min,
struct stub_gss_ctx_id_t_desc **context, struct stub_gss_ctx_id_t_desc **context,
gss_buffer_t output_token) gss_buffer_t output_token)
{ {
(void)output_token; (void)output_token;

View file

@ -141,7 +141,7 @@ static void extend_key_56_to_64(const unsigned char *key_56, char *key)
key[4] = (char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4)); key[4] = (char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4));
key[5] = (char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5)); key[5] = (char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5));
key[6] = (char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6)); key[6] = (char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6));
key[7] = (char) ((key_56[6] << 1) & 0xFF); key[7] = (char)((key_56[6] << 1) & 0xFF);
} }
#ifdef USE_OPENSSL_DES #ifdef USE_OPENSSL_DES

View file

@ -365,16 +365,14 @@
#endif #endif
/* based on logic in "curl/mprintf.h" */ /* based on logic in "curl/mprintf.h" */
#if (defined(__GNUC__) || defined(__clang__) || \ #if (defined(__GNUC__) || defined(__clang__) || \
defined(__IAR_SYSTEMS_ICC__)) && \ defined(__IAR_SYSTEMS_ICC__)) && \
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
!defined(CURL_NO_FMT_CHECKS) !defined(CURL_NO_FMT_CHECKS)
#if defined(__MINGW32__) && !defined(__clang__) #if defined(__MINGW32__) && !defined(__clang__)
#define CURL_PRINTF(fmt, arg) \ #define CURL_PRINTF(fmt, arg) __attribute__((format(gnu_printf, fmt, arg)))
__attribute__((format(gnu_printf, fmt, arg)))
#else #else
#define CURL_PRINTF(fmt, arg) \ #define CURL_PRINTF(fmt, arg) __attribute__((format(__printf__, fmt, arg)))
__attribute__((format(__printf__, fmt, arg)))
#endif #endif
#else #else
#define CURL_PRINTF(fmt, arg) #define CURL_PRINTF(fmt, arg)
@ -392,7 +390,7 @@
(defined(__GNUC__) && __GNUC__ <= 14)) && \ (defined(__GNUC__) && __GNUC__ <= 14)) && \
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
!defined(__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__) !defined(__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__)
#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ \ #define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ \
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
#endif #endif
@ -733,8 +731,7 @@
#endif #endif
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \ #if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \ defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_RUSTLS)
defined(USE_RUSTLS)
#define USE_SSL /* SSL support has been enabled */ #define USE_SSL /* SSL support has been enabled */
#endif #endif
@ -750,23 +747,23 @@
#endif #endif
/* Single point where USE_SPNEGO definition might be defined */ /* Single point where USE_SPNEGO definition might be defined */
#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \ #if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
#define USE_SPNEGO #define USE_SPNEGO
#endif #endif
/* Single point where USE_KERBEROS5 definition might be defined */ /* Single point where USE_KERBEROS5 definition might be defined */
#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \ #if !defined(CURL_DISABLE_KERBEROS_AUTH) && \
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
#define USE_KERBEROS5 #define USE_KERBEROS5
#endif #endif
/* Single point where USE_NTLM definition might be defined */ /* Single point where USE_NTLM definition might be defined */
#ifdef CURL_ENABLE_NTLM #ifdef CURL_ENABLE_NTLM
# if (defined(USE_OPENSSL) && defined(HAVE_DES_ECB_ENCRYPT)) || \ # if (defined(USE_OPENSSL) && defined(HAVE_DES_ECB_ENCRYPT)) || \
defined(USE_GNUTLS) || \ defined(USE_GNUTLS) || \
(defined(USE_MBEDTLS) && defined(HAVE_MBEDTLS_DES_CRYPT_ECB)) || \ (defined(USE_MBEDTLS) && defined(HAVE_MBEDTLS_DES_CRYPT_ECB)) || \
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \ defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
(defined(USE_WOLFSSL) && defined(HAVE_WC_DES_ECBENCRYPT)) (defined(USE_WOLFSSL) && defined(HAVE_WC_DES_ECBENCRYPT))
# define USE_CURL_NTLM_CORE # define USE_CURL_NTLM_CORE
# endif # endif
@ -819,8 +816,8 @@
/* fallthrough attribute */ /* fallthrough attribute */
#ifndef FALLTHROUGH #ifndef FALLTHROUGH
#if (defined(__GNUC__) && __GNUC__ >= 7) || \ #if (defined(__GNUC__) && __GNUC__ >= 7) || \
(defined(__clang__) && __clang_major__ >= 10) (defined(__clang__) && __clang_major__ >= 10)
# define FALLTHROUGH() __attribute__((fallthrough)) # define FALLTHROUGH() __attribute__((fallthrough))
#else #else
# define FALLTHROUGH() do {} while(0) # define FALLTHROUGH() do {} while(0)
@ -1015,7 +1012,7 @@ struct timeval {
* 'bool' stuff compatible with HP-UX headers. * 'bool' stuff compatible with HP-UX headers.
*/ */
#if defined(__hpux) && !defined(HAVE_BOOL_T) #if defined(__hpux) && !defined(HAVE_BOOL_T)
typedef int bool; typedef int bool;
# define false 0 # define false 0
# define true 1 # define true 1
# define HAVE_BOOL_T # define HAVE_BOOL_T
@ -1028,10 +1025,10 @@ struct timeval {
* global namespace though, so use bool_false and bool_true. * global namespace though, so use bool_false and bool_true.
*/ */
#ifndef HAVE_BOOL_T #ifndef HAVE_BOOL_T
typedef enum { typedef enum {
bool_false = 0, bool_false = 0,
bool_true = 1 bool_true = 1
} bool; } bool;
/* /*
* Use a define to let 'true' and 'false' use those enums. There * Use a define to let 'true' and 'false' use those enums. There

View file

@ -203,7 +203,7 @@ static CURLcode Curl_sha512_256_update(void *ctx,
size_t length) size_t length)
{ {
do { do {
word32 ilen = (word32) CURLMIN(length, UINT_MAX); word32 ilen = (word32)CURLMIN(length, UINT_MAX);
if(wc_Sha512_256Update(ctx, data, ilen)) if(wc_Sha512_256Update(ctx, data, ilen))
return CURLE_SSL_CIPHER; return CURLE_SSL_CIPHER;
length -= ilen; length -= ilen;
@ -291,10 +291,7 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context)
/* ** This implementation of SHA-512/256 hash calculation was originally ** * /* ** This implementation of SHA-512/256 hash calculation was originally ** *
* ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** * * ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** *
* ** The author ported the code to libcurl. The ported code is provided ** * * ** The author ported the code to libcurl. The ported code is provided ** *
* ** under curl license. ** * * ** under curl license. ** */
* ** This is a minimal version with minimal optimizations. Performance ** *
* ** can be significantly improved. Big-endian store and load macros ** *
* ** are obvious targets for optimization. ** */
#ifdef __GNUC__ #ifdef __GNUC__
# if defined(__has_attribute) && defined(__STDC_VERSION__) # if defined(__has_attribute) && defined(__STDC_VERSION__)

View file

@ -47,8 +47,8 @@ static void *curl_thread_create_thunk(void *arg)
return 0; return 0;
} }
curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T curl_thread_t Curl_thread_create(
(CURL_STDCALL *func) (void *), void *arg) CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg)
{ {
curl_thread_t t = curlx_malloc(sizeof(pthread_t)); curl_thread_t t = curlx_malloc(sizeof(pthread_t));
struct Curl_actual_call *ac = NULL; struct Curl_actual_call *ac = NULL;
@ -97,8 +97,8 @@ int Curl_thread_join(curl_thread_t *hnd)
#elif defined(_WIN32) #elif defined(_WIN32)
curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T curl_thread_t Curl_thread_create(
(CURL_STDCALL *func) (void *), void *arg) CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg)
{ {
curl_thread_t t = CreateThread(NULL, 0, func, arg, 0, NULL); curl_thread_t t = CreateThread(NULL, 0, func, arg, 0, NULL);
if(!t) { if(!t) {
@ -163,13 +163,13 @@ CURLcode Curl_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m,
* that will be most likely in the past, as far as POSIX abstime is * that will be most likely in the past, as far as POSIX abstime is
* concerned. */ * concerned. */
#ifdef HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
struct timeval tv; struct timeval tv;
(void)gettimeofday(&tv, NULL); (void)gettimeofday(&tv, NULL);
now.tv_sec = tv.tv_sec; now.tv_sec = tv.tv_sec;
now.tv_usec = (int)tv.tv_usec; now.tv_usec = (int)tv.tv_usec;
#else #else
now.tv_sec = time(NULL); now.tv_sec = time(NULL);
now.tv_usec = 0; now.tv_usec = 0;
#endif #endif
ts.tv_sec = now.tv_sec + (timeout_ms / 1000); ts.tv_sec = now.tv_sec + (timeout_ms / 1000);

View file

@ -65,8 +65,8 @@ CURLcode Curl_cond_timedwait(curl_cond_t *c, curl_mutex_t *m,
#ifdef USE_THREADS #ifdef USE_THREADS
curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T curl_thread_t Curl_thread_create(
(CURL_STDCALL *func) (void *), void *arg); CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg);
void Curl_thread_destroy(curl_thread_t *hnd); void Curl_thread_destroy(curl_thread_t *hnd);

View file

@ -64,7 +64,6 @@
#define DICT_DEFINE2 "/D:" #define DICT_DEFINE2 "/D:"
#define DICT_DEFINE3 "/LOOKUP:" #define DICT_DEFINE3 "/LOOKUP:"
#define DYN_DICT_WORD 10000 #define DYN_DICT_WORD 10000
static char *unescape_word(const char *input) static char *unescape_word(const char *input)
{ {

View file

@ -329,8 +329,6 @@ static int num_addresses(const struct Curl_addrinfo *addr)
return i; return i;
} }
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
struct Curl_addrinfo **addr);
/* /*
* Curl_shuffle_addr() shuffles the order of addresses in a 'Curl_addrinfo' * Curl_shuffle_addr() shuffles the order of addresses in a 'Curl_addrinfo'
* struct by re-linking its linked list. * struct by re-linking its linked list.
@ -343,6 +341,8 @@ UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
* *
* @unittest: 1608 * @unittest: 1608
*/ */
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
struct Curl_addrinfo **addr);
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data, UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
struct Curl_addrinfo **addr) struct Curl_addrinfo **addr)
{ {
@ -407,15 +407,15 @@ static bool dnscache_ai_has_family(struct Curl_addrinfo *ai,
return FALSE; return FALSE;
} }
static struct Curl_dns_entry * static struct Curl_dns_entry *dnscache_entry_create(
dnscache_entry_create(struct Curl_easy *data, struct Curl_easy *data,
uint8_t dns_queries, uint8_t dns_queries,
struct Curl_addrinfo **paddr1, struct Curl_addrinfo **paddr1,
struct Curl_addrinfo **paddr2, struct Curl_addrinfo **paddr2,
const char *hostname, const char *hostname,
size_t hostlen, size_t hostlen,
uint16_t port, uint16_t port,
bool permanent) bool permanent)
{ {
struct Curl_dns_entry *dns = NULL; struct Curl_dns_entry *dns = NULL;
@ -488,25 +488,23 @@ out:
return dns; return dns;
} }
struct Curl_dns_entry * struct Curl_dns_entry *Curl_dnscache_mk_entry(struct Curl_easy *data,
Curl_dnscache_mk_entry(struct Curl_easy *data, uint8_t dns_queries,
uint8_t dns_queries, struct Curl_addrinfo **paddr,
struct Curl_addrinfo **paddr, const char *hostname,
const char *hostname, uint16_t port)
uint16_t port)
{ {
return dnscache_entry_create(data, dns_queries, paddr, NULL, hostname, return dnscache_entry_create(data, dns_queries, paddr, NULL, hostname,
hostname ? strlen(hostname) : 0, hostname ? strlen(hostname) : 0,
port, FALSE); port, FALSE);
} }
struct Curl_dns_entry * struct Curl_dns_entry *Curl_dnscache_mk_entry2(struct Curl_easy *data,
Curl_dnscache_mk_entry2(struct Curl_easy *data, uint8_t dns_queries,
uint8_t dns_queries, struct Curl_addrinfo **paddr1,
struct Curl_addrinfo **paddr1, struct Curl_addrinfo **paddr2,
struct Curl_addrinfo **paddr2, const char *hostname,
const char *hostname, uint16_t port)
uint16_t port)
{ {
return dnscache_entry_create(data, dns_queries, paddr1, paddr2, hostname, return dnscache_entry_create(data, dns_queries, paddr1, paddr2, hostname,
hostname ? strlen(hostname) : 0, hostname ? strlen(hostname) : 0,
@ -530,15 +528,14 @@ void Curl_dns_entry_set_https_rr(struct Curl_dns_entry *dns,
} }
#endif /* USE_HTTPSRR */ #endif /* USE_HTTPSRR */
static struct Curl_dns_entry * static struct Curl_dns_entry *dnscache_add_addr(struct Curl_easy *data,
dnscache_add_addr(struct Curl_easy *data, struct Curl_dnscache *dnscache,
struct Curl_dnscache *dnscache, uint8_t dns_queries,
uint8_t dns_queries, struct Curl_addrinfo **paddr,
struct Curl_addrinfo **paddr, const char *hostname,
const char *hostname, size_t hlen,
size_t hlen, uint16_t port,
uint16_t port, bool permanent)
bool permanent)
{ {
char entry_id[MAX_HOSTCACHE_LEN]; char entry_id[MAX_HOSTCACHE_LEN];
size_t entry_len; size_t entry_len;

View file

@ -57,25 +57,23 @@ struct Curl_dns_entry {
* Create a `Curl_dns_entry` with a reference count of 1. * Create a `Curl_dns_entry` with a reference count of 1.
* Use `Curl_dns_entry_unlink()` to release your hold on it. * Use `Curl_dns_entry_unlink()` to release your hold on it.
* *
* The call takes ownership of `addr`, even in case of failure, and always * The call takes ownership of `paddr`, even in case of failure, and always
* clears `*paddr`. It makes a copy of `hostname`. * clears `*paddr`. It makes a copy of `hostname`.
* *
* Returns entry or NULL on OOM. * Returns entry or NULL on OOM.
*/ */
struct Curl_dns_entry * struct Curl_dns_entry *Curl_dnscache_mk_entry(struct Curl_easy *data,
Curl_dnscache_mk_entry(struct Curl_easy *data, uint8_t dns_queries,
uint8_t dns_queries, struct Curl_addrinfo **paddr,
struct Curl_addrinfo **paddr, const char *hostname,
const char *hostname, uint16_t port);
uint16_t port);
struct Curl_dns_entry * struct Curl_dns_entry *Curl_dnscache_mk_entry2(struct Curl_easy *data,
Curl_dnscache_mk_entry2(struct Curl_easy *data, uint8_t dns_queries,
uint8_t dns_queries, struct Curl_addrinfo **paddr1,
struct Curl_addrinfo **paddr1, struct Curl_addrinfo **paddr2,
struct Curl_addrinfo **paddr2, const char *hostname,
const char *hostname, uint16_t port);
uint16_t port);
#ifdef USE_HTTPSRR #ifdef USE_HTTPSRR
void Curl_dns_entry_set_https_rr(struct Curl_dns_entry *dns, void Curl_dns_entry_set_https_rr(struct Curl_dns_entry *dns,
@ -92,7 +90,6 @@ struct Curl_dns_entry *Curl_dns_entry_link(struct Curl_easy *data,
void Curl_dns_entry_unlink(struct Curl_easy *data, void Curl_dns_entry_unlink(struct Curl_easy *data,
struct Curl_dns_entry **pdns); struct Curl_dns_entry **pdns);
struct Curl_dnscache { struct Curl_dnscache {
struct Curl_hash entries; struct Curl_hash entries;
}; };

View file

@ -714,7 +714,7 @@ static DOHcode doh_rdata(const unsigned char *doh,
return DOH_OK; return DOH_OK;
} }
UNITTEST void de_init(struct dohentry *d); UNITTEST void de_init(struct dohentry *de);
UNITTEST void de_init(struct dohentry *de) UNITTEST void de_init(struct dohentry *de)
{ {
int i; int i;
@ -1117,11 +1117,10 @@ static CURLcode doh_decode_rdata_name(const unsigned char **buf,
return CURLE_OK; return CURLE_OK;
} }
/* @unittest 1658 */
UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data, UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data,
const unsigned char *cp, size_t len, const unsigned char *cp, size_t len,
struct Curl_https_rrinfo **hrr); struct Curl_https_rrinfo **hrr);
/* @unittest 1658 */
UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data, UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data,
const unsigned char *cp, size_t len, const unsigned char *cp, size_t len,
struct Curl_https_rrinfo **hrr) struct Curl_https_rrinfo **hrr)

View file

@ -49,8 +49,8 @@
__has_builtin() function, so override it. */ __has_builtin() function, so override it. */
/* if GCC on i386/x86_64 or if the built-in is present */ /* if GCC on i386/x86_64 or if the built-in is present */
#if (defined(__GNUC__) && !defined(__clang__)) && \ #if (defined(__GNUC__) && !defined(__clang__)) && \
(defined(__i386__) || defined(__x86_64__)) (defined(__i386__) || defined(__x86_64__))
#define HAVE_BUILTIN_IA32_PAUSE #define HAVE_BUILTIN_IA32_PAUSE
#elif defined(__has_builtin) /* Keep this PP check separate from others */ #elif defined(__has_builtin) /* Keep this PP check separate from others */
#if __has_builtin(__builtin_ia32_pause) #if __has_builtin(__builtin_ia32_pause)

View file

@ -62,8 +62,8 @@ const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
} }
/* Iterates over available options */ /* Iterates over available options */
const struct curl_easyoption * const struct curl_easyoption *curl_easy_option_next(
curl_easy_option_next(const struct curl_easyoption *prev) const struct curl_easyoption *prev)
{ {
if(prev && prev->name) { if(prev && prev->name) {
prev++; prev++;
@ -88,8 +88,8 @@ const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
return NULL; return NULL;
} }
const struct curl_easyoption * const struct curl_easyoption *curl_easy_option_next(
curl_easy_option_next(const struct curl_easyoption *prev) const struct curl_easyoption *prev)
{ {
(void)prev; (void)prev;
return NULL; return NULL;

View file

@ -307,7 +307,7 @@ static CURLcode ftp_parse_url_path(struct Curl_easy *data,
ftpc->file = fileName; ftpc->file = fileName;
else else
ftpc->file = NULL; /* instead of point to a zero byte, ftpc->file = NULL; /* instead of point to a zero byte,
we make it a NULL pointer */ we make it a NULL pointer */
if(data->state.upload && !ftpc->file && (ftp->transfer == PPTRANSFER_BODY)) { if(data->state.upload && !ftpc->file && (ftp->transfer == PPTRANSFER_BODY)) {
/* We need a filename when uploading. Return error! */ /* We need a filename when uploading. Return error! */
@ -1686,17 +1686,17 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
if((data->state.resume_from && !sizechecked) || if((data->state.resume_from && !sizechecked) ||
((data->state.resume_from > 0) && sizechecked)) { ((data->state.resume_from > 0) && sizechecked)) {
/* we are about to continue the uploading of a file */ /* we are about to continue the uploading of a file
/* 1. get already existing file's size. We use the SIZE command for this 1. get already existing file's size. We use the SIZE command for this
which may not exist in the server! The SIZE command is not in which may not exist in the server! The SIZE command is not in
RFC959. */ RFC959.
/* 2. This used to set REST, but since we can do append, we issue no 2. This used to set REST, but since we can do append, we issue no
another ftp command. Skip the source file offset and APPEND the rest on another ftp command. Skip the source file offset and APPEND the rest
the file instead */ on the file instead
/* 3. pass file-size number of bytes in the source file */ 3. pass file-size number of bytes in the source file
/* 4. lower the infilesize counter */ 4. lower the infilesize counter */
/* => transfer as usual */ /* => transfer as usual */
int seekerr = CURL_SEEKFUNC_OK; int seekerr = CURL_SEEKFUNC_OK;
@ -2507,7 +2507,6 @@ static bool twodigit(const char *p, int *val)
/* /*
* Unittest @1668 * Unittest @1668
*/ */
UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day, UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day,
int *hour, int *minute, int *second); int *hour, int *minute, int *second);
UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day, UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day,
@ -3888,12 +3887,12 @@ static CURLcode ftp_nb_type(struct Curl_easy *data,
* This is the actual DO function for FTP. Get a file/directory according to * This is the actual DO function for FTP. Get a file/directory according to
* the options previously setup. * the options previously setup.
*/ */
static static CURLcode ftp_perform(
CURLcode ftp_perform(struct Curl_easy *data, struct Curl_easy *data,
struct ftp_conn *ftpc, struct ftp_conn *ftpc,
struct FTP *ftp, struct FTP *ftp,
bool *connected, /* connect status after PASV / PORT */ bool *connected, /* connect status after PASV / PORT */
bool *dophase_done) bool *dophase_done)
{ {
/* this is FTP and no proxy */ /* this is FTP and no proxy */
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;

View file

@ -325,8 +325,7 @@ static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data,
/* filter pattern-corresponding filenames */ /* filter pattern-corresponding filenames */
Curl_set_in_callback(data, TRUE); Curl_set_in_callback(data, TRUE);
if(compare(data->set.fnmatch_data, wc->pattern, if(compare(data->set.fnmatch_data, wc->pattern, finfo->filename) == 0) {
finfo->filename) == 0) {
/* discard symlink which is containing multiple " -> " */ /* discard symlink which is containing multiple " -> " */
if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target && if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target &&
(strstr(finfo->strings.target, " -> "))) { (strstr(finfo->strings.target, " -> "))) {

View file

@ -359,8 +359,8 @@ void Curl_hash_start_iterate(struct Curl_hash *hash,
#endif #endif
} }
struct Curl_hash_element * struct Curl_hash_element *Curl_hash_next_element(
Curl_hash_next_element(struct Curl_hash_iterator *iter) struct Curl_hash_iterator *iter)
{ {
struct Curl_hash *h; struct Curl_hash *h;
DEBUGASSERT(iter->init == ITERINIT); DEBUGASSERT(iter->init == ITERINIT);

View file

@ -97,8 +97,8 @@ size_t curlx_str_key_compare(void *k1, size_t key1_len, void *k2,
size_t key2_len); size_t key2_len);
void Curl_hash_start_iterate(struct Curl_hash *hash, void Curl_hash_start_iterate(struct Curl_hash *hash,
struct Curl_hash_iterator *iter); struct Curl_hash_iterator *iter);
struct Curl_hash_element * struct Curl_hash_element *Curl_hash_next_element(
Curl_hash_next_element(struct Curl_hash_iterator *iter); struct Curl_hash_iterator *iter);
void Curl_hash_print(struct Curl_hash *h, void (*func)(void *)); void Curl_hash_print(struct Curl_hash *h, void (*func)(void *));

View file

@ -25,8 +25,8 @@
***************************************************************************/ ***************************************************************************/
#include "curl_setup.h" #include "curl_setup.h"
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \ #if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \
!defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \ !defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \
defined(USE_SSL) defined(USE_SSL)
#include "curl_hmac.h" #include "curl_hmac.h"
@ -155,7 +155,7 @@ CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
/* Update the digest with the given challenge */ /* Update the digest with the given challenge */
do { do {
unsigned int ilen = (unsigned int) CURLMIN(datalen, UINT_MAX); unsigned int ilen = (unsigned int)CURLMIN(datalen, UINT_MAX);
Curl_HMAC_update(ctxt, data, ilen); Curl_HMAC_update(ctxt, data, ilen);
datalen -= ilen; datalen -= ilen;
data += ilen; data += ilen;

View file

@ -111,14 +111,6 @@
* CURLRES_* defines based on the config*.h and curl_setup.h defines. * CURLRES_* defines based on the config*.h and curl_setup.h defines.
*/ */
/*
* Curl_printable_address() stores a printable version of the 1st address
* given in the 'ai' argument. The result will be stored in the buf that is
* bufsize bytes big.
*
* If the conversion fails, the target buffer is empty.
*/
uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version) uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version)
{ {
(void)data; (void)data;
@ -129,7 +121,7 @@ uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version)
return CURL_DNSQ_A; return CURL_DNSQ_A;
default: default:
if(Curl_ipv6works(data)) if(Curl_ipv6works(data))
return (CURL_DNSQ_A|CURL_DNSQ_AAAA); return (CURL_DNSQ_A | CURL_DNSQ_AAAA);
else else
return CURL_DNSQ_A; return CURL_DNSQ_A;
} }
@ -139,15 +131,15 @@ uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version)
const char *Curl_resolv_query_str(uint8_t dns_queries) const char *Curl_resolv_query_str(uint8_t dns_queries)
{ {
switch(dns_queries) { switch(dns_queries) {
case (CURL_DNSQ_A|CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS): case (CURL_DNSQ_A | CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS):
return "A+AAAA+HTTPS"; return "A+AAAA+HTTPS";
case (CURL_DNSQ_A|CURL_DNSQ_AAAA): case (CURL_DNSQ_A | CURL_DNSQ_AAAA):
return "A+AAAA"; return "A+AAAA";
case (CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS): case (CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS):
return "AAAA+HTTPS"; return "AAAA+HTTPS";
case (CURL_DNSQ_AAAA): case (CURL_DNSQ_AAAA):
return "AAAA"; return "AAAA";
case (CURL_DNSQ_A|CURL_DNSQ_HTTPS): case (CURL_DNSQ_A | CURL_DNSQ_HTTPS):
return "A+HTTPS"; return "A+HTTPS";
case (CURL_DNSQ_A): case (CURL_DNSQ_A):
return "A"; return "A";
@ -162,6 +154,13 @@ const char *Curl_resolv_query_str(uint8_t dns_queries)
} }
#endif #endif
/*
* Curl_printable_address() stores a printable version of the 1st address
* given in the 'ai' argument. The result will be stored in the buf that is
* bufsize bytes big.
*
* If the conversion fails, the target buffer is empty.
*/
void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf,
size_t bufsize) size_t bufsize)
{ {
@ -360,13 +359,12 @@ CURLcode Curl_resolv_announce_start(struct Curl_easy *data,
} }
#ifdef USE_CURL_ASYNC #ifdef USE_CURL_ASYNC
static struct Curl_resolv_async * static struct Curl_resolv_async *hostip_async_new(struct Curl_easy *data,
hostip_async_new(struct Curl_easy *data, uint8_t dns_queries,
uint8_t dns_queries, const char *hostname,
const char *hostname, uint16_t port,
uint16_t port, uint8_t transport,
uint8_t transport, timediff_t timeout_ms)
timediff_t timeout_ms)
{ {
struct Curl_resolv_async *async; struct Curl_resolv_async *async;
size_t hostlen = strlen(hostname); size_t hostlen = strlen(hostname);
@ -442,9 +440,10 @@ static CURLcode hostip_resolv_take_result(struct Curl_easy *data,
return result; return result;
} }
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_resolv_get_ai(struct Curl_easy *data,
Curl_resolv_get_ai(struct Curl_easy *data, uint32_t resolv_id, uint32_t resolv_id,
int ai_family, unsigned int index) int ai_family,
unsigned int index)
{ {
#ifdef CURLRES_ASYNCH #ifdef CURLRES_ASYNCH
struct Curl_resolv_async *async = Curl_async_get(data, resolv_id); struct Curl_resolv_async *async = Curl_async_get(data, resolv_id);
@ -959,7 +958,6 @@ CURLcode Curl_resolv(struct Curl_easy *data,
timeout_ms, TRUE, presolv_id, entry); timeout_ms, TRUE, presolv_id, entry);
} }
#ifdef USE_CURL_ASYNC #ifdef USE_CURL_ASYNC
struct Curl_resolv_async *Curl_async_get(struct Curl_easy *data, struct Curl_resolv_async *Curl_async_get(struct Curl_easy *data,

View file

@ -51,8 +51,8 @@ struct Curl_dns_entry;
#define CURL_DNSQ_AAAA (1U << 1) #define CURL_DNSQ_AAAA (1U << 1)
#define CURL_DNSQ_HTTPS (1U << 2) #define CURL_DNSQ_HTTPS (1U << 2)
#define CURL_DNSQ_ALL (CURL_DNSQ_A|CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS) #define CURL_DNSQ_ALL (CURL_DNSQ_A | CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS)
#define CURL_DNSQ_IP(x) (uint8_t)((x)&(CURL_DNSQ_A|CURL_DNSQ_AAAA)) #define CURL_DNSQ_IP(x) (uint8_t)((x)&(CURL_DNSQ_A | CURL_DNSQ_AAAA))
#ifdef CURLVERBOSE #ifdef CURLVERBOSE
const char *Curl_resolv_query_str(uint8_t dns_queries); const char *Curl_resolv_query_str(uint8_t dns_queries);
@ -88,10 +88,10 @@ struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, uint16_t port);
/* /*
* Curl_printable_address() returns a printable version of the 1st address * Curl_printable_address() returns a printable version of the 1st address
* given in the 'ip' argument. The result will be stored in the buf that is * given in the 'ai' argument. The result will be stored in the buf that is
* bufsize bytes big. * bufsize bytes big.
*/ */
void Curl_printable_address(const struct Curl_addrinfo *ip, void Curl_printable_address(const struct Curl_addrinfo *ai,
char *buf, size_t bufsize); char *buf, size_t bufsize);
/* Start DNS resolving for the given parameters. Returns /* Start DNS resolving for the given parameters. Returns
@ -142,25 +142,26 @@ CURLcode Curl_resolv_take_result(struct Curl_easy *data, uint32_t resolv_id,
void Curl_resolv_destroy(struct Curl_easy *data, uint32_t resolv_id); void Curl_resolv_destroy(struct Curl_easy *data, uint32_t resolv_id);
const struct Curl_addrinfo * const struct Curl_addrinfo *Curl_resolv_get_ai(struct Curl_easy *data,
Curl_resolv_get_ai(struct Curl_easy *data, uint32_t resolv_id, uint32_t resolv_id,
int ai_family, unsigned int index); int ai_family,
unsigned int index);
#ifdef USE_HTTPSRR #ifdef USE_HTTPSRR
const struct Curl_https_rrinfo * const struct Curl_https_rrinfo *Curl_resolv_get_https(struct Curl_easy *data,
Curl_resolv_get_https(struct Curl_easy *data, uint32_t resolv_id); uint32_t resolv_id);
bool Curl_resolv_knows_https(struct Curl_easy *data, uint32_t resolv_id); bool Curl_resolv_knows_https(struct Curl_easy *data, uint32_t resolv_id);
#endif /* USE_HTTPSRR */ #endif /* USE_HTTPSRR */
#else /* USE_CURL_ASYNC */ #else /* !USE_CURL_ASYNC */
#define Curl_resolv_shutdown_all(x) Curl_nop_stmt #define Curl_resolv_shutdown_all(x) Curl_nop_stmt
#define Curl_resolv_destroy_all(x) Curl_nop_stmt #define Curl_resolv_destroy_all(x) Curl_nop_stmt
#define Curl_resolv_take_result(x, y, z) CURLE_NOT_BUILT_IN #define Curl_resolv_take_result(x, y, z) CURLE_NOT_BUILT_IN
#define Curl_resolv_get_ai(x,y,z, a) NULL #define Curl_resolv_get_ai(x, y, z, a) NULL
#define Curl_resolv_get_https(x,y) NULL #define Curl_resolv_get_https(x, y) NULL
#define Curl_resolv_knows_https(x,y) TRUE #define Curl_resolv_knows_https(x, y) TRUE
#define Curl_resolv_pollset(x,y) CURLE_OK #define Curl_resolv_pollset(x, y) CURLE_OK
#define Curl_resolv_destroy(x,y) Curl_nop_stmt #define Curl_resolv_destroy(x, y) Curl_nop_stmt
#endif /* USE_CURL_ASYNC, else */ #endif /* USE_CURL_ASYNC */
CURLcode Curl_resolver_error(struct Curl_easy *data, const char *detail); CURLcode Curl_resolver_error(struct Curl_easy *data, const char *detail);

View file

@ -88,7 +88,7 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data,
#endif /* CURLRES_IPV4 */ #endif /* CURLRES_IPV4 */
#if defined(CURLRES_IPV4) && !defined(USE_RESOLV_ARES) && \ #if defined(CURLRES_IPV4) && !defined(USE_RESOLV_ARES) && \
!defined(CURLRES_AMIGA) !defined(CURLRES_AMIGA)
/* /*
* Curl_ipv4_resolve_r() - ipv4 thread-safe resolver function. * Curl_ipv4_resolve_r() - ipv4 thread-safe resolver function.

View file

@ -472,53 +472,53 @@ static bool http_should_fail(struct Curl_easy *data, int httpcode)
DEBUGASSERT(data->conn); DEBUGASSERT(data->conn);
/* /*
** If we have not been asked to fail on error, * If we have not been asked to fail on error,
** do not fail. * do not fail.
*/ */
if(!data->set.http_fail_on_error) if(!data->set.http_fail_on_error)
return FALSE; return FALSE;
/* /*
** Any code < 400 is never terminal. * Any code < 400 is never terminal.
*/ */
if(httpcode < 400) if(httpcode < 400)
return FALSE; return FALSE;
/* /*
** A 416 response to a resume request is presumably because the file is * A 416 response to a resume request is presumably because the file is
** already completely downloaded and thus not actually a fail. * already completely downloaded and thus not actually a fail.
*/ */
if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET && if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET &&
httpcode == 416) httpcode == 416)
return FALSE; return FALSE;
/* /*
** Any code >= 400 that is not 401 or 407 is always * Any code >= 400 that is not 401 or 407 is always
** a terminal error * a terminal error
*/ */
if((httpcode != 401) && (httpcode != 407)) if((httpcode != 401) && (httpcode != 407))
return TRUE; return TRUE;
/* /*
** All we have left to deal with is 401 and 407 * All we have left to deal with is 401 and 407
*/ */
DEBUGASSERT((httpcode == 401) || (httpcode == 407)); DEBUGASSERT((httpcode == 401) || (httpcode == 407));
/* /*
** Examine the current authentication state to see if this is an error. The * Examine the current authentication state to see if this is an error. The
** idea is for this function to get called after processing all the headers * idea is for this function to get called after processing all the headers
** in a response message. If we have been to asked to authenticate * in a response message. If we have been to asked to authenticate
** a particular stage, and we have done it, we are OK. If we are already * a particular stage, and we have done it, we are OK. If we are already
** completely authenticated, it is not OK to get another 401 or 407. * completely authenticated, it is not OK to get another 401 or 407.
** *
** It is possible for authentication to go stale such that the client needs * It is possible for authentication to go stale such that the client needs
** to reauthenticate. Once that info is available, use it here. * to reauthenticate. Once that info is available, use it here.
*/ */
/* /*
** Either we are not authenticating, or we are supposed to be authenticating * Either we are not authenticating, or we are supposed to be authenticating
** something else. This is an error. * something else. This is an error.
*/ */
if((httpcode == 401) && !data->state.aptr.user) if((httpcode == 401) && !data->state.aptr.user)
return TRUE; return TRUE;
#ifndef CURL_DISABLE_PROXY #ifndef CURL_DISABLE_PROXY
@ -766,14 +766,14 @@ static CURLcode output_auth_headers(struct Curl_easy *data,
* *
* @returns CURLcode * @returns CURLcode
*/ */
CURLcode CURLcode Curl_http_output_auth(struct Curl_easy *data,
Curl_http_output_auth(struct Curl_easy *data, struct connectdata *conn,
struct connectdata *conn, const char *request,
const char *request, Curl_HttpReq httpreq,
Curl_HttpReq httpreq, const char *path,
const char *path, bool proxytunnel) /* TRUE if this is
bool proxytunnel) /* TRUE if this is the request setting the request setting up
up the proxy tunnel */ the proxy tunnel */
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
struct auth *authhost; struct auth *authhost;
@ -1506,7 +1506,7 @@ static CURLcode cr_exp100_read(struct Curl_easy *data,
/* We are now waiting for a reply from the server or /* We are now waiting for a reply from the server or
* a timeout on our side IFF the request has been fully sent. */ * a timeout on our side IFF the request has been fully sent. */
DEBUGF(infof(data, "cr_exp100_read, start AWAITING_CONTINUE, " DEBUGF(infof(data, "cr_exp100_read, start AWAITING_CONTINUE, "
"timeout %dms", data->set.expect_100_timeout)); "timeout %dms", data->set.expect_100_timeout));
ctx->state = EXP100_AWAITING_CONTINUE; ctx->state = EXP100_AWAITING_CONTINUE;
ctx->start = *Curl_pgrs_now(data); ctx->start = *Curl_pgrs_now(data);
Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT); Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT);
@ -4024,7 +4024,7 @@ static void http_check_auth_closure(struct Curl_easy *data,
#endif #endif
} }
#else #else
#define http_check_auth_closure(x,y) /* empty */ #define http_check_auth_closure(x, y) /* empty */
#endif #endif
/* /*
@ -4603,7 +4603,7 @@ CURLcode Curl_http_write_resp_hd(struct Curl_easy *data,
result = http_rw_hd(data, hd, hdlen, &tmp, 0, &consumed); result = http_rw_hd(data, hd, hdlen, &tmp, 0, &consumed);
if(!result && is_eos) { if(!result && is_eos) {
result = Curl_client_write(data, (CLIENTWRITE_BODY|CLIENTWRITE_EOS), result = Curl_client_write(data, (CLIENTWRITE_BODY | CLIENTWRITE_EOS),
&tmp, 0); &tmp, 0);
} }
return result; return result;

View file

@ -185,14 +185,14 @@ CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
* *
* @returns CURLcode * @returns CURLcode
*/ */
CURLcode CURLcode Curl_http_output_auth(struct Curl_easy *data,
Curl_http_output_auth(struct Curl_easy *data, struct connectdata *conn,
struct connectdata *conn, const char *request,
const char *request, Curl_HttpReq httpreq,
Curl_HttpReq httpreq, const char *path,
const char *path, bool proxytunnel); /* TRUE if this is
bool proxytunnel); /* TRUE if this is the request setting the request setting up
up the proxy tunnel */ the proxy tunnel */
/* Decode HTTP status code string. */ /* Decode HTTP status code string. */
CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len); CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len);

View file

@ -1734,8 +1734,8 @@ static CURLcode http2_handle_stream_close(struct Curl_cfilter *cf,
break; break;
curlx_dyn_reset(&dbuf); curlx_dyn_reset(&dbuf);
result = curlx_dyn_addf(&dbuf, "%.*s: %.*s\x0d\x0a", result = curlx_dyn_addf(&dbuf, "%.*s: %.*s\x0d\x0a",
(int)e->namelen, e->name, (int)e->namelen, e->name,
(int)e->valuelen, e->value); (int)e->valuelen, e->value);
if(result) if(result)
break; break;
Curl_debug(data, CURLINFO_HEADER_IN, curlx_dyn_ptr(&dbuf), Curl_debug(data, CURLINFO_HEADER_IN, curlx_dyn_ptr(&dbuf),

View file

@ -680,7 +680,8 @@ static int compare_func(const void *a, const void *b)
} }
UNITTEST CURLcode canon_path(const char *q, size_t len, UNITTEST CURLcode canon_path(const char *q, size_t len,
struct dynbuf *new_path, bool normalize); struct dynbuf *new_path,
bool do_uri_encode);
UNITTEST CURLcode canon_path(const char *q, size_t len, UNITTEST CURLcode canon_path(const char *q, size_t len,
struct dynbuf *new_path, struct dynbuf *new_path,
bool do_uri_encode) bool do_uri_encode)

View file

@ -258,12 +258,12 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
size_t trlen = curlx_dyn_len(&ch->trailer); size_t trlen = curlx_dyn_len(&ch->trailer);
if(cw_next) if(cw_next)
result = Curl_cwriter_write(data, cw_next, result = Curl_cwriter_write(data, cw_next,
CLIENTWRITE_HEADER| CLIENTWRITE_HEADER |
CLIENTWRITE_TRAILER, CLIENTWRITE_TRAILER,
tr, trlen); tr, trlen);
else else
result = Curl_client_write(data, result = Curl_client_write(data,
CLIENTWRITE_HEADER| CLIENTWRITE_HEADER |
CLIENTWRITE_TRAILER, CLIENTWRITE_TRAILER,
tr, trlen); tr, trlen);
if(result) { if(result) {

View file

@ -135,7 +135,7 @@ void Curl_httpsrr_trace(struct Curl_easy *data,
} }
#else #else
#define httpsrr_report_addr(a,b,c,d) Curl_nop_stmt #define httpsrr_report_addr(a, b, c, d) Curl_nop_stmt
#endif /* CURLVERBOSE */ #endif /* CURLVERBOSE */
CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi, CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi,
@ -194,8 +194,8 @@ CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi,
return result; return result;
} }
struct Curl_https_rrinfo * struct Curl_https_rrinfo *Curl_httpsrr_dup_move(
Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo) struct Curl_https_rrinfo *rrinfo)
{ {
struct Curl_https_rrinfo *dup = curlx_memdup(rrinfo, sizeof(*rrinfo)); struct Curl_https_rrinfo *dup = curlx_memdup(rrinfo, sizeof(*rrinfo));
if(dup) if(dup)

View file

@ -62,8 +62,8 @@ struct Curl_https_rrinfo {
CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi, CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi,
uint16_t rrkey, const uint8_t *val, size_t vlen); uint16_t rrkey, const uint8_t *val, size_t vlen);
struct Curl_https_rrinfo * struct Curl_https_rrinfo *Curl_httpsrr_dup_move(
Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo); struct Curl_https_rrinfo *rrinfo);
void Curl_httpsrr_cleanup(struct Curl_https_rrinfo *rrinfo); void Curl_httpsrr_cleanup(struct Curl_https_rrinfo *rrinfo);
@ -87,7 +87,7 @@ CURLcode Curl_httpsrr_from_ares(const ares_dns_record_t *dnsrec,
void Curl_httpsrr_trace(struct Curl_easy *data, void Curl_httpsrr_trace(struct Curl_easy *data,
struct Curl_https_rrinfo *hi); struct Curl_https_rrinfo *hi);
#else #else
#define Curl_httpsrr_trace(a,b) Curl_nop_stmt #define Curl_httpsrr_trace(a, b) Curl_nop_stmt
#endif #endif
#endif /* USE_HTTPSRR */ #endif /* USE_HTTPSRR */

View file

@ -33,10 +33,10 @@
#include <idn2.h> #include <idn2.h>
#if defined(_WIN32) && defined(UNICODE) #if defined(_WIN32) && defined(UNICODE)
#define IDN2_LOOKUP(name, host, flags) \ #define IDN2_LOOKUP(name, host, flags) \
idn2_lookup_u8((const uint8_t *)name, (uint8_t **)host, flags) idn2_lookup_u8((const uint8_t *)name, (uint8_t **)host, flags)
#else #else
#define IDN2_LOOKUP(name, host, flags) \ #define IDN2_LOOKUP(name, host, flags) \
idn2_lookup_ul((const char *)(name), (char **)(host), flags) idn2_lookup_ul((const char *)(name), (char **)(host), flags)
#endif #endif
#endif /* USE_LIBIDN2 */ #endif /* USE_LIBIDN2 */

View file

@ -33,7 +33,7 @@
/* OpenSSL 3.0.0 marks the MD4 functions as deprecated */ /* OpenSSL 3.0.0 marks the MD4 functions as deprecated */
#define OPENSSL_NO_MD4 #define OPENSSL_NO_MD4
#else #else
/* Cover also OPENSSL_NO_MD4 configured in openssl */ /* Cover also OPENSSL_NO_MD4 configured in OpenSSL */
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#endif #endif
#endif /* USE_OPENSSL */ #endif /* USE_OPENSSL */

View file

@ -548,7 +548,7 @@ CURLcode Curl_md5it(unsigned char *output,
result = my_md5_init(&ctx); result = my_md5_init(&ctx);
if(!result) { if(!result) {
do { do {
unsigned int ilen = (unsigned int) CURLMIN(len, UINT_MAX); unsigned int ilen = (unsigned int)CURLMIN(len, UINT_MAX);
my_md5_update(&ctx, input, ilen); my_md5_update(&ctx, input, ilen);
input += ilen; input += ilen;
len -= ilen; len -= ilen;

View file

@ -1937,7 +1937,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data,
case 0: case 0:
if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) { if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) {
failf(data, "client mime read EOF fail, " failf(data, "client mime read EOF fail, "
"only %"FMT_OFF_T"/%"FMT_OFF_T "only %" FMT_OFF_T "/%" FMT_OFF_T
" of needed bytes read", ctx->read_len, ctx->total_len); " of needed bytes read", ctx->read_len, ctx->total_len);
return CURLE_READ_ERROR; return CURLE_READ_ERROR;
} }
@ -1992,7 +1992,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data,
} }
CURL_TRC_READ(data, "cr_mime_read(len=%zu, total=%" FMT_OFF_T CURL_TRC_READ(data, "cr_mime_read(len=%zu, total=%" FMT_OFF_T
", read=%"FMT_OFF_T") -> %d, %zu, %d", ", read=%" FMT_OFF_T ") -> %d, %zu, %d",
blen, ctx->total_len, ctx->read_len, result, *pnread, *peos); blen, ctx->total_len, ctx->read_len, result, *pnread, *peos);
return result; return result;
} }

View file

@ -39,11 +39,11 @@ const unsigned char Curl_ldigits[] = "0123456789abcdef";
/* Upper-case digits. */ /* Upper-case digits. */
const unsigned char Curl_udigits[] = "0123456789ABCDEF"; const unsigned char Curl_udigits[] = "0123456789ABCDEF";
#define OUTCHAR(x) \ #define OUTCHAR(x) \
do { \ do { \
if(stream((unsigned char)(x), userp)) \ if(stream((unsigned char)(x), userp)) \
return TRUE; \ return TRUE; \
(*donep)++; \ (*donep)++; \
} while(0) } while(0)
/* Data type to read from the arglist */ /* Data type to read from the arglist */

View file

@ -74,7 +74,6 @@
#define CURL_MULTI_HANDLE 0x000bab1e #define CURL_MULTI_HANDLE 0x000bab1e
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
/* On a debug build, we want to fail hard on multi handles that /* On a debug build, we want to fail hard on multi handles that
* are not NULL, but no longer have the MAGIC touch. This gives * are not NULL, but no longer have the MAGIC touch. This gives

View file

@ -361,7 +361,6 @@ void Curl_pgrs_deliver_inc(struct Curl_easy *data, size_t delta)
data->progress.deliver += delta; data->progress.deliver += delta;
} }
void Curl_pgrs_download_inc(struct Curl_easy *data, size_t delta) void Curl_pgrs_download_inc(struct Curl_easy *data, size_t delta)
{ {
if(delta) { if(delta) {

View file

@ -322,8 +322,7 @@ const struct Curl_scheme Curl_scheme_smb = {
const struct Curl_scheme Curl_scheme_smbs = { const struct Curl_scheme Curl_scheme_smbs = {
"smbs", /* scheme */ "smbs", /* scheme */
#if defined(CURL_ENABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \ #if defined(CURL_ENABLE_SMB) && defined(USE_CURL_NTLM_CORE) && defined(USE_SSL)
defined(USE_SSL)
&Curl_protocol_smb, &Curl_protocol_smb,
#else #else
ZERO_NULL, ZERO_NULL,
@ -405,7 +404,7 @@ const struct Curl_scheme Curl_scheme_ws = {
const struct Curl_scheme Curl_scheme_wss = { const struct Curl_scheme Curl_scheme_wss = {
"wss", /* scheme */ "wss", /* scheme */
#if defined(CURL_DISABLE_WEBSOCKETS) || defined(CURL_DISABLE_HTTP) || \ #if defined(CURL_DISABLE_WEBSOCKETS) || defined(CURL_DISABLE_HTTP) || \
!defined(USE_SSL) !defined(USE_SSL)
ZERO_NULL, ZERO_NULL,
#else #else
&Curl_protocol_ws, &Curl_protocol_ws,

View file

@ -38,16 +38,17 @@ struct UserDefined;
/* Low level request receive/send io_flags checks. */ /* Low level request receive/send io_flags checks. */
#define CURL_REQ_WANT_SEND(d) ((d)->req.io_flags & REQ_IO_SEND) #define CURL_REQ_WANT_SEND(d) ((d)->req.io_flags & REQ_IO_SEND)
#define CURL_REQ_WANT_RECV(d) ((d)->req.io_flags & REQ_IO_RECV) #define CURL_REQ_WANT_RECV(d) ((d)->req.io_flags & REQ_IO_RECV)
#define CURL_REQ_WANT_IO(d) ((d)->req.io_flags & (REQ_IO_RECV|REQ_IO_SEND)) #define CURL_REQ_WANT_IO(d) \
((d)->req.io_flags & (REQ_IO_RECV | REQ_IO_SEND))
/* Low level request receive/send io_flags manipulations. */ /* Low level request receive/send io_flags manipulations. */
#define CURL_REQ_SET_SEND(d) ((d)->req.io_flags |= REQ_IO_SEND) #define CURL_REQ_SET_SEND(d) ((d)->req.io_flags |= REQ_IO_SEND)
#define CURL_REQ_SET_RECV(d) ((d)->req.io_flags |= REQ_IO_RECV) #define CURL_REQ_SET_RECV(d) ((d)->req.io_flags |= REQ_IO_RECV)
#define CURL_REQ_CLEAR_SEND(d) \ #define CURL_REQ_CLEAR_SEND(d) \
((d)->req.io_flags &= (uint8_t)~REQ_IO_SEND) ((d)->req.io_flags &= (uint8_t)~REQ_IO_SEND)
#define CURL_REQ_CLEAR_RECV(d) \ #define CURL_REQ_CLEAR_RECV(d) \
((d)->req.io_flags &= (uint8_t)~REQ_IO_RECV) ((d)->req.io_flags &= (uint8_t)~REQ_IO_RECV)
#define CURL_REQ_CLEAR_IO(d) \ #define CURL_REQ_CLEAR_IO(d) \
((d)->req.io_flags &= (uint8_t)~(REQ_IO_RECV|REQ_IO_SEND)) ((d)->req.io_flags &= (uint8_t)~(REQ_IO_RECV | REQ_IO_SEND))
enum expect100 { enum expect100 {
EXP100_SEND_DATA, /* enough waiting, send the body now */ EXP100_SEND_DATA, /* enough waiting, send the body now */

View file

@ -234,7 +234,7 @@ static CURLcode rtsp_setup_body(struct Curl_easy *data,
/* As stated in the http comments, it is probably not wise to /* As stated in the http comments, it is probably not wise to
* actually set a custom Content-Length in the headers */ * actually set a custom Content-Length in the headers */
if(!Curl_checkheaders(data, STRCONST("Content-Length"))) { if(!Curl_checkheaders(data, STRCONST("Content-Length"))) {
result = curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T"\r\n", result = curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T "\r\n",
req_clen); req_clen);
if(result) if(result)
return result; return result;

View file

@ -274,7 +274,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
if(ufds[i].fd == CURL_SOCKET_BAD) if(ufds[i].fd == CURL_SOCKET_BAD)
continue; continue;
VERIFY_SOCK(ufds[i].fd); VERIFY_SOCK(ufds[i].fd);
if(ufds[i].events & (POLLIN |POLLOUT |POLLPRI | if(ufds[i].events & (POLLIN | POLLOUT | POLLPRI |
POLLRDNORM | POLLWRNORM | POLLRDBAND)) { POLLRDNORM | POLLWRNORM | POLLRDBAND)) {
if(ufds[i].fd > maxfd) if(ufds[i].fd > maxfd)
maxfd = ufds[i].fd; maxfd = ufds[i].fd;
@ -636,9 +636,9 @@ CURLcode Curl_pollset_set(struct Curl_easy *data,
bool do_in, bool do_out) bool do_in, bool do_out)
{ {
return Curl_pollset_change(data, ps, sock, return Curl_pollset_change(data, ps, sock,
(do_in ? CURL_POLL_IN : 0)| (do_in ? CURL_POLL_IN : 0) |
(do_out ? CURL_POLL_OUT : 0), (do_out ? CURL_POLL_OUT : 0),
(!do_in ? CURL_POLL_IN : 0)| (!do_in ? CURL_POLL_IN : 0) |
(!do_out ? CURL_POLL_OUT : 0)); (!do_out ? CURL_POLL_OUT : 0));
} }

View file

@ -35,9 +35,7 @@
* Definition of pollfd struct and constants for platforms lacking them. * Definition of pollfd struct and constants for platforms lacking them.
*/ */
#if !defined(HAVE_SYS_POLL_H) && \ #if !defined(HAVE_SYS_POLL_H) && !defined(HAVE_POLL_H) && !defined(POLLIN)
!defined(HAVE_POLL_H) && \
!defined(POLLIN)
#define POLLIN 0x01 #define POLLIN 0x01
#define POLLPRI 0x02 #define POLLPRI 0x02

View file

@ -372,8 +372,8 @@ static CURLcode do_init_writer_stack(struct Curl_easy *data)
The bit pattern defines to what "streams" to write to. Body and/or header. The bit pattern defines to what "streams" to write to. Body and/or header.
The defines are in sendf.h of course. The defines are in sendf.h of course.
*/ */
CURLcode Curl_client_write(struct Curl_easy *data, CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf,
int type, const char *buf, size_t len) size_t len)
{ {
CURLcode result; CURLcode result;
@ -675,7 +675,7 @@ static CURLcode cr_in_read(struct Curl_easy *data,
case 0: case 0:
if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) { if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) {
failf(data, "client read function EOF fail, " failf(data, "client read function EOF fail, "
"only %"FMT_OFF_T"/%"FMT_OFF_T " of needed bytes read", "only %" FMT_OFF_T "/%" FMT_OFF_T " of needed bytes read",
ctx->read_len, ctx->total_len); ctx->read_len, ctx->total_len);
result = CURLE_READ_ERROR; result = CURLE_READ_ERROR;
break; break;
@ -729,8 +729,8 @@ static CURLcode cr_in_read(struct Curl_easy *data,
*peos = (bool)ctx->seen_eos; *peos = (bool)ctx->seen_eos;
break; break;
} }
CURL_TRC_READ(data, "cr_in_read(len=%zu, total=%"FMT_OFF_T CURL_TRC_READ(data, "cr_in_read(len=%zu, total=%" FMT_OFF_T
", read=%"FMT_OFF_T") -> %d, nread=%zu, eos=%d", ", read=%" FMT_OFF_T ") -> %d, nread=%zu, eos=%d",
blen, ctx->total_len, ctx->read_len, result, blen, ctx->total_len, ctx->read_len, result,
*pnread, *peos); *pnread, *peos);
return result; return result;
@ -1138,7 +1138,7 @@ CURLcode Curl_creader_set_fread(struct Curl_easy *data, curl_off_t len)
cl_reset_reader(data); cl_reset_reader(data);
result = do_init_reader_stack(data, r); result = do_init_reader_stack(data, r);
out: out:
CURL_TRC_READ(data, "add fread reader, len=%"FMT_OFF_T " -> %d", CURL_TRC_READ(data, "add fread reader, len=%" FMT_OFF_T " -> %d",
len, result); len, result);
return result; return result;
} }

View file

@ -67,22 +67,22 @@ extern int Curl_getnameinfo_a(const struct sockaddr *sa,
/* GSSAPI wrappers. */ /* GSSAPI wrappers. */
extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status, extern OM_uint32 Curl_gss_import_name_a(OM_uint32 *minor_status,
gss_buffer_t in_name, gss_buffer_t in_name,
gss_OID in_name_type, gss_OID in_name_type,
gss_name_t * out_name); gss_name_t *out_name);
#define gss_import_name Curl_gss_import_name_a #define gss_import_name Curl_gss_import_name_a
extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status, extern OM_uint32 Curl_gss_display_status_a(OM_uint32 *minor_status,
OM_uint32 status_value, OM_uint32 status_value,
int status_type, gss_OID mech_type, int status_type, gss_OID mech_type,
gss_msg_ctx_t * message_context, gss_msg_ctx_t *message_context,
gss_buffer_t status_string); gss_buffer_t status_string);
#define gss_display_status Curl_gss_display_status_a #define gss_display_status Curl_gss_display_status_a
extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status, extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 *minor_status,
gss_cred_id_t cred_handle, gss_cred_id_t cred_handle,
gss_ctx_id_t * context_handle, gss_ctx_id_t *context_handle,
gss_name_t target_name, gss_name_t target_name,
gss_OID mech_type, gss_OID mech_type,
gss_flags_t req_flags, gss_flags_t req_flags,
@ -90,10 +90,10 @@ extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
gss_channel_bindings_t gss_channel_bindings_t
input_chan_bindings, input_chan_bindings,
gss_buffer_t input_token, gss_buffer_t input_token,
gss_OID * actual_mech_type, gss_OID *actual_mech_type,
gss_buffer_t output_token, gss_buffer_t output_token,
gss_flags_t * ret_flags, gss_flags_t *ret_flags,
OM_uint32 * time_rec); OM_uint32 *time_rec);
#define gss_init_sec_context Curl_gss_init_sec_context_a #define gss_init_sec_context Curl_gss_init_sec_context_a
extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 *minor_status, extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 *minor_status,

View file

@ -255,7 +255,7 @@ static void my_sha256_final(unsigned char *digest, void *in)
(a)[0] = (unsigned char)((((unsigned long)(val)) >> 24) & 0xff); \ (a)[0] = (unsigned char)((((unsigned long)(val)) >> 24) & 0xff); \
(a)[1] = (unsigned char)((((unsigned long)(val)) >> 16) & 0xff); \ (a)[1] = (unsigned char)((((unsigned long)(val)) >> 16) & 0xff); \
(a)[2] = (unsigned char)((((unsigned long)(val)) >> 8) & 0xff); \ (a)[2] = (unsigned char)((((unsigned long)(val)) >> 8) & 0xff); \
(a)[3] = (unsigned char) (((unsigned long)(val)) & 0xff); \ (a)[3] = (unsigned char)(((unsigned long)(val)) & 0xff); \
} while(0) } while(0)
#define WPA_PUT_BE64(a, val) \ #define WPA_PUT_BE64(a, val) \
@ -486,7 +486,7 @@ CURLcode Curl_sha256it(unsigned char *output, const unsigned char *input,
result = my_sha256_init(&ctx); result = my_sha256_init(&ctx);
if(!result) { if(!result) {
do { do {
unsigned int ilen = (unsigned int) CURLMIN(len, UINT_MAX); unsigned int ilen = (unsigned int)CURLMIN(len, UINT_MAX);
my_sha256_update(&ctx, input, ilen); my_sha256_update(&ctx, input, ilen);
len -= ilen; len -= ilen;
input += ilen; input += ilen;

View file

@ -37,7 +37,7 @@ int Curl_wakeup_signal(curl_socket_t socks[2]);
CURLcode Curl_wakeup_consume(curl_socket_t socks[2], bool all); CURLcode Curl_wakeup_consume(curl_socket_t socks[2], bool all);
#else #else
#define Curl_wakeup_destroy(x) Curl_nop_stmt #define Curl_wakeup_destroy(x) Curl_nop_stmt
#endif #endif
#endif /* HEADER_CURL_SOCKETPAIR_H */ #endif /* HEADER_CURL_SOCKETPAIR_H */

View file

@ -228,7 +228,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
if(gss_major_status != GSS_S_CONTINUE_NEEDED) if(gss_major_status != GSS_S_CONTINUE_NEEDED)
break; break;
/* analyse response */ /* analyze response */
/* GSS-API response looks like /* GSS-API response looks like
* +----+------+-----+----------------+ * +----+------+-----+----------------+

View file

@ -1266,9 +1266,9 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
/* We want to wait for both stdin and the socket. Since /* We want to wait for both stdin and the socket. Since
** the select() function in Winsock only works on sockets * the select() function in Winsock only works on sockets
** we have to use the WaitForMultipleObjects() call. * we have to use the WaitForMultipleObjects() call.
*/ */
/* First, create a sockets event object */ /* First, create a sockets event object */
event_handle = WSACreateEvent(); event_handle = WSACreateEvent();

View file

@ -30,9 +30,6 @@
#define CURL_UINT32_SPBSET_MAGIC 0x70737362 #define CURL_UINT32_SPBSET_MAGIC 0x70737362
#endif #endif
/* Clear the bitset, making it empty. */
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset);
void Curl_uint32_spbset_init(struct uint32_spbset *bset) void Curl_uint32_spbset_init(struct uint32_spbset *bset)
{ {
memset(bset, 0, sizeof(*bset)); memset(bset, 0, sizeof(*bset));
@ -41,6 +38,19 @@ void Curl_uint32_spbset_init(struct uint32_spbset *bset)
#endif #endif
} }
/* Clear the bitset, making it empty. */
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset);
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset)
{
struct uint32_spbset_chunk *next, *chunk;
for(chunk = bset->head.next; chunk; chunk = next) {
next = chunk->next;
curlx_free(chunk);
}
memset(&bset->head, 0, sizeof(bset->head));
}
void Curl_uint32_spbset_destroy(struct uint32_spbset *bset) void Curl_uint32_spbset_destroy(struct uint32_spbset *bset)
{ {
DEBUGASSERT(bset->init == CURL_UINT32_SPBSET_MAGIC); DEBUGASSERT(bset->init == CURL_UINT32_SPBSET_MAGIC);
@ -61,19 +71,8 @@ uint32_t Curl_uint32_spbset_count(struct uint32_spbset *bset)
return n; return n;
} }
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset) static struct uint32_spbset_chunk *uint32_spbset_get_chunk(
{ struct uint32_spbset *bset, uint32_t i, bool grow)
struct uint32_spbset_chunk *next, *chunk;
for(chunk = bset->head.next; chunk; chunk = next) {
next = chunk->next;
curlx_free(chunk);
}
memset(&bset->head, 0, sizeof(bset->head));
}
static struct uint32_spbset_chunk *
uint32_spbset_get_chunk(struct uint32_spbset *bset, uint32_t i, bool grow)
{ {
struct uint32_spbset_chunk *chunk, **panchor = NULL; struct uint32_spbset_chunk *chunk, **panchor = NULL;
uint32_t i_offset = (i & ~CURL_UINT32_SPBSET_CH_MASK); uint32_t i_offset = (i & ~CURL_UINT32_SPBSET_CH_MASK);

View file

@ -29,9 +29,6 @@
#define CURL_UINT32_TBL_MAGIC 0x62757473 #define CURL_UINT32_TBL_MAGIC 0x62757473
#endif #endif
/* Clear the table, making it empty. */
UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl);
void Curl_uint32_tbl_init(struct uint32_tbl *tbl, void Curl_uint32_tbl_init(struct uint32_tbl *tbl,
Curl_uint32_tbl_entry_dtor *entry_dtor) Curl_uint32_tbl_entry_dtor *entry_dtor)
{ {
@ -82,14 +79,8 @@ CURLcode Curl_uint32_tbl_resize(struct uint32_tbl *tbl, uint32_t nrows)
return CURLE_OK; return CURLE_OK;
} }
void Curl_uint32_tbl_destroy(struct uint32_tbl *tbl) /* Clear the table, making it empty. */
{ UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl);
DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC);
Curl_uint32_tbl_clear(tbl);
curlx_free(tbl->rows);
memset(tbl, 0, sizeof(*tbl));
}
UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl) UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl)
{ {
DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC); DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC);
@ -98,6 +89,14 @@ UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl)
tbl->last_key_added = UINT32_MAX; tbl->last_key_added = UINT32_MAX;
} }
void Curl_uint32_tbl_destroy(struct uint32_tbl *tbl)
{
DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC);
Curl_uint32_tbl_clear(tbl);
curlx_free(tbl->rows);
memset(tbl, 0, sizeof(*tbl));
}
uint32_t Curl_uint32_tbl_capacity(struct uint32_tbl *tbl) uint32_t Curl_uint32_tbl_capacity(struct uint32_tbl *tbl)
{ {
return tbl->nrows; return tbl->nrows;

View file

@ -386,7 +386,7 @@ void Curl_init_userdefined(struct Curl_easy *data)
#endif #endif
set->new_file_perms = 0644; /* Default permissions */ set->new_file_perms = 0644; /* Default permissions */
set->allowed_protocols = (curl_prot_t) CURLPROTO_64ALL; set->allowed_protocols = (curl_prot_t)CURLPROTO_64ALL;
set->redir_protocols = CURLPROTO_REDIR; set->redir_protocols = CURLPROTO_REDIR;
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)

View file

@ -85,7 +85,7 @@ CURLcode Curl_conn_upkeep(struct Curl_easy *data,
/** /**
* Always eval all arguments, return the first * Always eval all arguments, return the first
* result != (CURLE_OK|CURLE_AGAIN) or `r1`. * result != (CURLE_OK | CURLE_AGAIN) or `r1`.
*/ */
CURLcode Curl_1st_fatal(CURLcode r1, CURLcode r2); CURLcode Curl_1st_fatal(CURLcode r1, CURLcode r2);

View file

@ -32,7 +32,7 @@ CURLUcode Curl_url_set_authority(CURLU *u, const char *authority);
CURLUcode Curl_junkscan(const char *url, size_t *urllen, bool allowspace); CURLUcode Curl_junkscan(const char *url, size_t *urllen, bool allowspace);
#define U_CURLU_URLDECODE (unsigned int)CURLU_URLDECODE #define U_CURLU_URLDECODE (unsigned int)CURLU_URLDECODE
#define U_CURLU_PATH_AS_IS (unsigned int)CURLU_PATH_AS_IS #define U_CURLU_PATH_AS_IS (unsigned int)CURLU_PATH_AS_IS
#endif /* HEADER_CURL_URLAPI_INT_H */ #endif /* HEADER_CURL_URLAPI_INT_H */

View file

@ -26,7 +26,7 @@
/* This file is for lib internal stuff */ /* This file is for lib internal stuff */
#include "curl_setup.h" #include "curl_setup.h"
#define CURL_DEFAULT_USER "anonymous" #define CURL_DEFAULT_USER "anonymous"
#define CURL_DEFAULT_PASSWORD "ftp@example.com" #define CURL_DEFAULT_PASSWORD "ftp@example.com"
#if !defined(_WIN32) && !defined(MSDOS) #if !defined(_WIN32) && !defined(MSDOS)

View file

@ -243,11 +243,9 @@ char *curl_version(void)
#endif #endif
#ifdef HAVE_GSSAPI #ifdef HAVE_GSSAPI
#ifdef HAVE_GSSGNU #ifdef HAVE_GSSGNU
curl_msnprintf(gss_buf, sizeof(gss_buf), "libgss/%s", curl_msnprintf(gss_buf, sizeof(gss_buf), "libgss/%s", GSS_VERSION);
GSS_VERSION);
#elif defined(CURL_KRB5_VERSION) #elif defined(CURL_KRB5_VERSION)
curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5/%s", curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5/%s", CURL_KRB5_VERSION);
CURL_KRB5_VERSION);
#else #else
curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5"); curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5");
#endif #endif
@ -432,7 +430,7 @@ static const struct feat features_table[] = {
FEATURE("alt-svc", NULL, CURL_VERSION_ALTSVC), FEATURE("alt-svc", NULL, CURL_VERSION_ALTSVC),
#endif #endif
#if defined(USE_ARES) && defined(USE_RESOLV_THREADED) && defined(USE_HTTPSRR) #if defined(USE_ARES) && defined(USE_RESOLV_THREADED) && defined(USE_HTTPSRR)
FEATURE("asyn-rr", NULL, 0), FEATURE("asyn-rr", NULL, 0),
#endif #endif
#ifdef CURLRES_ASYNCH #ifdef CURLRES_ASYNCH
FEATURE("AsynchDNS", NULL, CURL_VERSION_ASYNCHDNS), FEATURE("AsynchDNS", NULL, CURL_VERSION_ASYNCHDNS),

View file

@ -147,7 +147,7 @@ static int myssh_is_known(struct Curl_easy *data, struct ssh_conn *sshc)
rc = ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_MD5, &hash, &hlen); rc = ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_MD5, &hash, &hlen);
if(rc != SSH_OK || hlen != 16) { if(rc != SSH_OK || hlen != 16) {
failf(data, failf(data,
"Denied establishing ssh session: md5 fingerprint not available"); "Denied establishing ssh session: MD5 fingerprint not available");
goto cleanup; goto cleanup;
} }
@ -158,7 +158,7 @@ static int myssh_is_known(struct Curl_easy *data, struct ssh_conn *sshc)
if(!curl_strequal(md5buffer, pubkey_md5)) { if(!curl_strequal(md5buffer, pubkey_md5)) {
failf(data, failf(data,
"Denied establishing ssh session: mismatch md5 fingerprint. " "Denied establishing ssh session: mismatch MD5 fingerprint. "
"Remote %s is not equal to %s", md5buffer, pubkey_md5); "Remote %s is not equal to %s", md5buffer, pubkey_md5);
rc = SSH_ERROR; rc = SSH_ERROR;
goto cleanup; goto cleanup;

View file

@ -476,7 +476,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
LIBSSH2_HOSTKEY_HASH_SHA256); LIBSSH2_HOSTKEY_HASH_SHA256);
if(!fingerprint) { if(!fingerprint) {
failf(data, failf(data,
"Denied establishing ssh session: sha256 fingerprint " "Denied establishing ssh session: SHA256 fingerprint "
"not available"); "not available");
myssh_to(data, sshc, SSH_SESSION_FREE); myssh_to(data, sshc, SSH_SESSION_FREE);
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
@ -491,7 +491,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
} }
if(!fingerprint_b64) { if(!fingerprint_b64) {
failf(data, "sha256 fingerprint could not be encoded"); failf(data, "SHA256 fingerprint could not be encoded");
myssh_to(data, sshc, SSH_SESSION_FREE); myssh_to(data, sshc, SSH_SESSION_FREE);
return CURLE_PEER_FAILED_VERIFICATION; return CURLE_PEER_FAILED_VERIFICATION;
} }
@ -509,13 +509,13 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
b64_pos++; b64_pos++;
} }
/* Before we authenticate we check the hostkey's sha256 fingerprint /* Before we authenticate we check the hostkey's SHA256 fingerprint
* against a known fingerprint, if available. * against a known fingerprint, if available.
*/ */
if((pub_pos != b64_pos) || if((pub_pos != b64_pos) ||
strncmp(fingerprint_b64, pubkey_sha256, pub_pos)) { strncmp(fingerprint_b64, pubkey_sha256, pub_pos)) {
failf(data, failf(data,
"Denied establishing ssh session: mismatch sha256 fingerprint. " "Denied establishing ssh session: mismatch SHA256 fingerprint. "
"Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256); "Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256);
curlx_free(fingerprint_b64); curlx_free(fingerprint_b64);
myssh_to(data, sshc, SSH_SESSION_FREE); myssh_to(data, sshc, SSH_SESSION_FREE);
@ -550,12 +550,12 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
if(!fingerprint || !curl_strequal(md5buffer, pubkey_md5)) { if(!fingerprint || !curl_strequal(md5buffer, pubkey_md5)) {
if(fingerprint) { if(fingerprint) {
failf(data, failf(data,
"Denied establishing ssh session: mismatch md5 fingerprint. " "Denied establishing ssh session: mismatch MD5 fingerprint. "
"Remote %s is not equal to %s", md5buffer, pubkey_md5); "Remote %s is not equal to %s", md5buffer, pubkey_md5);
} }
else { else {
failf(data, failf(data,
"Denied establishing ssh session: md5 fingerprint " "Denied establishing ssh session: MD5 fingerprint "
"not available"); "not available");
} }
myssh_to(data, sshc, SSH_SESSION_FREE); myssh_to(data, sshc, SSH_SESSION_FREE);

View file

@ -35,10 +35,8 @@ static FILE *keylog_file_fp;
void Curl_tls_keylog_open(void) void Curl_tls_keylog_open(void)
{ {
char *keylog_file_name;
if(!keylog_file_fp) { if(!keylog_file_fp) {
keylog_file_name = curl_getenv("SSLKEYLOGFILE"); char *keylog_file_name = curl_getenv("SSLKEYLOGFILE");
if(keylog_file_name) { if(keylog_file_name) {
keylog_file_fp = curlx_fopen(keylog_file_name, FOPEN_APPENDTEXT); keylog_file_fp = curlx_fopen(keylog_file_name, FOPEN_APPENDTEXT);
if(keylog_file_fp) { if(keylog_file_fp) {

View file

@ -2946,7 +2946,7 @@ static CURLcode ossl_windows_load_anchors(struct Curl_cfilter *cf,
/* Import certificates from the Windows root certificate store if /* Import certificates from the Windows root certificate store if
requested. requested.
https://stackoverflow.com/questions/9507184/ https://stackoverflow.com/questions/9507184/
https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L1037 https://github.com/d3x0r/SACK/blob/ff15424d3c581b86d40f818532e5a400c516d39d/src/netlib/ssl_layer.c#L1410
https://datatracker.ietf.org/doc/html/rfc5280 */ https://datatracker.ietf.org/doc/html/rfc5280 */
const char *win_stores[] = { const char *win_stores[] = {
"ROOT", /* Trusted Root Certification Authorities */ "ROOT", /* Trusted Root Certification Authorities */

View file

@ -175,20 +175,20 @@ static CURLcode schannel_set_ssl_version_min_max(DWORD *enabled_protocols,
for(; i <= (ssl_version_max >> 16); ++i) { for(; i <= (ssl_version_max >> 16); ++i) {
switch(i) { switch(i) {
case CURL_SSLVERSION_TLSv1_0: case CURL_SSLVERSION_TLSv1_0:
(*enabled_protocols) |= SP_PROT_TLS1_0_CLIENT; *enabled_protocols |= SP_PROT_TLS1_0_CLIENT;
break; break;
case CURL_SSLVERSION_TLSv1_1: case CURL_SSLVERSION_TLSv1_1:
(*enabled_protocols) |= SP_PROT_TLS1_1_CLIENT; *enabled_protocols |= SP_PROT_TLS1_1_CLIENT;
break; break;
case CURL_SSLVERSION_TLSv1_2: case CURL_SSLVERSION_TLSv1_2:
(*enabled_protocols) |= SP_PROT_TLS1_2_CLIENT; *enabled_protocols |= SP_PROT_TLS1_2_CLIENT;
break; break;
case CURL_SSLVERSION_TLSv1_3: case CURL_SSLVERSION_TLSv1_3:
/* Windows Server 2022 and newer */ /* Windows Server 2022 and newer */
if(curlx_verify_windows_version(10, 0, 20348, PLATFORM_WINNT, if(curlx_verify_windows_version(10, 0, 20348, PLATFORM_WINNT,
VERSION_GREATER_THAN_EQUAL)) { VERSION_GREATER_THAN_EQUAL)) {
(*enabled_protocols) |= SP_PROT_TLS1_3_CLIENT; *enabled_protocols |= SP_PROT_TLS1_3_CLIENT;
break; break;
} }
else { /* Windows 10 and older */ else { /* Windows 10 and older */
@ -277,7 +277,7 @@ static int get_alg_id_by_name(const char *name)
return 0; /* not found */ return 0; /* not found */
} }
#define NUM_CIPHERS 47 /* There are 47 options listed above */ #define NUM_CIPHERS 47 /* There are a maximum of 47 options listed above */
static CURLcode set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers, static CURLcode set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
ALG_ID *algIds) ALG_ID *algIds)

View file

@ -1684,7 +1684,7 @@ struct Curl_cftype Curl_cft_ssl = {
struct Curl_cftype Curl_cft_ssl_proxy = { struct Curl_cftype Curl_cft_ssl_proxy = {
"SSL-PROXY", "SSL-PROXY",
CF_TYPE_SSL|CF_TYPE_PROXY, CF_TYPE_SSL | CF_TYPE_PROXY,
CURL_LOG_LVL_NONE, CURL_LOG_LVL_NONE,
ssl_cf_destroy, ssl_cf_destroy,
ssl_cf_connect, ssl_cf_connect,

View file

@ -403,7 +403,8 @@ static CURLcode utf8asn1str(struct dynbuf *to, int type, const char *from,
* *
* @unittest 1666 * @unittest 1666
*/ */
UNITTEST CURLcode encodeOID(struct dynbuf *buf, const char *b, const char *e); UNITTEST CURLcode encodeOID(struct dynbuf *store,
const char *beg, const char *end);
UNITTEST CURLcode encodeOID(struct dynbuf *store, UNITTEST CURLcode encodeOID(struct dynbuf *store,
const char *beg, const char *end) const char *beg, const char *end)
{ {

View file

@ -418,7 +418,7 @@ struct SocketIFace *ISocket = NULL;
# else # else
struct Library *SocketBase = NULL; struct Library *SocketBase = NULL;
# endif # endif
# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) # define select(a, b, c, d, e) WaitSelect(a, b, c, d, e, 0)
#endif #endif
/* includes end */" /* includes end */"
AC_CHECK_HEADERS( AC_CHECK_HEADERS(

View file

@ -219,9 +219,8 @@ if(@exact) {
} }
# Build a single combined regex for removing whitelisted content # Build a single combined regex for removing whitelisted content
my $re_wl;
my $pat = join('|', map { $_ } @whitelist); my $pat = join('|', map { $_ } @whitelist);
$re_wl = qr/($pat)/; my $re_wl = qr/($pat)/;
my $errors = 0; my $errors = 0;

View file

@ -120,7 +120,7 @@ my $numchanges = 0;
my $numbugfixes = 0; my $numbugfixes = 0;
my $numcontributors = 0; my $numcontributors = 0;
open(F, "<RELEASE-NOTES"); open(F, "<RELEASE-NOTES");
my $mode=0; my $mode = 0;
while(<F>) { while(<F>) {
if($_ =~ /following changes:/) { if($_ =~ /following changes:/) {
$mode=1; $mode=1;
@ -175,7 +175,7 @@ printf "Added files: %d (total %d)\n",
printf "Deleted files: %d (delta: %d)\n", $deletes, printf "Deleted files: %d (delta: %d)\n", $deletes,
$creates - $deletes; $creates - $deletes;
print "Diffstat:$diffstat" if(!$fileschanged); print "Diffstat:$diffstat" if(!$fileschanged);
printf "Files changed: %d (%.2f%%)\n", $fileschanged, $fileschanged*100/$afiles; printf "Files changed: %d (%.2f%%)\n", $fileschanged, $fileschanged * 100 / $afiles;
printf "Lines inserted: %d\n", $insertions; printf "Lines inserted: %d\n", $insertions;
printf "Lines deleted: %d (delta: %d)\n", $deletions, printf "Lines deleted: %d (delta: %d)\n", $deletions,
$insertions - $deletions; $insertions - $deletions;

View file

@ -21,9 +21,10 @@
* SPDX-License-Identifier: curl * SPDX-License-Identifier: curl
* *
***************************************************************************/ ***************************************************************************/
#include <stddef.h>
#include "tool_setup.h" #include "tool_setup.h"
#include <stddef.h>
#include "tool_cfgable.h" #include "tool_cfgable.h"
#include "tool_formparse.h" #include "tool_formparse.h"
#include "tool_libinfo.h" #include "tool_libinfo.h"

View file

@ -62,7 +62,7 @@ static const struct finder conf_list[] = {
static char *checkhome(const char *home, const char *fname, bool dotscore) static char *checkhome(const char *home, const char *fname, bool dotscore)
{ {
const char pref[2] = { '.', '_' }; static const char pref[2] = { '.', '_' };
int i; int i;
for(i = 0; i < (dotscore ? 2 : 1); i++) { for(i = 0; i < (dotscore ? 2 : 1); i++) {
char *c; char *c;

View file

@ -124,7 +124,7 @@ static const struct LongShort aliases[]= {
{"dns-servers", ARG_STRG, ' ', C_DNS_SERVERS}, {"dns-servers", ARG_STRG, ' ', C_DNS_SERVERS},
{"doh-cert-status", ARG_BOOL|ARG_TLS, ' ', C_DOH_CERT_STATUS}, {"doh-cert-status", ARG_BOOL|ARG_TLS, ' ', C_DOH_CERT_STATUS},
{"doh-insecure", ARG_BOOL|ARG_TLS, ' ', C_DOH_INSECURE}, {"doh-insecure", ARG_BOOL|ARG_TLS, ' ', C_DOH_INSECURE},
{"doh-url" , ARG_STRG, ' ', C_DOH_URL}, {"doh-url", ARG_STRG, ' ', C_DOH_URL},
{"dump-ca-embed", ARG_NONE|ARG_TLS, ' ', C_DUMP_CA_EMBED}, {"dump-ca-embed", ARG_NONE|ARG_TLS, ' ', C_DUMP_CA_EMBED},
{"dump-header", ARG_FILE, 'D', C_DUMP_HEADER}, {"dump-header", ARG_FILE, 'D', C_DUMP_HEADER},
{"ech", ARG_STRG|ARG_TLS, ' ', C_ECH}, {"ech", ARG_STRG|ARG_TLS, ' ', C_ECH},
@ -246,7 +246,8 @@ static const struct LongShort aliases[]= {
{"proxy-ca-native", ARG_BOOL|ARG_TLS, ' ', C_PROXY_CA_NATIVE}, {"proxy-ca-native", ARG_BOOL|ARG_TLS, ' ', C_PROXY_CA_NATIVE},
{"proxy-cacert", ARG_FILE|ARG_TLS, ' ', C_PROXY_CACERT}, {"proxy-cacert", ARG_FILE|ARG_TLS, ' ', C_PROXY_CACERT},
{"proxy-capath", ARG_FILE|ARG_TLS, ' ', C_PROXY_CAPATH}, {"proxy-capath", ARG_FILE|ARG_TLS, ' ', C_PROXY_CAPATH},
{"proxy-cert", ARG_FILE|ARG_TLS|ARG_CLEAR, ' ', C_PROXY_CERT}, {"proxy-cert", ARG_FILE|ARG_TLS|ARG_CLEAR, ' ',
C_PROXY_CERT},
{"proxy-cert-type", ARG_STRG|ARG_TLS, ' ', C_PROXY_CERT_TYPE}, {"proxy-cert-type", ARG_STRG|ARG_TLS, ' ', C_PROXY_CERT_TYPE},
{"proxy-ciphers", ARG_STRG|ARG_TLS, ' ', C_PROXY_CIPHERS}, {"proxy-ciphers", ARG_STRG|ARG_TLS, ' ', C_PROXY_CIPHERS},
{"proxy-crlfile", ARG_FILE|ARG_TLS, ' ', C_PROXY_CRLFILE}, {"proxy-crlfile", ARG_FILE|ARG_TLS, ' ', C_PROXY_CRLFILE},

View file

@ -132,7 +132,6 @@ size_t feature_count;
* the latter is not returned by curl_version_info(), it is built from * the latter is not returned by curl_version_info(), it is built from
* the returned features bit mask. * the returned features bit mask.
*/ */
CURLcode get_libcurl_info(void) CURLcode get_libcurl_info(void)
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
@ -197,7 +196,6 @@ CURLcode get_libcurl_info(void)
* a given protocol and thus allows comparing pointers rather than strings. * a given protocol and thus allows comparing pointers rather than strings.
* In addition, the returned pointer is not deallocated until the program ends. * In addition, the returned pointer is not deallocated until the program ends.
*/ */
const char *proto_token(const char *proto) const char *proto_token(const char *proto)
{ {
const char * const *builtin; const char * const *builtin;

View file

@ -576,8 +576,8 @@ static CURLcode retrycheck(struct OperationConfig *config,
/* We have written data to an output file, we truncate file */ /* We have written data to an output file, we truncate file */
fflush(outs->stream); fflush(outs->stream);
notef("Throwing away %" CURL_FORMAT_CURL_OFF_T " bytes", outs->bytes); notef("Throwing away %" CURL_FORMAT_CURL_OFF_T " bytes", outs->bytes);
/* truncate file at the position where we started appending */
/* truncate file at the position where we started appending */
if(toolx_ftruncate(fileno(outs->stream), outs->init)) { if(toolx_ftruncate(fileno(outs->stream), outs->init)) {
/* when truncate fails, we cannot append as then we /* when truncate fails, we cannot append as then we
create something strange, bail out */ create something strange, bail out */

View file

@ -96,7 +96,7 @@ int toolx_ftruncate_win32(int fd, curl_off_t where)
} }
#elif defined(__DJGPP__) #elif defined(__DJGPP__)
/* /*
* Only supports 'off_t' (signed 32 bit) as file size. * Only supports 'off_t' (signed 32-bit) as file size.
*/ */
int toolx_ftruncate_djgpp(int fd, curl_off_t where) int toolx_ftruncate_djgpp(int fd, curl_off_t where)
{ {

View file

@ -137,7 +137,7 @@ static CURLcode test_cli_h2_upgrade_extreme(const char *URL)
} }
curl_multi_remove_handle(multi, msg->easy_handle); curl_multi_remove_handle(multi, msg->easy_handle);
curl_easy_cleanup(msg->easy_handle); curl_easy_cleanup(msg->easy_handle);
curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T" retiring " curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T " retiring "
"(%d now running)\n", xfer_id, running_handles); "(%d now running)\n", xfer_id, running_handles);
} }
} }

View file

@ -221,7 +221,7 @@ static CURLcode test_cli_tls_session_reuse(const char *URL)
curl_multi_remove_handle(multi, msg->easy_handle); curl_multi_remove_handle(multi, msg->easy_handle);
curl_easy_cleanup(msg->easy_handle); curl_easy_cleanup(msg->easy_handle);
--ongoing; --ongoing;
curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T" retiring " curl_mfprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T " retiring "
"(%d now running)\n", xfer_id, running_handles); "(%d now running)\n", xfer_id, running_handles);
} }
} }

View file

@ -240,7 +240,7 @@ static const struct testcase get_parts_list[] = {
0, 0, CURLUE_OK}, 0, 0, CURLUE_OK},
{"https://curl.se/# ", {"https://curl.se/# ",
"https | [11] | [12] | [13] | curl.se | [15] | / | [16] | %20%20", "https | [11] | [12] | [13] | curl.se | [15] | / | [16] | %20%20",
CURLU_URLENCODE|CURLU_ALLOW_SPACE, 0, CURLUE_OK}, CURLU_URLENCODE | CURLU_ALLOW_SPACE, 0, CURLUE_OK},
{"", "", 0, 0, CURLUE_MALFORMED_INPUT}, {"", "", 0, 0, CURLUE_MALFORMED_INPUT},
{" ", "", 0, 0, CURLUE_MALFORMED_INPUT}, {" ", "", 0, 0, CURLUE_MALFORMED_INPUT},
{"1h://example.net", "", 0, 0, CURLUE_BAD_SCHEME}, {"1h://example.net", "", 0, 0, CURLUE_BAD_SCHEME},
@ -261,7 +261,7 @@ static const struct testcase get_parts_list[] = {
CURLU_NON_SUPPORT_SCHEME, 0, CURLUE_OK}, CURLU_NON_SUPPORT_SCHEME, 0, CURLUE_OK},
{"https://user@example.net?hello# space ", {"https://user@example.net?hello# space ",
"https | user | [12] | [13] | example.net | [15] | / | hello | %20space%20", "https | user | [12] | [13] | example.net | [15] | / | hello | %20space%20",
CURLU_ALLOW_SPACE|CURLU_URLENCODE, 0, CURLUE_OK}, CURLU_ALLOW_SPACE | CURLU_URLENCODE, 0, CURLUE_OK},
{"https://test%test", "", 0, 0, CURLUE_BAD_HOSTNAME}, {"https://test%test", "", 0, 0, CURLUE_BAD_HOSTNAME},
{"https://example.com%252f%40@example.net", {"https://example.com%252f%40@example.net",
"https | example.com%2f@ | [12] | [13] | example.net | [15] | / " "https | example.com%2f@ | [12] | [13] | example.net | [15] | / "
@ -387,7 +387,7 @@ static const struct testcase get_parts_list[] = {
CURLU_DEFAULT_SCHEME, 0, CURLUE_MALFORMED_INPUT}, CURLU_DEFAULT_SCHEME, 0, CURLUE_MALFORMED_INPUT},
/* no space allowed in scheme */ /* no space allowed in scheme */
{"htt ps://user:password@example.net/get?this=and-what", "", {"htt ps://user:password@example.net/get?this=and-what", "",
CURLU_NON_SUPPORT_SCHEME|CURLU_ALLOW_SPACE, 0, CURLUE_BAD_SCHEME}, CURLU_NON_SUPPORT_SCHEME | CURLU_ALLOW_SPACE, 0, CURLUE_BAD_SCHEME},
{"https://user:password@example.net/get?this=and what", {"https://user:password@example.net/get?this=and what",
"https | user | password | [13] | example.net | [15] | /get | " "https | user | password | [13] | example.net | [15] | /get | "
"this=and what | [17]", "this=and what | [17]",
@ -472,7 +472,7 @@ static const struct testcase get_parts_list[] = {
CURLU_DEFAULT_SCHEME, 0, CURLUE_NO_HOST}, CURLU_DEFAULT_SCHEME, 0, CURLUE_NO_HOST},
{"boing:80", {"boing:80",
"https | [11] | [12] | [13] | boing | 80 | / | [16] | [17]", "https | [11] | [12] | [13] | boing | 80 | / | [16] | [17]",
CURLU_DEFAULT_SCHEME|CURLU_GUESS_SCHEME, 0, CURLUE_OK}, CURLU_DEFAULT_SCHEME | CURLU_GUESS_SCHEME, 0, CURLUE_OK},
{"http://[fd00:a41::50]:8080", {"http://[fd00:a41::50]:8080",
"http | [11] | [12] | [13] | [fd00:a41::50] | 8080 | / | [16] | [17]", "http | [11] | [12] | [13] | [fd00:a41::50] | 8080 | / | [16] | [17]",
CURLU_DEFAULT_SCHEME, 0, CURLUE_OK}, CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
@ -1433,11 +1433,11 @@ static const struct redircase set_url_list[] = {
{"http://example.com/please/../gimme/%TESTNUMBER?foobar#hello", {"http://example.com/please/../gimme/%TESTNUMBER?foobar#hello",
"http://example.net/there/it/is/../../tes t case=/%TESTNUMBER0002? yes no", "http://example.net/there/it/is/../../tes t case=/%TESTNUMBER0002? yes no",
"http://example.net/there/tes%20t%20case=/%TESTNUMBER0002?+yes+no", "http://example.net/there/tes%20t%20case=/%TESTNUMBER0002?+yes+no",
0, CURLU_URLENCODE|CURLU_ALLOW_SPACE, CURLUE_OK}, 0, CURLU_URLENCODE | CURLU_ALLOW_SPACE, CURLUE_OK},
{"http://local.test?redirect=http://local.test:80?-321", {"http://local.test?redirect=http://local.test:80?-321",
"http://local.test:80?-123", "http://local.test:80?-123",
"http://local.test:80/?-123", "http://local.test:80/?-123",
0, CURLU_URLENCODE|CURLU_ALLOW_SPACE, CURLUE_OK}, 0, CURLU_URLENCODE | CURLU_ALLOW_SPACE, CURLUE_OK},
{"http://local.test?redirect=http://local.test:80?-321", {"http://local.test?redirect=http://local.test:80?-321",
"http://local.test:80?-123", "http://local.test:80?-123",
"http://local.test:80/?-123", "http://local.test:80/?-123",

View file

@ -27,7 +27,7 @@ static CURLcode test_lib1965(const char *URL)
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
CURLUcode rc; CURLUcode rc;
const char *schemes[] = { static const char *schemes[] = {
"bad!", "bad{", "bad/", "bad\\", "a!", "bad!", "bad{", "bad/", "bad\\", "a!",
"a+123", "http-2", "http.1", "a+123", "http-2", "http.1",
"a+-.123", "http-+++2", "http.1--", "a+-.123", "http-+++2", "http.1--",
@ -35,9 +35,9 @@ static CURLcode test_lib1965(const char *URL)
"ABC2", "2CBA", "", "a", "ABC2", "2CBA", "", "a",
"aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd", "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd",
"aaaaaaaaaabbbbbbbbbbccccccccccdddddddddde", "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddde",
NULL}; NULL };
int i; int i;
(void) URL; (void)URL;
global_init(CURL_GLOBAL_ALL); global_init(CURL_GLOBAL_ALL);

View file

@ -34,7 +34,7 @@ static bool is_chain_in_order(struct curl_certinfo *cert_info)
/* Chains with only a single certificate are always in order */ /* Chains with only a single certificate are always in order */
if(cert_info->num_of_certs <= 1) if(cert_info->num_of_certs <= 1)
return 1; return true;
/* Enumerate each certificate in the chain */ /* Enumerate each certificate in the chain */
for(cert = 0; cert < cert_info->num_of_certs; cert++) { for(cert = 0; cert < cert_info->num_of_certs; cert++) {

View file

@ -163,26 +163,26 @@ static CURLcode test_lib517(const char *URL)
#if SIZEOF_TIME_T > 4 #if SIZEOF_TIME_T > 4
{ "2094 Nov 6 08:49:37", 3939871777 }, { "2094 Nov 6 08:49:37", 3939871777 },
#endif #endif
{ "01 Jan 2001 8:0:0", 978336000}, { "01 Jan 2001 8:0:0", 978336000 },
{ "01 Jan 2001 8:00:0", 978336000}, { "01 Jan 2001 8:00:0", 978336000 },
/* Out-of-range day-of-month Cases */ /* Out-of-range day-of-month Cases */
{ "29 Feb 2023 12:00:00 GMT", 1677672000}, { "29 Feb 2023 12:00:00 GMT", 1677672000 },
{ "31 Apr 2024 12:00:00 GMT", 1714564800}, { "31 Apr 2024 12:00:00 GMT", 1714564800 },
{ "30 Feb 2024 12:00:00 GMT", 1709294400}, { "30 Feb 2024 12:00:00 GMT", 1709294400 },
{ "01-13-2024", -1}, { "01-13-2024", -1 },
{ "32 Jan 2024", -1}, { "32 Jan 2024", -1 },
{ "31 Jan 2024", 1706659200}, { "31 Jan 2024", 1706659200 },
{ "32 Feb 2024", -1}, { "32 Feb 2024", -1 },
{ "32 Mar 2024", -1}, { "32 Mar 2024", -1 },
{ "32 Apr 2024", -1}, { "32 Apr 2024", -1 },
{ "32 May 2024", -1}, { "32 May 2024", -1 },
{ "32 Jun 2024", -1}, { "32 Jun 2024", -1 },
{ "32 Jul 2024", -1}, { "32 Jul 2024", -1 },
{ "32 Aug 2024", -1}, { "32 Aug 2024", -1 },
{ "32 Sep 2024", -1}, { "32 Sep 2024", -1 },
{ "32 Oct 2024", -1}, { "32 Oct 2024", -1 },
{ "32 Nov 2024", -1}, { "32 Nov 2024", -1 },
{ "32 Dec 2024", -1}, { "32 Dec 2024", -1 },
/* Timezone Offsets */ /* Timezone Offsets */
{ "Sun, 06 Nov 1994 08:49:37 +0530", 784091977 }, { "Sun, 06 Nov 1994 08:49:37 +0530", 784091977 },
{ "Sun, 06 Nov 1994 08:49:37 +0545", 784091077 }, { "Sun, 06 Nov 1994 08:49:37 +0545", 784091077 },
@ -221,18 +221,18 @@ static CURLcode test_lib517(const char *URL)
/* Y2K38 & Historical Boundaries */ /* Y2K38 & Historical Boundaries */
#if SIZEOF_TIME_T > 4 #if SIZEOF_TIME_T > 4
/* for 32 bit time_t, we bail on >year 2037 */ /* for 32 bit time_t, we bail on >year 2037 */
{ "19 Jan 2038 03:14:07 GMT", 2147483647}, { "19 Jan 2038 03:14:07 GMT", 2147483647 },
{ "19 Jan 2038 03:14:08 GMT", 2147483648}, { "19 Jan 2038 03:14:08 GMT", 2147483648 },
{ "01 Jan 69 00:00:00 GMT", 3124224000}, { "01 Jan 69 00:00:00 GMT", 3124224000 },
#endif #endif
{ "01 Jan 1500 00:00:00 GMT", -1}, { "01 Jan 1500 00:00:00 GMT", -1 },
/* Formatting & Malformed Junk */ /* Formatting & Malformed Junk */
{ "Sun, 06-Nov/1994 08:49:37", 784111777}, { "Sun, 06-Nov/1994 08:49:37", 784111777 },
{ "Sun, 06 Nov 1994 08:49:37 GMT", 784111777}, { "Sun, 06 Nov 1994 08:49:37 GMT", 784111777 },
{ " Sun, 06 Nov 1994 08:49:37 GMT ", 784111777}, { " Sun, 06 Nov 1994 08:49:37 GMT ", 784111777 },
{ "Date: Sun, 06 Nov 1994 08:49:37 GMT", -1}, { "Date: Sun, 06 Nov 1994 08:49:37 GMT", -1 },
/* wrong day name is ignored */ /* wrong day name is ignored */
{ "Monday, 06 Nov 1994 08:49:37 GMT", 784111777}, { "Monday, 06 Nov 1994 08:49:37 GMT", 784111777 },
{ NULL, 0 } { NULL, 0 }
}; };

View file

@ -375,7 +375,7 @@ static CURLcode test_lib1521(const char *URL)
curl_socket_t sockfd; curl_socket_t sockfd;
const struct curl_certinfo *certinfo; const struct curl_certinfo *certinfo;
struct curl_tlssessioninfo *tlssession; struct curl_tlssessioninfo *tlssession;
struct curl_blob blob = { CURL_UNCONST("silly"), 5, 0}; struct curl_blob blob = { CURL_UNCONST("silly"), 5, 0 };
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
(void)URL; (void)URL;
global_init(CURL_GLOBAL_ALL); global_init(CURL_GLOBAL_ALL);
@ -455,7 +455,7 @@ while(<STDIN>) {
"${w3} curl_easy_setopt(curl, $name,"; "${w3} curl_easy_setopt(curl, $name,";
my $ignoreset = "${w3}/* set string again to check for leaks */\n". my $ignoreset = "${w3}/* set string again to check for leaks */\n".
"${w3}(void)curl_easy_setopt(curl, $name,"; "${w3}(void)curl_easy_setopt(curl, $name,";
my $i = ' ' x (length($w) + 25); my $i = ' ' x (length($w) + 21);
my $fcheck = <<MOO my $fcheck = <<MOO
if(first && present(first)) /* first setopt check only */ if(first && present(first)) /* first setopt check only */
err("$name", first, __LINE__); err("$name", first, __LINE__);
@ -515,7 +515,7 @@ MOO
elsif($type eq "CURLOPTTYPE_OFF_T") { elsif($type eq "CURLOPTTYPE_OFF_T") {
print $fh "${fpref} OFF_NO);\n$flongcheckzero"; print $fh "${fpref} OFF_NO);\n$flongcheckzero";
print $fh "$ifpresent"; print $fh "$ifpresent";
my $lvl = " " x 29; my $lvl = " " x 25;
print $fh "${pref}\n${lvl}(curl_off_t)22);\n$longcheck"; print $fh "${pref}\n${lvl}(curl_off_t)22);\n$longcheck";
print $fh "${pref} OFF_HI);\n$longcheck"; print $fh "${pref} OFF_HI);\n$longcheck";
print $fh "${pref} OFF_LO);\n$longcheck"; print $fh "${pref} OFF_LO);\n$longcheck";

View file

@ -36,7 +36,7 @@ my $what=$ARGV[2];
# Read the output of curl --version # Read the output of curl --version
my $curl_protocols=""; my $curl_protocols="";
open(CURL, "$ARGV[1]") || die "Cannot get curl $what list\n"; open(CURL, $ARGV[1]) || die "Cannot get curl $what list\n";
while(<CURL>) { while(<CURL>) {
$curl_protocols = $_ if(/$what:/i); $curl_protocols = $_ if(/$what:/i);
} }

View file

@ -34,7 +34,7 @@ if($#ARGV != 2) {
my $what=$ARGV[2]; my $what=$ARGV[2];
# Read the output of curl --version # Read the output of curl --version
open(CURL, "$ARGV[1]") || die "Cannot open curl --version list in $ARGV[1]\n"; open(CURL, $ARGV[1]) || die "Cannot open curl --version list in $ARGV[1]\n";
$_ = <CURL>; $_ = <CURL>;
chomp; chomp;
/libcurl\/([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)/; /libcurl\/([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)/;

View file

@ -173,8 +173,8 @@ sub exe_ext {
if($ENV{'CURL_TEST_EXE_EXT'}) { if($ENV{'CURL_TEST_EXE_EXT'}) {
return $ENV{'CURL_TEST_EXE_EXT'}; return $ENV{'CURL_TEST_EXE_EXT'};
} }
if($ENV{'CURL_TEST_EXE_EXT_'.$component}) { if($ENV{'CURL_TEST_EXE_EXT_' . $component}) {
return $ENV{'CURL_TEST_EXE_EXT_'.$component}; return $ENV{'CURL_TEST_EXE_EXT_' . $component};
} }
if($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' || if($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' ||
$^O eq 'dos' || $^O eq 'os2') { $^O eq 'dos' || $^O eq 'os2') {

View file

@ -114,9 +114,9 @@ use memanalyzer;
####################################################################### #######################################################################
# Global variables set elsewhere but used only by this package # Global variables set elsewhere but used only by this package
# These may only be set *before* runner_init is called # These may only be set *before* runner_init is called
our $DBGCURL=$CURL; #"../src/.libs/curl"; # alternative for debugging our $DBGCURL = $CURL; #"../src/.libs/curl"; # alternative for debugging
our $valgrind_logfile="--log-file"; # the option name for valgrind >=3 our $valgrind_logfile = "--log-file"; # the option name for valgrind >=3
our $valgrind_tool="--tool=memcheck"; our $valgrind_tool = "--tool=memcheck";
our $gdb = checktestcmd("gdb"); our $gdb = checktestcmd("gdb");
our $gdbthis = 0; # run test case with debugger (gdb or lldb) our $gdbthis = 0; # run test case with debugger (gdb or lldb)
our $gdbxwin; # use windowed gdb when using gdb our $gdbxwin; # use windowed gdb when using gdb
@ -142,12 +142,12 @@ my %controllerw; # pipe that controller writes to
# redirected stdout/stderr to these files # redirected stdout/stderr to these files
sub stdoutfilename { sub stdoutfilename {
my ($logdir, $testnum)=@_; my ($logdir, $testnum) = @_;
return "$logdir/stdout$testnum"; return "$logdir/stdout$testnum";
} }
sub stderrfilename { sub stderrfilename {
my ($logdir, $testnum)=@_; my ($logdir, $testnum) = @_;
return "$logdir/stderr$testnum"; return "$logdir/stderr$testnum";
} }
@ -157,19 +157,19 @@ sub stderrfilename {
# runnerac_* functions # runnerac_* functions
# Called by controller # Called by controller
sub runner_init { sub runner_init {
my ($logdir, $jobs)=@_; my ($logdir, $jobs) = @_;
$multiprocess = !!$jobs; $multiprocess = !!$jobs;
# enable memory debugging if curl is compiled with it # enable memory debugging if curl is compiled with it
$ENV{'CURL_MEMDEBUG'} = "$logdir/$MEMDUMP"; $ENV{'CURL_MEMDEBUG'} = "$logdir/$MEMDUMP";
delete $ENV{'CURL_ENTROPY'} if($ENV{'CURL_ENTROPY'}); delete $ENV{'CURL_ENTROPY'} if($ENV{'CURL_ENTROPY'});
$ENV{'CURL_FORCETIME'}=1; # for debug NTLM magic $ENV{'CURL_FORCETIME'} = 1; # for debug NTLM magic
$ENV{'CURL_GLOBAL_INIT'}=1; # debug curl_global_init/cleanup use $ENV{'CURL_GLOBAL_INIT'} = 1; # debug curl_global_init/cleanup use
$ENV{'HOME'}=$pwd; $ENV{'HOME'} = $pwd;
$ENV{'CURL_HOME'}=$ENV{'HOME'}; $ENV{'CURL_HOME'} = $ENV{'HOME'};
$ENV{'XDG_CONFIG_HOME'}=$ENV{'HOME'}; $ENV{'XDG_CONFIG_HOME'} = $ENV{'HOME'};
$ENV{'COLUMNS'}=79; # screen width! $ENV{'COLUMNS'} = 79; # screen width!
# Incorporate the $logdir into the random seed and re-seed the PRNG. # Incorporate the $logdir into the random seed and re-seed the PRNG.
# This gives each runner a unique yet consistent seed which provides # This gives each runner a unique yet consistent seed which provides
@ -262,8 +262,8 @@ sub event_loop {
# Check for a command in the PATH of the machine running curl. # Check for a command in the PATH of the machine running curl.
# #
sub checktestcmd { sub checktestcmd {
my ($cmd)=@_; my ($cmd) = @_;
my @testpaths=($LIBDIR . ".libs", $LIBDIR); my @testpaths = ($LIBDIR . ".libs", $LIBDIR);
return checkcmd($cmd, @testpaths); return checkcmd($cmd, @testpaths);
} }
@ -452,7 +452,7 @@ sub torture {
logmsg " CMD: $testcmd\n" if($verbose); logmsg " CMD: $testcmd\n" if($verbose);
# memanalyze -v is our friend, get the number of allocations made # memanalyze -v is our friend, get the number of allocations made
my $count=0; my $count = 0;
my @out = memanalyze("$LOGDIR/$MEMDUMP", 1, 0, 0); my @out = memanalyze("$LOGDIR/$MEMDUMP", 1, 0, 0);
for(@out) { for(@out) {
if(/^Operations: (\d+)/) { if(/^Operations: (\d+)/) {
@ -498,7 +498,7 @@ sub torture {
} }
if($verbose) { if($verbose) {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime(time()); localtime(time());
my $now = sprintf("%02d:%02d:%02d ", $hour, $min, $sec); my $now = sprintf("%02d:%02d:%02d ", $hour, $min, $sec);
logmsg "Fail function no: $limit at $now\r"; logmsg "Fail function no: $limit at $now\r";
@ -550,16 +550,16 @@ sub torture {
# and does not core dump # and does not core dump
if(($ret & 255) || ($ret >> 8) >= 128) { if(($ret & 255) || ($ret >> 8) >= 128) {
logmsg " system() returned $ret\n"; logmsg " system() returned $ret\n";
$fail=1; $fail = 1;
} }
else { else {
my @memdata = memanalyze("$LOGDIR/$MEMDUMP", 0, 0, 0); my @memdata = memanalyze("$LOGDIR/$MEMDUMP", 0, 0, 0);
my $leak=0; my $leak = 0;
for(@memdata) { for(@memdata) {
if($_ ne "") { if($_ ne "") {
# well it could be other memory problems as well, but # well it could be other memory problems as well, but
# we call it leak for short here # we call it leak for short here
$leak=1; $leak = 1;
} }
} }
if($leak) { if($leak) {
@ -753,9 +753,9 @@ sub singletest_prepare {
# create (possibly-empty) files before starting the test # create (possibly-empty) files before starting the test
for my $partsuffix (('', '1', '2', '3', '4')) { for my $partsuffix (('', '1', '2', '3', '4')) {
my @inputfile=getpart("client", "file".$partsuffix); my @inputfile = getpart("client", "file".$partsuffix);
my %fileattr = getpartattr("client", "file".$partsuffix); my %fileattr = getpartattr("client", "file".$partsuffix);
my $filename=$fileattr{'name'}; my $filename = $fileattr{'name'};
if(@inputfile || $filename) { if(@inputfile || $filename) {
if(!$filename) { if(!$filename) {
logmsg " $testnum: IGNORED: Section client=>file has no name attribute\n"; logmsg " $testnum: IGNORED: Section client=>file has no name attribute\n";
@ -812,25 +812,25 @@ sub singletest_run {
} }
else { else {
# there was no command given, use something silly # there was no command given, use something silly
$cmd="-"; $cmd = "-";
} }
my $CURLOUT="$LOGDIR/curl$testnum.out"; # curl output if not stdout my $CURLOUT = "$LOGDIR/curl$testnum.out"; # curl output if not stdout
# if stdout section exists, we verify that the stdout contained this: # if stdout section exists, we verify that the stdout contained this:
my $out=""; my $out = "";
my %cmdhash = getpartattr("client", "command"); my %cmdhash = getpartattr("client", "command");
if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-output/)) { if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-output/)) {
#We may slap on --output! #We may slap on --output!
if(!partexists("verify", "stdout") || if(!partexists("verify", "stdout") ||
($cmdhash{'option'} && $cmdhash{'option'} =~ /force-output/)) { ($cmdhash{'option'} && $cmdhash{'option'} =~ /force-output/)) {
$out=" --output $CURLOUT "; $out = " --output $CURLOUT ";
} }
} }
my @codepieces = getpart("client", "tool"); my @codepieces = getpart("client", "tool");
my $tool=""; my $tool = "";
my $tool_name=""; # without exe extension my $tool_name = ""; # without exe extension
if(@codepieces) { if(@codepieces) {
$tool_name = $codepieces[0]; $tool_name = $codepieces[0];
chomp $tool_name; chomp $tool_name;
@ -839,27 +839,27 @@ sub singletest_run {
my $oldmemdebug; my $oldmemdebug;
my $disablevalgrind; my $disablevalgrind;
my $CMDLINE=""; my $CMDLINE = "";
my $cmdargs; my $cmdargs;
my $cmdtype = $cmdhash{'type'} || "default"; my $cmdtype = $cmdhash{'type'} || "default";
my $fail_due_event_based = $run_event_based; my $fail_due_event_based = $run_event_based;
if($cmdtype eq "perl") { if($cmdtype eq "perl") {
# run the command line prepended with "perl" # run the command line prepended with "perl"
$cmdargs =$cmd; $cmdargs = $cmd;
$CMDLINE = "$perl "; $CMDLINE = "$perl ";
$tool=$CMDLINE; $tool = $CMDLINE;
$disablevalgrind=1; $disablevalgrind = 1;
} }
elsif($cmdtype eq "shell") { elsif($cmdtype eq "shell") {
# run the command line prepended with "/bin/sh" # run the command line prepended with "/bin/sh"
$cmdargs =$cmd; $cmdargs = $cmd;
$CMDLINE = "/bin/sh "; $CMDLINE = "/bin/sh ";
$tool=$CMDLINE; $tool = $CMDLINE;
$disablevalgrind=1; $disablevalgrind = 1;
} }
elsif(!$tool && !$keywords{"unittest"}) { elsif(!$tool && !$keywords{"unittest"}) {
# run curl, add suitable command line options # run curl, add suitable command line options
my $inc=""; my $inc = "";
if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-include/)) { if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-include/)) {
$inc = " --include"; $inc = " --include";
} }
@ -899,21 +899,21 @@ sub singletest_run {
# Default the tool to a unit test with the same name as the test spec # Default the tool to a unit test with the same name as the test spec
if($keywords{"unittest"} && !$tool) { if($keywords{"unittest"} && !$tool) {
$tool_name="unit$testnum"; $tool_name = "unit$testnum";
$tool = $tool_name . exe_ext('TOOL'); $tool = $tool_name . exe_ext('TOOL');
} }
if($tool =~ /^lib/) { if($tool =~ /^lib/) {
$tool = "libtests" . exe_ext('TOOL'); $tool = "libtests" . exe_ext('TOOL');
$CMDLINE=$LIBDIR . $tool; $CMDLINE = $LIBDIR . $tool;
} }
elsif($tool =~ /^tool/) { elsif($tool =~ /^tool/) {
$tool = "tunits" . exe_ext('TOOL'); $tool = "tunits" . exe_ext('TOOL');
$CMDLINE=$TUNITDIR . $tool; $CMDLINE = $TUNITDIR . $tool;
} }
elsif($tool =~ /^unit/) { elsif($tool =~ /^unit/) {
$tool = "units" . exe_ext('TOOL'); $tool = "units" . exe_ext('TOOL');
$CMDLINE=$UNITDIR . $tool; $CMDLINE = $UNITDIR . $tool;
} }
if(! -f $CMDLINE) { if(! -f $CMDLINE) {
@ -921,16 +921,16 @@ sub singletest_run {
return (-1, 0, 0, "", "", 0); return (-1, 0, 0, "", "", 0);
} }
$CMDLINE=exerunner() . $CMDLINE; $CMDLINE = exerunner() . $CMDLINE;
if($gdbthis) { if($gdbthis) {
$cmdargs =" $tool_name$cmdargs"; $cmdargs = " $tool_name$cmdargs";
} }
else { else {
$CMDLINE.=" $tool_name"; $CMDLINE .= " $tool_name";
} }
$DBGCURL=$CMDLINE; $DBGCURL = $CMDLINE;
} }
if($fail_due_event_based) { if($fail_due_event_based) {
@ -942,13 +942,13 @@ sub singletest_run {
# gdb is incompatible with valgrind, so disable it when debugging # gdb is incompatible with valgrind, so disable it when debugging
# Perhaps a better approach would be to run it under valgrind anyway # Perhaps a better approach would be to run it under valgrind anyway
# with --db-attach=yes or --vgdb=yes. # with --db-attach=yes or --vgdb=yes.
$disablevalgrind=1; $disablevalgrind = 1;
} }
my @stdintest = getpart("client", "stdin"); my @stdintest = getpart("client", "stdin");
if(@stdintest) { if(@stdintest) {
my $stdinfile="$LOGDIR/stdin-for-$testnum"; my $stdinfile = "$LOGDIR/stdin-for-$testnum";
my %hash = getpartattr("client", "stdin"); my %hash = getpartattr("client", "stdin");
if($hash{'nonewline'}) { if($hash{'nonewline'}) {
@ -966,7 +966,7 @@ sub singletest_run {
} }
if(!$tool) { if(!$tool) {
$CMDLINE=exerunner() . shell_quote($CURL); $CMDLINE = exerunner() . shell_quote($CURL);
if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-q/)) { if((!$cmdhash{'option'}) || ($cmdhash{'option'} !~ /no-q/)) {
$CMDLINE .= " -q"; $CMDLINE .= " -q";
} }
@ -1038,13 +1038,13 @@ sub singletest_run {
# gdb # gdb
my $GDBW = ($gdbxwin) ? "-w" : ""; my $GDBW = ($gdbxwin) ? "-w" : "";
runclient("$gdb --directory $LIBDIR " . shell_quote($DBGCURL) . " $GDBW -x $LOGDIR/gdbcmd"); runclient("$gdb --directory $LIBDIR " . shell_quote($DBGCURL) . " $GDBW -x $LOGDIR/gdbcmd");
$cmdres=0; # makes it always continue after a debugged run $cmdres = 0; # makes it always continue after a debugged run
} }
elsif($gdbthis == 2) { elsif($gdbthis == 2) {
# $gdb is "lldb" # $gdb is "lldb"
print "runs lldb -- $CURL $cmdargs\n"; print "runs lldb -- $CURL $cmdargs\n";
runclient("lldb -- $CURL $cmdargs"); runclient("lldb -- $CURL $cmdargs");
$cmdres=0; # makes it always continue after a debugged run $cmdres = 0; # makes it always continue after a debugged run
} }
else { else {
# Convert the raw result code into a more useful one # Convert the raw result code into a more useful one
@ -1065,7 +1065,7 @@ sub singletest_run {
####################################################################### #######################################################################
# Clean up after test command # Clean up after test command
sub singletest_clean { sub singletest_clean {
my ($testnum, $dumped_core, $testtimings)=@_; my ($testnum, $dumped_core, $testtimings) = @_;
if(!$dumped_core) { if(!$dumped_core) {
if(-r "core") { if(-r "core") {
@ -1138,15 +1138,15 @@ sub singletest_clean {
####################################################################### #######################################################################
# Verify that the postcheck succeeded # Verify that the postcheck succeeded
sub singletest_postcheck { sub singletest_postcheck {
my ($testnum)=@_; my ($testnum) = @_;
# run the postcheck command # run the postcheck command
my @postcheck= getpart("client", "postcheck"); my @postcheck = getpart("client", "postcheck");
if(@postcheck) { if(@postcheck) {
die "test$testnum uses client/postcheck"; die "test$testnum uses client/postcheck";
} }
@postcheck= getpart("verify", "postcheck"); @postcheck = getpart("verify", "postcheck");
if(@postcheck) { if(@postcheck) {
my $cmd = join("", @postcheck); my $cmd = join("", @postcheck);
chomp $cmd; chomp $cmd;
@ -1173,7 +1173,7 @@ sub singletest_postcheck {
################################################################### ###################################################################
# Get ready to run a single test case # Get ready to run a single test case
sub runner_test_preprocess { sub runner_test_preprocess {
my ($testnum)=@_; my ($testnum) = @_;
my %testtimings; my %testtimings;
if(clearlogs()) { if(clearlogs()) {
@ -1233,7 +1233,7 @@ sub runner_test_preprocess {
# 1=unskippable test failure, as first integer, plus any log messages, # 1=unskippable test failure, as first integer, plus any log messages,
# plus more return values when error is 0 # plus more return values when error is 0
sub runner_test_run { sub runner_test_run {
my ($testnum)=@_; my ($testnum) = @_;
if(clearlogs()) { if(clearlogs()) {
logmsg "Warning: log messages were lost\n"; logmsg "Warning: log messages were lost\n";
@ -1285,7 +1285,7 @@ sub runner_test_run {
# received. # received.
# Called by controller # Called by controller
sub runnerac_shutdown { sub runnerac_shutdown {
my ($runnerid)=$_[0]; my ($runnerid) = $_[0];
my $err = controlleripccall(\&runner_shutdown, @_); my $err = controlleripccall(\&runner_shutdown, @_);
# These have no more use # These have no more use
@ -1362,7 +1362,7 @@ sub runnerar {
} }
# system call was interrupted, probably by ^C; restart it so we stay in sync # system call was interrupted, probably by ^C; restart it so we stay in sync
} }
my $len=unpack("L", $datalen); my $len = unpack("L", $datalen);
my $buf; my $buf;
while(! defined ($err = sysread($controllerr{$runnerid}, $buf, $len)) || $err <= 0) { while(! defined ($err = sysread($controllerr{$runnerid}, $buf, $len)) || $err <= 0) {
if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) { if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) {
@ -1391,7 +1391,7 @@ sub runnerar_ready {
my ($blocking) = @_; my ($blocking) = @_;
my $r_in = ""; my $r_in = "";
my %idbyfileno; my %idbyfileno;
my $maxfileno=0; my $maxfileno = 0;
my @ready_runners = (); my @ready_runners = ();
foreach my $p (keys(%controllerr)) { foreach my $p (keys(%controllerr)) {
my $fd = fileno($controllerr{$p}); my $fd = fileno($controllerr{$p});
@ -1408,7 +1408,7 @@ sub runnerar_ready {
# caller will need to later call this function again. # caller will need to later call this function again.
# TODO: this is relatively slow with hundreds of fds # TODO: this is relatively slow with hundreds of fds
my $e_in = $r_in; my $e_in = $r_in;
if(select(my $r_out=$r_in, undef, my $e_out=$e_in, $blocking) >= 1) { if(select(my $r_out = $r_in, undef, my $e_out = $e_in, $blocking) >= 1) {
for my $fd (0..$maxfileno) { for my $fd (0..$maxfileno) {
# Return an error condition first in case it is both # Return an error condition first in case it is both
if(vec($e_out, $fd, 1)) { if(vec($e_out, $fd, 1)) {
@ -1451,7 +1451,7 @@ sub ipcrecv {
} }
# system call was interrupted, probably by ^C; restart it so we stay in sync # system call was interrupted, probably by ^C; restart it so we stay in sync
} }
my $len=unpack("L", $datalen); my $len = unpack("L", $datalen);
my $buf; my $buf;
while(! defined ($err = sysread($runnerr, $buf, $len)) || $err <= 0) { while(! defined ($err = sysread($runnerr, $buf, $len)) || $err <= 0) {
if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) { if((!defined $err && ! $!{EINTR}) || (defined $err && $err == 0)) {

Some files were not shown because too many files have changed in this diff Show more