tidy-up: miscellaneous

- schannel: delete superfluous parenthesis.
- tftp: delete stray space from log output.
- ws: update guard comment.
- docs/examples: constify variables.
- runtests/servers: enclose unknown parameter between quotes.
- scripts/perlcheck.sh: drop redundant grep `-E` option.
- THANKS: move names from comments to THANKS.
- sync `--depth` option style across scripts.
- sync git repo URL ending between some scripts.
- BINDINGS.md: drop protocol from archive.org URL path.
- whitespace, indent, unfold lines.

Closes #19565
This commit is contained in:
Viktor Szakats
2025-10-25 23:32:14 +02:00
parent a87383828e
commit 1b48c6148a
32 changed files with 62 additions and 71 deletions

View File

@@ -189,7 +189,7 @@ jobs:
if: ${{ steps.cache-openssl-http3-no-deprecated.outputs.cache-hit != 'true' }}
run: |
cd ~
git clone --quiet --depth=1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl
git clone --quiet --depth 1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl
cd openssl
./config --prefix="$PWD"/build --libdir=lib no-makedepend no-apps no-docs no-tests no-deprecated
make
@@ -232,7 +232,7 @@ jobs:
if: ${{ steps.cache-gnutls.outputs.cache-hit != 'true' }}
run: |
cd ~
git clone --quiet --depth=1 -b "${GNUTLS_VERSION}" https://github.com/gnutls/gnutls.git
git clone --quiet --depth 1 -b "${GNUTLS_VERSION}" https://github.com/gnutls/gnutls
cd gnutls
# required: nettle-dev libp11-kit-dev libev-dev autopoint bison gperf gtk-doc-tools libtasn1-bin
./bootstrap
@@ -247,7 +247,7 @@ jobs:
if: ${{ steps.cache-wolfssl.outputs.cache-hit != 'true' }}
run: |
cd ~
git clone --quiet --depth=1 -b "v${WOLFSSL_VERSION}-stable" https://github.com/wolfSSL/wolfssl.git
git clone --quiet --depth 1 -b "v${WOLFSSL_VERSION}-stable" https://github.com/wolfSSL/wolfssl
cd wolfssl
./autogen.sh
./configure --disable-dependency-tracking --enable-all --enable-quic \
@@ -259,9 +259,9 @@ jobs:
if: ${{ steps.cache-nghttp3.outputs.cache-hit != 'true' }}
run: |
cd ~
git clone --quiet --depth=1 -b "v${NGHTTP3_VERSION}" https://github.com/ngtcp2/nghttp3
git clone --quiet --depth 1 -b "v${NGHTTP3_VERSION}" https://github.com/ngtcp2/nghttp3
cd nghttp3
git submodule update --init --depth=1
git submodule update --init --depth 1
autoreconf -fi
./configure --disable-dependency-tracking --prefix="$PWD"/build --enable-lib-only
make
@@ -272,7 +272,7 @@ jobs:
# building twice to get crypto libs for ossl, libressl and awslc installed
run: |
cd ~
git clone --quiet --depth=1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2
git clone --quiet --depth 1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2
cd ngtcp2
autoreconf -fi
./configure --disable-dependency-tracking --prefix="$PWD"/build \
@@ -290,7 +290,7 @@ jobs:
if: ${{ steps.cache-ngtcp2-boringssl.outputs.cache-hit != 'true' }}
run: |
cd ~
git clone --quiet --depth=1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2 ngtcp2-boringssl
git clone --quiet --depth 1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2 ngtcp2-boringssl
cd ngtcp2-boringssl
autoreconf -fi
./configure --disable-dependency-tracking --prefix="$PWD"/build \
@@ -303,9 +303,9 @@ jobs:
if: ${{ steps.cache-nghttp2.outputs.cache-hit != 'true' }}
run: |
cd ~
git clone --quiet --depth=1 -b "v${NGHTTP2_VERSION}" https://github.com/nghttp2/nghttp2
git clone --quiet --depth 1 -b "v${NGHTTP2_VERSION}" https://github.com/nghttp2/nghttp2
cd nghttp2
git submodule update --init --depth=1
git submodule update --init --depth 1
autoreconf -fi
# required (for nghttpx application): libc-ares-dev libev-dev zlib1g-dev
# optional (for nghttpx application): libbrotli-dev
@@ -578,7 +578,7 @@ jobs:
if: ${{ matrix.build.name == 'quiche' && steps.cache-quiche.outputs.cache-hit != 'true' }}
run: |
cd ~
git clone --quiet --depth=1 -b "${QUICHE_VERSION}" --recursive https://github.com/cloudflare/quiche.git
git clone --quiet --depth 1 -b "${QUICHE_VERSION}" --recursive https://github.com/cloudflare/quiche
cd quiche
#### Work-around https://github.com/curl/curl/issues/7927 #######
#### See https://github.com/alexcrichton/cmake-rs/issues/131 ####

View File

@@ -580,7 +580,7 @@ jobs:
- name: 'build openssl (thread sanitizer)'
if: ${{ contains(matrix.build.install_steps, 'openssl-tsan') && steps.cache-openssl-tsan.outputs.cache-hit != 'true' }}
run: |
git clone --quiet --depth=1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl
git clone --quiet --depth 1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl
cd openssl
CC=clang CFLAGS='-fsanitize=thread' LDFLAGS='-fsanitize=thread' ./config --prefix=/home/runner/openssl --libdir=lib no-makedepend no-apps no-docs no-tests
make

View File

@@ -21,7 +21,6 @@
# SPDX-License-Identifier: curl
#
###########################################################################
# by Tetetest and Sukender (Benoit Neil)
cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR)
message(STATUS "Using CMake version ${CMAKE_VERSION}")
@@ -1741,9 +1740,9 @@ check_function_exists("eventfd" HAVE_EVENTFD)
check_symbol_exists("ftruncate" "unistd.h" HAVE_FTRUNCATE)
check_symbol_exists("getpeername" "${CURL_INCLUDES}" HAVE_GETPEERNAME) # winsock2.h unistd.h proto/bsdsocket.h
check_symbol_exists("getsockname" "${CURL_INCLUDES}" HAVE_GETSOCKNAME) # winsock2.h unistd.h proto/bsdsocket.h
check_function_exists("getrlimit" HAVE_GETRLIMIT)
check_function_exists("setlocale" HAVE_SETLOCALE)
check_function_exists("setrlimit" HAVE_SETRLIMIT)
check_function_exists("getrlimit" HAVE_GETRLIMIT)
check_function_exists("setlocale" HAVE_SETLOCALE)
check_function_exists("setrlimit" HAVE_SETRLIMIT)
if(WIN32)
# include wincrypt.h as a workaround for mingw-w64 __MINGW64_VERSION_MAJOR <= 5 header bug */
@@ -1752,9 +1751,9 @@ else()
check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # net/if.h
check_function_exists("realpath" HAVE_REALPATH)
check_function_exists("sched_yield" HAVE_SCHED_YIELD)
check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP)
check_symbol_exists("stricmp" "string.h" HAVE_STRICMP)
check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP)
check_symbol_exists("stricmp" "string.h" HAVE_STRICMP)
check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
endif()
check_function_exists("setmode" HAVE_SETMODE)

View File

@@ -61,7 +61,7 @@ Go: [go-curl](https://github.com/andelf/go-curl) by ShuYu Wang
[Haskell](https://hackage.haskell.org/package/curl) Written by Galois, Inc
[Hollywood](https://web.archive.org/web/20250116185836/https://www.hollywood-mal.com/download.html) hURL by Andreas Falkenhahn
[Hollywood](https://web.archive.org/web/20250116185836/www.hollywood-mal.com/download.html) hURL by Andreas Falkenhahn
[Java](https://github.com/covers1624/curl4j)

View File

@@ -54,7 +54,7 @@ versions do not work.
Build OpenSSL (version 3.5.0 or newer):
% git clone --quiet --depth=1 -b openssl-$OPENSSL_VERSION https://github.com/openssl/openssl
% git clone --depth 1 -b openssl-$OPENSSL_VERSION https://github.com/openssl/openssl
% cd openssl
% ./config --prefix=<somewhere1> --libdir=lib
% make

View File

@@ -361,7 +361,7 @@ Benjamin Sergeant
Ben Kohler
Ben Madsen
Ben Noordhuis
Benoit Neil
Benoit Neil (Sukender)
Benoit Pierre
Benoit Sigoure
Ben Van Hof
@@ -3148,6 +3148,7 @@ Temprimus
Terence Eden
Terri Oda
Terry Wu
Tetetest
thanhchungbtc on github
TheAssassin on github
TheBitBrine
@@ -3328,6 +3329,7 @@ UrsusArctos on github
User Sg
ustcqidi on github
Vadim Grinshpun
Vaibhav Kumar
Valentin David
Valentín Gutiérrez
Valentin Richter

View File

@@ -170,7 +170,7 @@ static size_t follow_links(CURLM *multi, struct memory *mem,
return count;
}
static int is_html(char *ctype)
static int is_html(const char *ctype)
{
return ctype != NULL && strlen(ctype) > 10 && strstr(ctype, "text/html");
}

View File

@@ -48,7 +48,7 @@ struct WriteThis {
static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
{
struct WriteThis *upload = (struct WriteThis *)userp;
size_t max = size*nmemb;
size_t max = size * nmemb;
if(max < 1)
return 0;

View File

@@ -39,7 +39,7 @@ static size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb,
r = sscanf(ptr, "Content-Length: %ld\n", &len);
if(r == 1)
*((long *) stream) = len;
*((long *)stream) = len;
return size * nmemb;
}

View File

@@ -430,9 +430,9 @@ int init_fifo(void)
int main(void)
{
struct GlobalInfo *g = g_malloc0(sizeof(struct GlobalInfo));
GMainLoop*gmain;
GMainLoop *gmain;
int fd;
GIOChannel* ch;
GIOChannel *ch;
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
if(res)

View File

@@ -33,7 +33,7 @@ static size_t write_cb(char *data, size_t n, size_t l, void *userp)
/* take care of the data here, ignored in this example */
(void)data;
(void)userp;
return n*l;
return n * l;
}
int main(void)

View File

@@ -88,7 +88,7 @@ struct input {
int num;
};
static void dump(const char *text, int num, unsigned char *ptr,
static void dump(const char *text, int num, const unsigned char *ptr,
size_t size, char nohex)
{
size_t i;

View File

@@ -34,7 +34,7 @@
#define TRUE 1
static void dump(const char *text, FILE *stream, unsigned char *ptr,
static void dump(const char *text, FILE *stream, const unsigned char *ptr,
size_t size, char nohex)
{
size_t i;

View File

@@ -171,8 +171,7 @@ tcpkeepalive(struct Curl_cfilter *cf,
if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set SO_KEEPALIVE on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
else {
#ifdef USE_WINSOCK
@@ -187,22 +186,19 @@ tcpkeepalive(struct Curl_cfilter *cf,
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
(const char *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPIDLE on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
optval = curlx_sltosi(data->set.tcp_keepintvl);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
(const char *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPINTVL on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
optval = curlx_sltosi(data->set.tcp_keepcnt);
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT,
(const char *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPCNT on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
}
else
@@ -239,8 +235,7 @@ tcpkeepalive(struct Curl_cfilter *cf,
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE,
(void *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPIDLE on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
#elif defined(TCP_KEEPALIVE)
/* macOS style */
@@ -249,8 +244,7 @@ tcpkeepalive(struct Curl_cfilter *cf,
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE,
(void *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
#elif defined(TCP_KEEPALIVE_THRESHOLD)
/* Solaris <11.4 style */
@@ -259,8 +253,7 @@ tcpkeepalive(struct Curl_cfilter *cf,
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE_THRESHOLD,
(void *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE_THRESHOLD on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
#endif
#ifdef TCP_KEEPINTVL
@@ -269,8 +262,7 @@ tcpkeepalive(struct Curl_cfilter *cf,
if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL,
(void *)&optval, sizeof(optval)) < 0) {
CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPINTVL on fd "
"%" FMT_SOCKET_T ": errno %d",
sockfd, SOCKERRNO);
"%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO);
}
#elif defined(TCP_KEEPALIVE_ABORT_THRESHOLD)
/* Solaris <11.4 style */

View File

@@ -469,13 +469,13 @@ static void time2filetime(struct ms_filetime *ft, time_t t)
{
#if SIZEOF_TIME_T > 4
t = (t + (curl_off_t)11644473600) * 10000000;
ft->dwLowDateTime = (unsigned int) (t & 0xFFFFFFFF);
ft->dwHighDateTime = (unsigned int) (t >> 32);
ft->dwLowDateTime = (unsigned int)(t & 0xFFFFFFFF);
ft->dwHighDateTime = (unsigned int)(t >> 32);
#else
unsigned int r, s;
unsigned int i;
ft->dwLowDateTime = (unsigned int)t & 0xFFFFFFFF;
ft->dwLowDateTime = (unsigned int)(t & 0xFFFFFFFF);
ft->dwHighDateTime = 0;
# ifndef HAVE_TIME_T_UNSIGNED

View File

@@ -286,7 +286,7 @@ enum assume {
static time_t time2epoch(int sec, int min, int hour,
int mday, int mon, int year)
{
static const int month_days_cumulative [12] =
static const int month_days_cumulative[12] =
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
int leap_days = year - (mon <= 1);
leap_days = ((leap_days / 4) - (leap_days / 100) + (leap_days / 400)

View File

@@ -241,7 +241,7 @@ static CURLcode tftp_set_timeouts(struct tftp_conn *state)
state->retry_time = 1;
infof(state->data,
"set timeouts for state %d; Total % " FMT_OFF_T ", retry %d maxtry %d",
"set timeouts for state %d; Total %" FMT_OFF_T ", retry %d maxtry %d",
(int)state->state, timeout_ms, state->retry_time, state->retry_max);
/* init RX time */
@@ -381,7 +381,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_conn *state,
static CURLcode tftp_option_add(struct tftp_conn *state, size_t *csize,
char *buf, const char *option)
{
if(( strlen(option) + *csize + 1) > (size_t)state->blksize)
if((strlen(option) + *csize + 1) > (size_t)state->blksize)
return CURLE_TFTP_ILLEGAL;
strcpy(buf, option);
*csize += strlen(option) + 1;

View File

@@ -494,7 +494,7 @@ add_ciphers:
for(j = 0; j < default_len; j++) {
entry = rustls_default_crypto_provider_ciphersuites_get(j);
if(rustls_supported_ciphersuite_protocol_version(entry) ==
RUSTLS_TLS_VERSION_TLSV1_3)
RUSTLS_TLS_VERSION_TLSV1_3)
continue;
/* No duplicates allowed (so selected cannot overflow) */

View File

@@ -566,8 +566,8 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
}
}
if((fInCert || blob) && (data->set.ssl.cert_type) &&
(!curl_strequal(data->set.ssl.cert_type, "P12"))) {
if((fInCert || blob) && data->set.ssl.cert_type &&
!curl_strequal(data->set.ssl.cert_type, "P12")) {
failf(data, "schannel: certificate format compatibility error "
" for %s",
blob ? "(memory blob)" : data->set.ssl.primary.clientcert);

View File

@@ -2016,4 +2016,4 @@ CURL_EXTERN CURLcode curl_ws_start_frame(CURL *curl,
return CURLE_NOT_BUILT_IN;
}
#endif /* !CURL_DISABLE_WEBSOCKETS */
#endif /* !CURL_DISABLE_WEBSOCKETS && !CURL_DISABLE_HTTP */

View File

@@ -357,7 +357,7 @@ if(!$opt_n) {
report "LWP is not available (LWP::UserAgent not found)";
exit 1;
}
my $ua = new LWP::UserAgent(agent => "$0/$version");
my $ua = new LWP::UserAgent(agent => "$0/$version");
$ua->env_proxy();
$resp = $ua->mirror($url, $txt);
if($resp && $resp->code eq '304') {

View File

@@ -42,7 +42,7 @@ echo "parallel: ${procs}"
elif git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
{
git ls-files | grep -E '\.(pl|pm)$'
git grep -l -E '^#!/usr/bin/env perl'
git grep -l '^#!/usr/bin/env perl'
} | sort -u
else
# strip off the leading ./ to make the grep regexes work properly

View File

@@ -31,7 +31,7 @@
# ECH command line args
def CombinationRepetitionUtil(chosen, arr, badarr, index,
r, start, end):
r, start, end):
# Current combination is ready,
# print it
@@ -68,9 +68,9 @@ def CombinationRepetitionUtil(chosen, arr, badarr, index,
# with next (Note that i+1 is passed,
# but index is not changed)
CombinationRepetitionUtil(chosen, arr, badarr, index + 1,
r, start, end)
r, start, end)
CombinationRepetitionUtil(chosen, arr, badarr, index,
r, start + 1, end)
r, start + 1, end)
# The main function that prints all
# combinations of size r in arr[] of
@@ -94,5 +94,3 @@ r = 8
n = len(arr) - 1
CombinationRepetition(arr, badarr, n, r)
# This code is contributed by Vaibhav Kumar 12.

View File

@@ -3044,7 +3044,7 @@ while(@ARGV) {
}
}
else {
print STDERR "\nWarning: ftpserver.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: ftpserver.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}

View File

@@ -398,7 +398,7 @@ sub writearray {
my ($filename, $arrayref)=@_;
open(my $temp, ">", "$filename") || die "Failure writing file";
binmode($temp,":raw"); # Cygwin fix by Kevin Roth
binmode($temp,":raw"); # Cygwin fix
for(@$arrayref) {
print $temp $_;
}

View File

@@ -140,7 +140,7 @@ while(@ARGV) {
$verbose = 1;
}
else {
print STDERR "\nWarning: http-server.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: http-server.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}

View File

@@ -102,7 +102,7 @@ while(@ARGV) {
}
}
elsif($ARGV[0]) {
print STDERR "\nWarning: http2-server.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: http2-server.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}

View File

@@ -102,7 +102,7 @@ while(@ARGV) {
}
}
else {
print STDERR "\nWarning: http3-server.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: http3-server.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}

View File

@@ -104,7 +104,7 @@ while(@ARGV) {
$verbose = 1;
}
else {
print STDERR "\nWarning: rtspserver.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: rtspserver.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}

View File

@@ -176,7 +176,7 @@ while(@ARGV) {
$mtls = 1;
}
else {
print STDERR "\nWarning: secureserver.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: secureserver.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}

View File

@@ -191,7 +191,7 @@ while(@ARGV) {
}
}
else {
print STDERR "\nWarning: sshserver.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: sshserver.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}

View File

@@ -104,7 +104,7 @@ while(@ARGV) {
$verbose = 1;
}
else {
print STDERR "\nWarning: tftpserver.pl unknown parameter: $ARGV[0]\n";
print STDERR "\nWarning: tftpserver.pl unknown parameter: '$ARGV[0]'\n";
}
shift @ARGV;
}