Compare commits

...

20 Commits

Author SHA1 Message Date
Viktor Szakats
b4834a7d6d
examples: prefer return over exit() (cont.)
Some of these calls were not in callbacks. These examples may leak
handles.

Also fix some whitespace.

Follow-up to 08c7c937dc #16507
Closes #16524
2025-03-01 02:09:02 +01:00
Viktor Szakats
5693342ec2
winbuild: reduce command-line length by dropping whitespace
Keep the `@for %%i in [...]` lines within limits by stripping whitespace
from the input `.c` source lists read from `Makefile.inc`. To avoid this
error after adding a new `.c` source:
```
configuration name: libcurl-vc14-x64-release-dll-ssl-dll-ipv6-sspi
NMAKE : fatal error U1095: expanded command line 'for %i in (altsvc.obj            amigaos.obj
           asyn-ares.obj         asyn-thread.obj       base64.obj            bufq.obj
              bufref.obj            cf-h1-proxy.obj       cf-h2-proxy.obj       cf-haproxy.obj [...]
  vssh/wolfssh.obj) do @echo ..\builds\libcurl-vc14-x64-release-dll-ssl-dll-ipv6-sspi-obj-lib/%i \
                   ' too long
Stop.
Command exited with code 2
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51605338/job/dqg6qtebtscb279g#L44

Reported-by: Stefan Eissing
Bug: https://github.com/curl/curl/pull/16508#issuecomment-2690443409
Fixes #16521
Closes #16528
2025-03-01 02:04:42 +01:00
Dan Fandrich
c693cc02b0 docs: vulnerabilities in debug code are not eligible for a bounty
This is code that is off by default and is therefore treated as a
regular bug.

Ref: #16526
Closes #16527
2025-02-28 14:21:46 -08:00
Viktor Szakats
e7751571eb
GHA/macos: use quictls in some jobs, other small improvements
- enable quictls in autotools and cmake jobs. autotools requires
  a workaround due to wrong libpath in the quictls pkg-config.
  nghttp3 is offered by Homebrew, but not ngtcp2, to enable H3.

- install `libnghttp2` rather than `nghttp2`.
  `libnghttp2` is preinstalled and smaller. It also avoids detecting
  `nghttpx`, which confuses `pytest`.

- limit `brew unlink openssl` to libressl/quictls jobs.

Closes #16517
2025-02-28 16:58:12 +01:00
Zhaoming Luo
7211576442
tests: fix comment in lib533
Closes #16523
2025-02-28 16:12:20 +01:00
Stefan Eissing
794dfe7fc4
gnutls: fix use of pkcs11 urls for keys/certs
Fixes #16249
Forwarded-to-us-by: Carlos Henrique Lima Melara

Always use `gnutls_certificate_set_x509_key_file2()` for loading keys
and certificates, even without a password, since this function support
pkcs11 urls.

Thanks to @tatsuhiro-t for finding this out.
Help-by: Tatsuhiro Tsujikawa

Closes #16472
2025-02-28 16:08:10 +01:00
Viktor Szakats
049352dd80
cmake: allow CURL_STATIC_CRT with shared libcurl and no curl exe
Follow-up to edfa537100 #16456

Closes #16516
2025-02-28 13:11:41 +01:00
Viktor Szakats
08c7c937dc
tidy-up: prefer return over exit(), fix fallouts
To avoid breaking the control flow and align to majority of code
already using `return`.

`exit()` has the side-effect of suppressing leak detection in cases.
Fix fallouts detected after switching to `return`.

- configure:
  - fix `getaddrinfo` run test to call `freeaddrinfo()` to pacify ASAN,
    and call `WSACleanup()` to deinit winsock2.
  - fix `getifaddrs` run test to call `freeifaddrs()` to pacify ASAN.
- tests/server:
  - setup `atexit(win32_cleanup)` via `win32_init()`.
  - return 2 instead of 1 on winsock2 init failures.
  - sws: goto cleanup instead of `exit()` in `http_connect()`.
    Follow-up to 02dfe71937 #7235
- tests/client/http:
  - cleanup memory to pacify ASAN in `h2-upgrade-extreme`,
    `tls-session-reuse`.
- examples:
  - block_ip: fix memory leak reported by CI.
  - http2-upload: avoid handle leaks.

Untouched `exit()` calls, made from callbacks:
- docs/examples: ephiperfifo.c, ghiper.c, hiperfifo.c
- tests/libtest: lib582.c, lib655.c, lib670.c
- tests/server: tftpd.c

Closes #16507
2025-02-28 13:11:41 +01:00
Stefan Eissing
2e585f5640
test488: set --output-dir
Otherwise the downloaded files land in the `tests` directory and
show up in git status.

Closes #16519
2025-02-28 12:47:31 +01:00
Viktor Szakats
399cb7130a
cmake: drop HAVE_C_FLAG_Wno_long_double logic for ancient Apple gcc
The initial curl CMake commit introduced it in 2009-04-02 via
4c5307b456. Suppressing a stray
`-Wlong-double` warning in `mprintf.c`. This was before Apple switched
to clang, and likely affected the Apple distributed GCC, version 4.2.1
at the time. It applied the workaround to CMake builds only, though
the issue seems build-tool agnostic. Yet, it was not suppressed or
reported for autotools builds.

For these reasons this logic seems obsolete and this patch drops it with
no replacement. It saves a feature detection for GCC builds for macOS.

In PR sub-commits I added (and reverted) in-source suppression. In case
it becomes necessary, that should fix it for all build tools.

Closes #16513
2025-02-28 03:40:40 +01:00
Viktor Szakats
5a021aba41
cmake: improve httpd detection for pytest
Look for `httpd` in addition to `apache2`, like `./configure` does.
It fixes detection with macOS Homebrew for example.

Closes #16515
2025-02-28 03:40:40 +01:00
Viktor Szakats
6913c9b6ab
GHA/linux: improve 'test configs' step, don't set TFLAGS for pytest
- omit comments from th config dump, show filenames for each line.
- `TFLAGS` is not used by pytest, don't set it.

Closes #16514
2025-02-28 03:40:40 +01:00
Daniel Stenberg
953cd694dc
asyn-ares: use the correct port number
Only triggers with old c-ares versions.

Follow-up to 8ded8e5f3f

Closes #16511
2025-02-27 22:18:43 +01:00
Viktor Szakats
af6172c8f2
GHA/linux: merge two package install steps
Merge pytest prereq package install step into the main package install
step, to save install time.

Closes #16509
2025-02-27 20:32:50 +01:00
Daniel Stenberg
8ded8e5f3f
urldata: remove 'hostname' from struct Curl_async
It is unnecessary duplicated information, as the host name being
resolved is already present in conn->host.

Closes #16451
2025-02-27 17:18:43 +01:00
Daniel Stenberg
7007f59caa
GHA: spellcheck curl symbols better
This now makes sure to trim off exact matches for curl symbols and long
curl commanad line options instead of using pattern matching as before.
This should catch typoed names (that still follow the pattern) better.

The cleanspell.pl script is no longer used. cleancmd.pl is used for all
markdown files.

Closes #16504
2025-02-27 13:15:21 +01:00
Daniel Stenberg
a8ad9a5758
docs: minor edits to please the new spellchecker regime 2025-02-27 13:15:21 +01:00
Viktor Szakats
cba83bfb10
runtests: accept CURL_DIRSUFFIX without ending slash
Follow-up to 3585796049 #16452
Closes #16506
2025-02-27 12:11:23 +01:00
Viktor Szakats
59f4727480
appveyor: run VS2008 job with old CMake 3.12.2
Switch VS2008 job the oldest runner machine. It adds the oldest CMake to
the Windows mix, from 2018-11-30. Not a beauty, missing support for `-B`
and Unity, but it's a version curl supports. It's newer than Old Linux.
The previous oldest was 3.16.2. It remains used with VS2010-VS2017.

Also:
- fix VS2008 job to actually build examples.
- switch VS2019 job to OpenSSL 1.1.0 that wasn't tested before.
  Migrate OpenSSL 1.0.2 to the VS2008 job.
- measure run time of individual build steps.

Follow-up to 01c25e3b00 #16458
Closes #16505
2025-02-27 12:11:08 +01:00
Viktor Szakats
08a29e7f18
GHA: tidy up parallel options, improve performance for some jobs
- replace `--parallel <n>` and `-j<n>` for individual commands with
  `MAKEFLAGS`, for jobs not yet doing it.
  This enables parallel builds in distcheck / maketgz-and-verify-in-tree,
  where `-j` option was missing.
- add `--parallel` for iOS Xcode job for improved performance.
- drop redundant `-j5` for Android jobs.
- drop stray `cmake --config` options from single-target jobs (cygwin,
  msys/mingw, dl-mingw, non-native). Drop redundant
  `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` settings too.
- GHA/windows: add timeout for package install steps where missing.
- GHA/non-native: specify target type explicitly for iOS cmake jobs.
  Xcode default was already Debug, single-target default was generic,
  now it's Release, with unity batch to keep it fast.

`MAKEFLAGS` is necessary for autotools jobs and CMake jobs using
the default (GNU Make) generator. It's ignored by Ninja and other tools.
`cmake --parallel` is still necessary for jobs with Visual Studio or
Xcode generators. Parallelism is 5 for GHA Linux and Windows runners,
4 for macOS, 3 for VMs, 2 for AppVeyor.

Closes #16502
2025-02-27 12:11:07 +01:00
70 changed files with 764 additions and 580 deletions

View File

@ -3,55 +3,117 @@
#
# SPDX-License-Identifier: curl
#
# Input: a cmdline docs markdown, it gets modified *in place*
# Input: cmdline docs markdown files, they get modified *in place*
#
# Strip off the leading meta-data/header part, remove all known curl symbols
# and long command line options. Also clean up whatever else the spell checker
# might have a problem with that we still deem is fine.
#
# The main purpose is to strip off the leading meta-data part, but also to
# clean up whatever else the spell checker might have a problem with that we
# still deem is fine.
my $header = 1;
while(1) {
# set this if the markdown has no meta-data header to skip
if($ARGV[0] eq "--no-header") {
shift @ARGV;
$header = 0;
}
else {
last;
open(S, "<./docs/libcurl/symbols-in-versions")
|| die "can't find symbols-in-versions";
while(<S>) {
if(/^([^ ]*) /) {
push @asyms, $1;
}
}
close(S);
my $f = $ARGV[0];
# init the opts table with "special" options not easy to figure out
my @aopts = (
'--ftp-ssl-reqd', # old alias
);
open(F, "<$f") or die;
my $ignore = $header;
my $sepcount = 0;
my @out;
while(<F>) {
if(/^---/ && $header) {
if(++$sepcount == 2) {
$ignore = 0;
open(O, "<./docs/options-in-versions")
|| die "can't find options-in-versions";
while(<O>) {
chomp;
if(/^([^ ]+)/) {
my $o = $1;
push @aopts, $o;
if($o =~ /^--no-(.*)/) {
# for the --no options, also make one without it
push @aopts, "--$1";
}
elsif($o =~ /^--disable-(.*)/) {
# for the --disable options, also make the special ones
push @aopts, "--$1";
push @aopts, "--no-$1";
}
}
}
close(O);
open(C, "<./.github/scripts/spellcheck.curl")
|| die "can't find spellcheck.curl";
while(<C>) {
if(/^\#/) {
next;
}
next if($ignore);
# strip out backticked words
$_ =~ s/`[^`]+`//g;
# strip out all long command line options
$_ =~ s/--[a-z0-9-]+//g;
# strip out https URLs, we don't want them spellchecked
$_ =~ s!https://[a-z0-9\#_/.-]+!!gi;
push @out, $_;
chomp;
if(/^([^ ]+)/) {
push @asyms, $1;
}
}
close(F);
close(C);
if(!$ignore) {
open(O, ">$f") or die;
print O @out;
close(O);
# longest symbols first
my @syms = sort { length($b) <=> length($a) } @asyms;
# longest cmdline options first
my @opts = sort { length($b) <=> length($a) } @aopts;
sub process {
my ($f) = @_;
my $ignore = 0;
my $sepcount = 0;
my $out;
my $line = 0;
open(F, "<$f") or die;
while(<F>) {
$line++;
if(/^---/ && ($line == 1)) {
$ignore = 1;
next;
}
elsif(/^---/ && $ignore) {
$ignore = 0;
next;
}
next if($ignore);
my $l = $_;
# strip out backticked words
$l =~ s/`[^`]+`//g;
# **bold**
$l =~ s/\*\*(\S.*?)\*\*//g;
# *italics*
$l =~ s/\*(\S.*?)\*//g;
# strip out https URLs, we don't want them spellchecked
$l =~ s!https://[a-z0-9\#_/.-]+!!gi;
$out .= $l;
}
close(F);
# cut out all known curl cmdline options
map { $out =~ s/$_//g; } (@opts);
# cut out all known curl symbols
map { $out =~ s/\b$_\b//g; } (@syms);
if(!$ignore) {
open(O, ">$f") or die;
print O $out;
close(O);
}
}
for my $f (@ARGV) {
process($f);
}

View File

@ -1,86 +0,0 @@
#!/usr/bin/env perl
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# SPDX-License-Identifier: curl
#
# Given: a libcurl curldown man page
# Outputs: the same file, minus the SYNOPSIS and the EXAMPLE sections
#
my $f = $ARGV[0];
open(F, "<$f") or die;
my @out;
my $ignore = 0;
while(<F>) {
if($_ =~ /^# (SYNOPSIS|EXAMPLE)/) {
$ignore = 1;
}
elsif($ignore && ($_ =~ /^# [A-Z]/)) {
$ignore = 0;
}
elsif(!$ignore) {
# **bold**
$_ =~ s/\*\*(\S.*?)\*\*//g;
# *italics*
$_ =~ s/\*(\S.*?)\*//g;
$_ =~ s/CURL(M|SH|U|H)code//g;
$_ =~ s/CURL_[A-Z0-9_]*//g;
$_ =~ s/CURLALTSVC_[A-Z0-9_]*//g;
$_ =~ s/CURLAUTH_[A-Z0-9_]*//g;
$_ =~ s/CURLE_[A-Z0-9_]*//g;
$_ =~ s/CURLFORM_[A-Z0-9_]*//g;
$_ =~ s/CURLFTP_[A-Z0-9_]*//g;
$_ =~ s/CURLFTPAUTH_[A-Z0-9_]*//g;
$_ =~ s/CURLFTPMETHOD_[A-Z0-9_]*//g;
$_ =~ s/CURLFTPSSL_[A-Z0-9_]*//g;
$_ =~ s/CURLGSSAPI_[A-Z0-9_]*//g;
$_ =~ s/CURLHEADER_[A-Z0-9_]*//g;
$_ =~ s/CURLINFO_[A-Z0-9_]*//g;
$_ =~ s/CURLM_[A-Z0-9_]*//g;
$_ =~ s/CURLMIMEOPT_[A-Z0-9_]*//g;
$_ =~ s/CURLMOPT_[A-Z0-9_]*//g;
$_ =~ s/CURLOPT_[A-Z0-9_]*//g;
$_ =~ s/CURLPIPE_[A-Z0-9_]*//g;
$_ =~ s/CURLPROTO_[A-Z0-9_]*//g;
$_ =~ s/CURLPROXY_[A-Z0-9_]*//g;
$_ =~ s/CURLPX_[A-Z0-9_]*//g;
$_ =~ s/CURLSHE_[A-Z0-9_]*//g;
$_ =~ s/CURLSHOPT_[A-Z0-9_]*//g;
$_ =~ s/CURLSSLOPT_[A-Z0-9_]*//g;
$_ =~ s/CURLSSH_[A-Z0-9_]*//g;
$_ =~ s/CURLSSLBACKEND_[A-Z0-9_]*//g;
$_ =~ s/CURLU_[A-Z0-9_]*//g;
$_ =~ s/CURLUPART_[A-Z0-9_]*//g;
#$_ =~ s/\bCURLU\b//g; # stand-alone CURLU
$_ =~ s/CURLUE_[A-Z0-9_]*//g;
$_ =~ s/CURLHE_[A-Z0-9_]*//g;
$_ =~ s/CURLWS_[A-Z0-9_]*//g;
$_ =~ s/CURLKH[A-Z0-9_]*//g;
$_ =~ s/CURLUPART_[A-Z0-9_]*//g;
$_ =~ s/CURLUSESSL_[A-Z0-9_]*//g;
$_ =~ s/CURLPAUSE_[A-Z0-9_]*//g;
$_ =~ s/CURLHSTS_[A-Z0-9_]*//g;
$_ =~ s/curl_global_([a-z_]*)//g;
$_ =~ s/curl_(strequal|strnequal|formadd|waitfd|formget|getdate|formfree)//g;
$_ =~ s/curl_easy_([a-z]*)//g;
$_ =~ s/curl_multi_([a-z_]*)//g;
$_ =~ s/curl_mime_(subparts|addpart|filedata|data_cb)//g;
$_ =~ s/curl_ws_(send|recv|meta)//g;
$_ =~ s/curl_url_(dup)//g;
$_ =~ s/curl_pushheader_by(name|num)//g;
$_ =~ s/libcurl-(env|ws)//g;
$_ =~ s/libcurl\\-(env|ws)//g;
$_ =~ s/(^|\W)((tftp|https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=\\]+)//gi;
push @out, $_;
}
}
close(F);
open(O, ">$f") or die;
for my $l (@out) {
print O $l;
}
close(O);

151
.github/scripts/spellcheck.curl vendored Normal file
View File

@ -0,0 +1,151 @@
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# SPDX-License-Identifier: curl
#
# common variable types + structs
# callback typedefs
# public functions names
# some man page names
curl_fileinfo
curl_forms
curl_hstsentry
curl_httppost
curl_index
curl_khkey
curl_pushheaders
curl_waitfd
CURLcode
CURLformoption
CURLHcode
CURLMcode
CURLMsg
CURLSHcode
CURLUcode
curl_calloc_callback
curl_chunk_bgn_callback
curl_chunk_end_callback
curl_conv_callback
curl_debug_callback
curl_fnmatch_callback
curl_formget_callback
curl_free_callback
curl_hstsread_callback
curl_hstswrite_callback
curl_ioctl_callback
curl_malloc_callback
curl_multi_timer_callback
curl_opensocket_callback
curl_prereq_callback
curl_progress_callback
curl_push_callback
curl_read_callback
curl_realloc_callback
curl_resolver_start_callback
curl_seek_callback
curl_socket_callback
curl_sockopt_callback
curl_ssl_ctx_callback
curl_strdup_callback
curl_trailer_callback
curl_write_callback
curl_xferinfo_callback
curl_strequal
curl_strnequal
curl_mime_init
curl_mime_free
curl_mime_addpart
curl_mime_name
curl_mime_filename
curl_mime_type
curl_mime_encoder
curl_mime_data
curl_mime_filedata
curl_mime_data_cb
curl_mime_subparts
curl_mime_headers
curl_formadd
curl_formget
curl_formfree
curl_getdate
curl_getenv
curl_version
curl_easy_escape
curl_escape
curl_easy_unescape
curl_unescape
curl_free
curl_global_init
curl_global_init_mem
curl_global_cleanup
curl_global_trace
curl_global_sslset
curl_slist_append
curl_slist_free_all
curl_getdate
curl_share_init
curl_share_setopt
curl_share_cleanup
curl_version_info
curl_easy_strerror
curl_share_strerror
curl_easy_pause
curl_easy_ssls_import
curl_easy_ssls_export
curl_easy_init
curl_easy_setopt
curl_easy_perform
curl_easy_cleanup
curl_easy_getinfo
curl_easy_duphandle
curl_easy_reset
curl_easy_recv
curl_easy_send
curl_easy_upkeep
curl_easy_header
curl_easy_nextheader
curl_mprintf
curl_mfprintf
curl_msprintf
curl_msnprintf
curl_mvprintf
curl_mvfprintf
curl_mvsprintf
curl_mvsnprintf
curl_maprintf
curl_mvaprintf
curl_multi_init
curl_multi_add_handle
curl_multi_remove_handle
curl_multi_fdset
curl_multi_waitfds
curl_multi_wait
curl_multi_poll
curl_multi_wakeup
curl_multi_perform
curl_multi_cleanup
curl_multi_info_read
curl_multi_strerror
curl_multi_socket
curl_multi_socket_action
curl_multi_socket_all
curl_multi_timeout
curl_multi_setopt
curl_multi_assign
curl_multi_get_handles
curl_pushheader_bynum
curl_pushheader_byname
curl_multi_waitfds
curl_easy_option_by_name
curl_easy_option_by_id
curl_easy_option_next
curl_url
curl_url_cleanup
curl_url_dup
curl_url_get
curl_url_set
curl_url_strerror
curl_ws_recv
curl_ws_send
curl_ws_meta
libcurl-env
libcurl-ws

View File

@ -107,20 +107,8 @@ jobs:
persist-credentials: false
name: checkout
- name: trim all man page *.md files
run: find docs -name "*.md" ! -name "_*" -print0 | xargs -0 -n1 .github/scripts/cleancmd.pl
- name: trim libcurl man page *.md files
run: find docs/libcurl \( -name "curl_*.md" -o -name "libcurl*.md" \) -print0 | xargs -0 -n1 .github/scripts/cleanspell.pl
- name: trim libcurl option man page *.md files
run: find docs/libcurl/opts -name "CURL*.md" -print0 | xargs -0 -n1 .github/scripts/cleanspell.pl
- name: trim cmdline docs markdown _*.md files
run: find docs/cmdline-opts -name "_*.md" -print0 | xargs -0 -n1 .github/scripts/cleancmd.pl --no-header
- name: trim docs/ markdown _*.md files
run: git ls-files docs/*.md docs/internals/*.md | xargs -n1 .github/scripts/cleancmd.pl --no-header
- name: trim all *.md files in docs/
run: .github/scripts/cleancmd.pl $(find docs -name "*.md")
- name: setup the custom wordlist
run: grep -v '^#' .github/scripts/spellcheck.words > wordlist.txt

View File

@ -19,6 +19,9 @@ concurrency:
permissions: {}
env:
MAKEFLAGS: -j 5
jobs:
maketgz-and-verify-in-tree:
runs-on: ubuntu-latest
@ -55,9 +58,9 @@ jobs:
tar xvf curl-99.98.97.tar.gz
pushd curl-99.98.97
./configure --prefix=$HOME/temp --without-ssl --without-libpsl
make -j5
make -j5 test-ci
make -j5 install
make
make test-ci
make install
popd
# basic check of the installed files
bash scripts/installcheck.sh $HOME/temp
@ -80,8 +83,8 @@ jobs:
mkdir build
pushd build
../curl-99.98.97/configure --without-ssl --without-libpsl
make -j5
make -j5 test-ci
make
make test-ci
popd
rm -rf build
rm -rf curl-99.98.97
@ -103,9 +106,9 @@ jobs:
mkdir build
pushd build
../configure --without-ssl --enable-debug "--prefix=${PWD}/pkg" --without-libpsl
make -j5
make -j5 test-ci
make -j5 install
make
make test-ci
make install
verify-out-of-tree-cmake:
runs-on: ubuntu-latest
@ -122,7 +125,7 @@ jobs:
tar xvf curl-99.98.97.tar.gz
pushd curl-99.98.97
cmake -B build -DCURL_WERROR=ON -DCURL_USE_LIBPSL=OFF
make -C build -j5
make -C build
missing-files:
runs-on: ubuntu-latest

View File

@ -454,9 +454,7 @@ jobs:
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'test configs'
run: |
cat bld/tests/config || true
cat bld/tests/http/config.ini || true
run: grep -H -v '^#' bld/tests/config bld/tests/http/config.ini || true
- name: 'build'
run: |
@ -500,7 +498,6 @@ jobs:
- name: 'run pytest event based'
env:
TFLAGS: '${{ matrix.build.tflags }}'
CURL_TEST_EVENT: 1
CURL_CI: github
PYTEST_ADDOPTS: '--color=yes'

View File

@ -304,7 +304,8 @@ jobs:
libtool autoconf automake pkgconf ninja-build \
${{ matrix.build.install_steps != 'skipall' && matrix.build.install_steps != 'skiprun' && 'stunnel4' || '' }} \
libpsl-dev libbrotli-dev libzstd-dev \
${{ matrix.build.install_packages }}
${{ matrix.build.install_packages }} \
${{ contains(matrix.build.install_steps, 'pytest') && 'apache2 apache2-dev libnghttp2-dev vsftpd' || '' }}
python3 -m venv $HOME/venv
- name: 'install prereqs'
@ -319,11 +320,6 @@ jobs:
${{ matrix.build.install_packages }}
python3 -m venv $HOME/venv
- name: 'install prereqs for pytest'
if: contains(matrix.build.install_steps, 'pytest')
run: |
sudo apt-get -o Dpkg::Use-Pty=0 install apache2 apache2-dev libnghttp2-dev vsftpd
- name: 'install dependencies'
if: startsWith(matrix.build.container, 'alpine')
run: |
@ -616,9 +612,7 @@ jobs:
grep -F '#define' bld/lib/curl_config.h | sort || true
- name: 'test configs'
run: |
cat bld/tests/config || true
cat bld/tests/http/config.ini || true
run: grep -H -v '^#' bld/tests/config bld/tests/http/config.ini || true
- name: 'build'
run: |
@ -694,7 +688,6 @@ jobs:
- name: 'run pytest'
if: contains(matrix.build.install_steps, 'pytest')
env:
TFLAGS: '${{ matrix.build.tflags }}'
CURL_CI: github
PYTEST_ADDOPTS: '--color=yes'
run: |

View File

@ -47,8 +47,8 @@ permissions: {}
# newer than the 10.8 required by `CFURLCreateDataAndPropertiesFromResource`.
env:
LDFLAGS: -w # suppress 'object file was built for newer macOS version than being linked' warnings
MAKEFLAGS: -j 4
LDFLAGS: -w # suppress 'object file was built for newer macOS version than being linked' warnings
jobs:
macos:
@ -123,9 +123,10 @@ jobs:
compiler: clang
configure: --enable-debug --with-openssl=$(brew --prefix openssl)
tflags: --test-event
- name: 'OpenSSL libssh2 !ldap 10.15'
- name: 'quictls libssh2 !ldap 10.15'
compiler: clang
configure: --enable-debug --disable-ldap --with-openssl=$(brew --prefix openssl)
install: quictls
configure: --enable-debug --disable-ldap --with-openssl=$(brew --prefix quictls) LDFLAGS="${LDFLAGS} -L$(brew --prefix quictls)/lib"
macos-version-min: '10.15'
# cmake
- name: 'OpenSSL gsasl rtmp AppleIDN'
@ -136,9 +137,9 @@ jobs:
generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DUSE_APPLE_IDN=ON -DCURL_CLANG_TIDY=ON -DCLANG_TIDY=$(brew --prefix llvm)/bin/clang-tidy
clang-tidy: true
chkprefill: _chkprefill
- name: 'OpenSSL +static libssh +examples'
install: libssh
generate: -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DBUILD_STATIC_LIBS=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
- name: 'quictls +static libssh +examples'
install: quictls libssh
generate: -DOPENSSL_ROOT_DIR=$(brew --prefix quictls) -DBUILD_STATIC_LIBS=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
- name: 'SecureTransport debug'
generate: -DCURL_USE_SECTRANSP=ON -DENABLE_DEBUG=ON
macos-version-min: '10.8'
@ -184,11 +185,12 @@ jobs:
run: |
echo ${{ matrix.build.generate && 'ninja' || 'automake libtool' }} \
pkgconf libpsl libssh2 \
${{ !matrix.build.clang-tidy && 'nghttp2 stunnel' || '' }} \
${{ !matrix.build.clang-tidy && 'libnghttp2 stunnel' || '' }} \
${{ matrix.build.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
- name: 'brew unlink openssl'
if: ${{ contains(matrix.build.install, 'libressl') || contains(matrix.build.install, 'quictls') }}
run: |
if test -d $(brew --prefix)/include/openssl; then
brew unlink openssl
@ -343,7 +345,7 @@ jobs:
if: ${{ contains(matrix.build.name, '+examples') }}
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build bld --target curl-examples --verbose
cmake --build bld --verbose --target curl-examples
else
make -C bld examples V=1
fi

View File

@ -59,21 +59,21 @@ jobs:
time cmake -B bld -G Ninja \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug \
-DCURL_USE_OPENSSL=ON \
-DCURL_USE_GSSAPI=ON \
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
time cmake --build bld --config Debug
time cmake --build bld
bld/src/curl --disable --version
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time cmake --build bld --config Debug --target testdeps
time cmake --build bld --target testdeps
export TFLAGS='-j4'
time cmake --build bld --config Debug --target test-ci
time cmake --build bld --target test-ci
fi
echo '::group::build examples'
time cmake --build bld --config Debug --target curl-examples
time cmake --build bld --target curl-examples
echo '::endgroup::'
openbsd:
@ -100,20 +100,20 @@ jobs:
time cmake -B bld -G Ninja \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug \
-DCURL_USE_OPENSSL=ON \
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
time cmake --build bld --config Debug
time cmake --build bld
bld/src/curl --disable --version
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time cmake --build bld --config Debug --target testdeps
time cmake --build bld --target testdeps
export TFLAGS='-j8 ~3017 ~TFTP ~FTP' # FIXME: TFTP requests executed twice? Related: `curl: (69) TFTP: Access Violation`?
time cmake --build bld --config Debug --target test-ci
time cmake --build bld --target test-ci
fi
echo '::group::build examples'
time cmake --build bld --config Debug --target curl-examples
time cmake --build bld --target curl-examples
echo '::endgroup::'
freebsd:
@ -140,6 +140,7 @@ jobs:
version: '14.1'
architecture: ${{ matrix.arch }}
run: |
export MAKEFLAGS=-j3
# https://ports.freebsd.org/
time sudo pkg install -y autoconf automake libtool \
pkgconf brotli openldap26-client libidn2 libnghttp2 stunnel py311-impacket
@ -154,18 +155,18 @@ jobs:
|| { tail -n 1000 config.log; false; }
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
time make -j3 install
time make install
src/curl --disable --version
desc='${{ matrix.desc }}'
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time make -j3 -C tests
time make -C tests
if [ "${desc#*!runtests*}" = "${desc}" ]; then
time make test-ci V=1 TFLAGS='-j4'
fi
fi
if [ "${desc#*!examples*}" = "${desc}" ]; then
echo '::group::build examples'
time make -j3 examples
time make examples
echo '::endgroup::'
fi
@ -184,25 +185,25 @@ jobs:
-DCMAKE_C_COMPILER='${{ matrix.compiler }}' \
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug \
-DCURL_USE_OPENSSL=ON \
-DCURL_USE_GSSAPI=ON \
${{ matrix.options }} \
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
time cmake --build bld --config Debug
time cmake --build bld
bld/src/curl --disable --version
desc='${{ matrix.desc }}'
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
time cmake --build bld --config Debug --target testdeps
time cmake --build bld --target testdeps
if [ "${desc#*!runtests*}" = "${desc}" ]; then
time cmake --build bld --config Debug --target test-ci
time cmake --build bld --target test-ci
fi
fi
if [ "${desc#*!examples*}" = "${desc}" ]; then
echo '::group::build examples'
time cmake --build bld --config Debug --target curl-examples
time cmake --build bld --target curl-examples
echo '::endgroup::'
fi
@ -223,6 +224,7 @@ jobs:
run: |
set -e
ln -s /usr/bin/gcpp /usr/bin/cpp # Some tests expect `cpp`, which is named `gcpp` in this env.
export MAKEFLAGS=-j3
time autoreconf -fi
mkdir bld && cd bld && time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
--prefix="${HOME}"/install \
@ -231,12 +233,12 @@ jobs:
|| { tail -n 1000 config.log; false; }
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
time gmake -j3 install
time gmake install
src/curl --disable --version
time gmake -j3 -C tests
time gmake -C tests
time gmake test-ci V=1
echo '::group::build examples'
time gmake -j3 examples
time gmake examples
echo '::endgroup::'
ios:
@ -244,9 +246,9 @@ jobs:
runs-on: 'macos-latest'
timeout-minutes: 10
env:
MAKEFLAGS: -j 4
DEVELOPER_DIR: "/Applications/Xcode${{ matrix.build.xcode && format('_{0}', matrix.build.xcode) || '' }}.app/Contents/Developer"
CC: ${{ matrix.build.compiler || 'clang' }}
MAKEFLAGS: -j 4
# renovate: datasource=github-tags depName=libressl-portable/portable versioning=semver registryUrl=https://github.com
libressl-version: 4.0.0
strategy:
@ -261,6 +263,7 @@ jobs:
install_steps: libressl
# FIXME: Could not make OPENSSL_ROOT_DIR work. CMake seems to prepend sysroot to it.
generate: >-
-DCMAKE_BUILD_TYPE=Release -DCMAKE_UNITY_BUILD_BATCH_SIZE=50
-DOPENSSL_INCLUDE_DIR="$HOME/libressl/include"
-DOPENSSL_SSL_LIBRARY="$HOME/libressl/lib/libssl.a"
-DOPENSSL_CRYPTO_LIBRARY="$HOME/libressl/lib/libcrypto.a"
@ -269,6 +272,7 @@ jobs:
- name: 'libressl'
install_steps: libressl
generator: Xcode
options: --config Debug
generate: >-
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=OFF
-DMACOSX_BUNDLE_GUI_IDENTIFIER=se.curl
@ -361,7 +365,7 @@ jobs:
- name: 'build'
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build bld --verbose
cmake --build bld ${{ matrix.build.options }} --parallel 4 --verbose
else
make -C bld V=1
fi
@ -372,7 +376,7 @@ jobs:
- name: 'build tests'
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build bld --target testdeps --verbose
cmake --build bld ${{ matrix.build.options }} --parallel 4 --target testdeps --verbose
else
make -C bld V=1 -C tests
fi
@ -380,7 +384,7 @@ jobs:
- name: 'build examples'
run: |
if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build bld --target curl-examples --verbose
cmake --build bld ${{ matrix.build.options }} --parallel 4 --target curl-examples --verbose
else
make -C bld examples V=1
fi
@ -390,9 +394,9 @@ jobs:
runs-on: 'ubuntu-latest'
timeout-minutes: 25
env:
MAKEFLAGS: -j 5
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
VCPKG_DISABLE_METRICS: '1'
MAKEFLAGS: -j 5
strategy:
matrix:
include:
@ -490,7 +494,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --verbose
else
make -j5 -C bld V=1
make -C bld V=1
fi
- name: 'curl info'
@ -501,7 +505,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target testdeps
else
make -j5 -C bld -C tests
make -C bld -C tests
fi
- name: 'build examples'
@ -509,7 +513,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target curl-examples
else
make -j5 -C bld examples
make -C bld examples
fi
amiga:
@ -517,6 +521,7 @@ jobs:
runs-on: 'ubuntu-latest'
timeout-minutes: 5
env:
MAKEFLAGS: -j 5
amissl-version: 5.18
strategy:
matrix:
@ -584,9 +589,9 @@ jobs:
- name: 'build'
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5
cmake --build bld
else
make -j5 -C bld
make -C bld
fi
- name: 'curl info'
@ -596,18 +601,18 @@ jobs:
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5 --target testdeps
cmake --build bld --target testdeps
else
make -j5 -C bld -C tests
make -C bld -C tests
fi
- name: 'build examples'
if: ${{ matrix.build == 'cmake' }} # skip for autotools to save time
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --parallel 5 --target curl-examples
cmake --build bld --target curl-examples
else
make -j5 -C bld examples
make -C bld examples
fi
msdos:
@ -615,6 +620,7 @@ jobs:
runs-on: 'ubuntu-latest'
timeout-minutes: 5
env:
MAKEFLAGS: -j 5
toolchain-version: '3.4'
strategy:
matrix:
@ -694,7 +700,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld
else
make -j5 -C bld
make -C bld
fi
- name: 'curl info'
@ -706,7 +712,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target testdeps
else
make -j5 -C bld -C tests
make -C bld -C tests
fi
- name: 'build examples'
@ -715,5 +721,5 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target curl-examples
else
make -j5 -C bld examples
make -C bld examples
fi

View File

@ -44,6 +44,7 @@ jobs:
run:
shell: C:\cygwin\bin\bash.exe '{0}'
env:
MAKEFLAGS: -j 5
SHELLOPTS: 'igncr'
strategy:
matrix:
@ -111,9 +112,9 @@ jobs:
timeout-minutes: 10
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --config '${{ matrix.type }}'
cmake --build bld
else
make -C bld -j5 V=1 install
make -C bld V=1 install
fi
- name: 'curl version'
@ -130,9 +131,9 @@ jobs:
timeout-minutes: 15
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --config '${{ matrix.type }}' --target testdeps
cmake --build bld --target testdeps
else
make -C bld -j5 V=1 -C tests
make -C bld V=1 -C tests
fi
- name: 'run tests'
@ -145,9 +146,9 @@ jobs:
fi
if [ '${{ matrix.build }}' = 'cmake' ]; then
PATH="$PWD/bld/lib:$PATH"
cmake --build bld --config '${{ matrix.type }}' --target test-ci
cmake --build bld --target test-ci
else
make -C bld -j5 V=1 test-ci
make -C bld V=1 test-ci
fi
- name: 'build examples'
@ -155,9 +156,9 @@ jobs:
timeout-minutes: 5
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --config '${{ matrix.type }}' --target curl-examples
cmake --build bld --target curl-examples
else
make -C bld -j5 V=1 examples
make -C bld V=1 examples
fi
msys2: # both msys and mingw-w64
@ -167,6 +168,8 @@ jobs:
defaults:
run:
shell: msys2 {0}
env:
MAKEFLAGS: -j 5
strategy:
matrix:
include:
@ -250,8 +253,6 @@ jobs:
fi
[ '${{ matrix.sys }}' = 'msys' ] && options+=' -D_CURL_PREFILL=ON'
[ '${{ matrix.test }}' = 'uwp' ] && options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0'
[ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
[ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
[ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF'
cmake -B "bld${_chkprefill}" -G Ninja ${options} \
-DCMAKE_C_FLAGS="${{ matrix.cflags }} ${CFLAGS_CMAKE} ${CPPFLAGS}" \
@ -286,9 +287,9 @@ jobs:
timeout-minutes: 10
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --config '${{ matrix.type }}'
cmake --build bld
else
make -C bld -j5 V=1 install
make -C bld V=1 install
fi
- name: 'curl version'
@ -311,9 +312,9 @@ jobs:
timeout-minutes: 10
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --config '${{ matrix.type }}' --target testdeps
cmake --build bld --target testdeps
else
make -C bld -j5 V=1 -C tests
make -C bld V=1 -C tests
fi
if [ '${{ matrix.build }}' != 'cmake' ]; then
# avoid libtool's .exe wrappers
@ -347,10 +348,10 @@ jobs:
PATH="$PATH:/c/Program Files (x86)/stunnel/bin"
if [ '${{ matrix.build }}' = 'cmake' ]; then
PATH="$PWD/bld/lib:$PATH"
cmake --build bld --config '${{ matrix.type }}' --target test-ci
cmake --build bld --target test-ci
else
PATH="$PWD/bld/lib/.libs:$PATH"
make -C bld -j5 V=1 test-ci
make -C bld V=1 test-ci
fi
- name: 'build examples'
@ -358,9 +359,9 @@ jobs:
timeout-minutes: 5
run: |
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --config '${{ matrix.type }}' --target curl-examples
cmake --build bld --target curl-examples
else
make -C bld -j5 V=1 examples
make -C bld V=1 examples
fi
mingw-w64-standalone-downloads:
@ -370,6 +371,8 @@ jobs:
defaults:
run:
shell: C:\msys64\usr\bin\bash.exe {0}
env:
MAKEFLAGS: -j 5
strategy:
matrix:
include:
@ -428,8 +431,6 @@ jobs:
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
for _chkprefill in '' ${{ matrix.chkprefill }}; do
options=''
[ '${{ matrix.type }}' = 'Debug' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG='
[ '${{ matrix.type }}' = 'Release' ] && options+=' -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE='
[ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF'
cmake -B "bld${_chkprefill}" -G 'MSYS Makefiles' ${options} \
-DCMAKE_C_COMPILER=gcc \
@ -457,7 +458,7 @@ jobs:
timeout-minutes: 5
run: |
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5
cmake --build bld
- name: 'curl version'
timeout-minutes: 1
@ -471,7 +472,7 @@ jobs:
timeout-minutes: 10
run: |
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target testdeps
cmake --build bld --target testdeps
- name: 'install test prereqs'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
@ -500,27 +501,29 @@ jobs:
TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
fi
PATH="$PWD/bld/lib:$PATH:/c/Program Files (x86)/stunnel/bin"
cmake --build bld --config '${{ matrix.type }}' --target test-ci
cmake --build bld --target test-ci
- name: 'build examples'
timeout-minutes: 5
run: |
PATH="$(cygpath "${USERPROFILE}")/my-cache/${{ matrix.dir }}/bin:/c/msys64/usr/bin:$PATH"
cmake --build bld --config '${{ matrix.type }}' --parallel 5 --target curl-examples
cmake --build bld --target curl-examples
linux-cross-mingw-w64:
name: "linux-mingw, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }}"
runs-on: ubuntu-latest
timeout-minutes: 15
env:
MAKEFLAGS: -j 5
TRIPLET: 'x86_64-w64-mingw32'
strategy:
fail-fast: false
matrix:
build: [autotools, cmake]
compiler: [gcc]
env:
TRIPLET: 'x86_64-w64-mingw32'
steps:
- name: 'install packages'
timeout-minutes: 5
run: sudo apt-get -o Dpkg::Use-Pty=0 install mingw-w64 ${{ matrix.build == 'cmake' && 'ninja-build' || '' }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@ -564,7 +567,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld
else
make -C bld -j5
make -C bld
fi
- name: 'curl info'
@ -576,7 +579,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target testdeps
else
make -C bld -j5 -C tests
make -C bld -C tests
fi
- name: 'build examples'
@ -584,7 +587,7 @@ jobs:
if [ '${{ matrix.build }}' = 'cmake' ]; then
cmake --build bld --target curl-examples
else
make -C bld -j5 examples
make -C bld examples
fi
wince:
@ -592,8 +595,8 @@ jobs:
runs-on: 'macos-latest'
timeout-minutes: 10
env:
toolchain-version: '0.59.1'
MAKEFLAGS: -j 4
toolchain-version: '0.59.1'
strategy:
matrix:
build: [autotools, cmake]
@ -601,6 +604,7 @@ jobs:
steps:
- name: 'install packages'
if: ${{ matrix.build == 'autotools' }}
timeout-minutes: 5
run: |
echo automake libtool | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
@ -614,6 +618,7 @@ jobs:
- name: 'install compiler (mingw32ce)'
if: ${{ steps.cache-compiler.outputs.cache-hit != 'true' }}
timeout-minutes: 5
run: |
cd "${HOME}" || exit 1
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 3 --retry-connrefused --proto-redir =https \
@ -902,7 +907,7 @@ jobs:
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 10
run: |
export CURL_DIRSUFFIX='${{ matrix.type }}/'
export CURL_DIRSUFFIX='${{ matrix.type }}'
export TFLAGS='-j8 ~WebSockets ~SCP ~612 ${{ matrix.tflags }}'
if [[ '${{ matrix.install }}' = *'libssh2[core,zlib]'* ]]; then
TFLAGS+=' ~SFTP'

View File

@ -352,13 +352,12 @@ endif()
if(WIN32)
option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
if(CURL_STATIC_CRT AND MSVC)
if(BUILD_STATIC_CURL)
if(BUILD_STATIC_CURL OR NOT BUILD_CURL_EXE)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
string(APPEND CMAKE_C_FLAGS_RELEASE " -MT")
string(APPEND CMAKE_C_FLAGS_DEBUG " -MTd")
else()
message(WARNING "Static CRT requires curl executable built with static libcurl "
"(BUILD_STATIC_LIBS=ON and BUILD_STATIC_CURL=ON).")
message(WARNING "Static CRT requires static or no curl executable.")
endif()
endif()
endif()
@ -1954,22 +1953,6 @@ endif()
# Some other minor tests
if(CMAKE_COMPILER_IS_GNUCC AND APPLE)
include(CheckCCompilerFlag)
check_c_compiler_flag("-Wno-long-double" HAVE_C_FLAG_Wno_long_double)
if(HAVE_C_FLAG_Wno_long_double)
# The Mac version of GCC warns about use of long double. Disable it.
get_source_file_property(_mprintf_compile_flags "mprintf.c" COMPILE_FLAGS)
if(_mprintf_compile_flags)
string(APPEND _mprintf_compile_flags " -Wno-long-double")
else()
set(_mprintf_compile_flags "-Wno-long-double")
endif()
set_source_files_properties("mprintf.c" PROPERTIES
COMPILE_FLAGS ${_mprintf_compile_flags})
endif()
endif()
if(_cmake_try_compile_target_type_save)
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_cmake_try_compile_target_type_save})
unset(_cmake_try_compile_target_type_save)

View File

@ -36,6 +36,8 @@ esac
if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then
openssl_root_win="C:/OpenSSL-v34${openssl_suffix}"
elif [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2019' ]; then
openssl_root_win="C:/OpenSSL-v11${openssl_suffix}"
elif [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ]; then
openssl_root_win="C:/OpenSSL${openssl_suffix}"
else
openssl_root_win="C:/OpenSSL-v111${openssl_suffix}"
@ -52,10 +54,20 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
[ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}"
[ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}"
[ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}"
if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ]; then
mkdir "_bld${_chkprefill}"
cd "_bld${_chkprefill}"
options+=' ..'
root='..'
else
options+=" -B _bld${_chkprefill}"
options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false'
options+=" -DCMAKE_UNITY_BUILD=${UNITY}"
root='.'
fi
# shellcheck disable=SC2086
cmake -B "_bld${_chkprefill}" -G "${PRJ_GEN}" ${TARGET} \
-DCMAKE_VS_GLOBALS=TrackFileAccess=false \
-DCMAKE_UNITY_BUILD="${UNITY}" -DCURL_TEST_BUNDLES=ON \
time cmake -G "${PRJ_GEN}" ${TARGET} \
-DCURL_TEST_BUNDLES=ON \
-DCURL_WERROR=ON \
-DBUILD_SHARED_LIBS="${SHARED}" \
-DCURL_STATIC_CRT=ON \
@ -66,7 +78,8 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
-DCURL_USE_OPENSSL="${OPENSSL}" \
-DCURL_USE_LIBPSL=OFF \
${options} \
|| { cat _bld/CMakeFiles/CMake* 2>/dev/null; false; }
|| { cat ${root}/_bld/CMakeFiles/CMake* 2>/dev/null; false; }
[ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ] && cd ..
done
if [ -d _bld_chkprefill ] && ! diff -u _bld/lib/curl_config.h _bld_chkprefill/lib/curl_config.h; then
cat _bld_chkprefill/CMakeFiles/CMake* 2>/dev/null || true
@ -74,7 +87,7 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
fi
echo 'curl_config.h'; grep -F '#define' _bld/lib/curl_config.h | sort || true
# shellcheck disable=SC2086
if ! cmake --build _bld --config "${PRJ_CFG}" --parallel 2 -- ${BUILD_OPT:-}; then
if ! time cmake --build _bld --config "${PRJ_CFG}" --parallel 2 -- ${BUILD_OPT:-}; then
if [ "${PRJ_GEN}" = 'Visual Studio 9 2008' ]; then
find . -name BuildLog.htm -exec dos2unix '{}' +
find . -name BuildLog.htm -exec cat '{}' +
@ -127,14 +140,14 @@ fi
if [ "${TFLAGS}" != 'skipall' ] && \
[ "${BUILD_SYSTEM}" = 'CMake' ]; then
cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target testdeps
time cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target testdeps
fi
# run tests
if [ "${TFLAGS}" != 'skipall' ] && \
[ "${TFLAGS}" != 'skiprun' ]; then
export CURL_DIRSUFFIX="${PRJ_CFG}/"
export CURL_DIRSUFFIX="${PRJ_CFG}"
if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then
TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")"
elif [ -x "$(cygpath 'C:/msys64/usr/bin/curl.exe')" ]; then
@ -142,12 +155,12 @@ if [ "${TFLAGS}" != 'skipall' ] && \
fi
TFLAGS+=' -j0'
if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
cmake --build _bld --config "${PRJ_CFG}" --target test-ci
time cmake --build _bld --config "${PRJ_CFG}" --target test-ci
else
(
TFLAGS="-a -p !flaky -r -rm ${TFLAGS}"
cd _bld/tests
./runtests.pl
time ./runtests.pl
)
fi
fi
@ -156,5 +169,5 @@ fi
if [ "${EXAMPLES}" = 'ON' ] && \
[ "${BUILD_SYSTEM}" = 'CMake' ]; then
cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target curl-examples
time cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target curl-examples
fi

View File

@ -61,15 +61,15 @@ environment:
SCHANNEL: 'ON'
DEBUG: 'OFF'
CURLDEBUG: 'ON'
- job_name: 'CMake, VS2008, Debug, x86, OpenSSL 1.1.1 + Schannel, Shared, Build-tests & examples'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
- job_name: 'CMake, VS2008, Debug, x86, OpenSSL 1.0.2 + Schannel, Shared, Build-tests & examples'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2013'
PRJ_GEN: 'Visual Studio 9 2008'
TARGET: '-A Win32'
PRJ_CFG: Debug
OPENSSL: 'ON'
SCHANNEL: 'ON'
SHARED: 'ON'
EXAMPLES: 'OFF'
EXAMPLES: 'ON'
- job_name: 'CMake, VS2010, Debug, x64, Schannel, Shared, Build-tests & examples'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
PRJ_GEN: 'Visual Studio 10 2010'
@ -109,7 +109,7 @@ environment:
OPENSSL: 'ON'
SHARED: 'ON'
TFLAGS: 'skipall'
- job_name: 'CMake, VS2019, Debug, x64, OpenSSL 1.0.2 + Schannel, Shared, Build-tests'
- job_name: 'CMake, VS2019, Debug, x64, OpenSSL 1.1.0 + Schannel, Shared, Build-tests'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2019'
PRJ_GEN: 'Visual Studio 16 2019'
TARGET: '-A x64'

View File

@ -238,7 +238,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `CURL_LIBCURL_VERSIONED_SYMBOLS`: Enable libcurl versioned symbols. Default: `OFF`
- `CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX`: Override default versioned symbol prefix. Default: `<TLS-BACKEND>_` or `MULTISSL_`
- `CURL_LTO`: Enable compiler Link Time Optimizations. Default: `OFF`
- `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`) (requires static curl executable). Default: `OFF`
- `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`) (requires static or no curl executable). Default: `OFF`
- `CURL_TARGET_WINDOWS_VERSION`: Minimum target Windows version as hex string.
- `CURL_TEST_BUNDLES`: Bundle `libtest` and `unittest` tests into single binaries. Default: `OFF`
- `CURL_WERROR`: Turn compiler warnings into errors. Default: `OFF`

View File

@ -247,11 +247,11 @@ local system or network, the bar is raised. If a local user wrongfully has
elevated rights on your system enough to attack curl, they can probably
already do much worse harm and the problem is not really in curl.
## Experiments
## Debug & Experiments
Vulnerabilities in features which are off by default (in the build) and
documented as experimental, are not eligible for a reward and we do not
consider them security problems.
documented as experimental, or exist only in debug mode, are not eligible for a
reward and we do not consider them security problems.
## URL inconsistencies

View File

@ -59,4 +59,4 @@ used.
Doing FTP over an HTTP proxy without --proxytunnel makes curl do HTTP with an
FTP URL over the proxy. For such transfers, common FTP specific options do not
work, including --ftp-ssl-reqd and --ftp-ssl-control.
work, including --ssl-reqd and --ftp-ssl-control.

View File

@ -24,53 +24,53 @@ displays information about the curl and libcurl installation.
# OPTIONS
## --ca
## `--ca`
Displays the built-in path to the CA cert bundle this libcurl uses.
## --cc
## `--cc`
Displays the compiler used to build libcurl.
## --cflags
## `--cflags`
Set of compiler options (CFLAGS) to use when compiling files that use
libcurl. Currently that is only the include path to the curl include files.
## --checkfor [version]
## `--checkfor [version]`
Specify the oldest possible libcurl version string you want, and this script
returns 0 if the current installation is new enough or it returns 1 and
outputs a text saying that the current version is not new enough. (Added in
7.15.4)
## --configure
## `--configure`
Displays the arguments given to configure when building curl.
## --feature
## `--feature`
Lists what particular main features the installed libcurl was built with. At
the time of writing, this list may include SSL, KRB4 or IPv6. Do not assume
any particular order. The keywords are separated by newlines. There may be
none, one, or several keywords in the list.
## --help
## `--help`
Displays the available options.
## --libs
## `--libs`
Shows the complete set of libs and other linker options you need in order to
link your application with libcurl.
## --prefix
## `--prefix`
This is the prefix used when libcurl was installed. libcurl is then installed
in $prefix/lib and its header files are installed in $prefix/include and so
on. The prefix is set with "configure --prefix".
on. The prefix is set with `configure --prefix`.
## --protocols
## `--protocols`
Lists what particular protocols the installed libcurl was built to support. At
the time of writing, this list may include HTTP, HTTPS, FTP, FTPS, FILE,
@ -78,22 +78,22 @@ TELNET, LDAP, DICT and many more. Do not assume any particular order. The
protocols are listed using uppercase and are separated by newlines. There may
be none, one, or several protocols in the list. (Added in 7.13.0)
## --ssl-backends
## `--ssl-backends`
Lists the SSL backends that were enabled when libcurl was built. It might be
no, one or several names. If more than one name, they appear comma-separated.
(Added in 7.58.0)
## --static-libs
## `--static-libs`
Shows the complete set of libs and other linker options you need in order to
link your application with libcurl statically. (Added in 7.17.1)
## --version
## `--version`
Outputs version information about the installed libcurl.
## --vernum
## `--vernum`
Outputs version information about the installed libcurl, in numerical mode.
This shows the version number, in hexadecimal, using 8 bits for each part:
@ -104,22 +104,21 @@ omitted. (This option was broken in the 7.15.0 release.)
# EXAMPLES
What linker options do I need when I link with libcurl?
~~~
$ curl-config --libs
~~~
$ curl-config --libs
What compiler options do I need when I compile using libcurl functions?
~~~
$ curl-config --cflags
~~~
$ curl-config --cflags
How do I know if libcurl was built with SSL support?
~~~
$ curl-config --feature | grep SSL
~~~
$ curl-config --feature | grep SSL
What's the installed libcurl version?
~~~
$ curl-config --version
~~~
$ curl-config --version
How do I build a single file with a one-line command?
~~~
$ `curl-config --cc --cflags` -o example source.c `curl-config --libs`
~~~
$ `curl-config --cc --cflags` -o example source.c `curl-config --libs`

View File

@ -298,14 +298,19 @@ int main(void)
filter = (struct connection_filter *)calloc(1, sizeof(*filter));
if(!filter)
exit(1);
return 1;
if(curl_global_init(CURL_GLOBAL_DEFAULT))
exit(1);
if(curl_global_init(CURL_GLOBAL_DEFAULT)) {
free(filter);
return 1;
}
curl = curl_easy_init();
if(!curl)
exit(1);
if(!curl) {
curl_global_cleanup();
free(filter);
return 1;
}
/* Set the target URL */
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost");

View File

@ -79,12 +79,12 @@ int main(int argc, char *argv[])
fprintf(stderr,
"\rUsage: %s [-m=1|2|5|10|20|50|100] [-t] [-x] [url]\n",
appname);
exit(1);
return 1;
case 'v':
case 'V':
fprintf(stderr, "\r%s %s - %s\n",
appname, CHKSPEED_VERSION, curl_version());
exit(1);
return 1;
case 'a':
case 'A':
prtall = 1;

View File

@ -34,8 +34,7 @@
#include <curl/curl.h>
#include <curl/mprintf.h>
static void
print_cookies(CURL *curl)
static int print_cookies(CURL *curl)
{
CURLcode res;
struct curl_slist *cookies;
@ -47,7 +46,7 @@ print_cookies(CURL *curl)
if(res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_getinfo failed: %s\n",
curl_easy_strerror(res));
exit(1);
return 1;
}
nc = cookies;
i = 1;
@ -60,6 +59,8 @@ print_cookies(CURL *curl)
printf("(none)\n");
}
curl_slist_free_all(cookies);
return 0;
}
int

View File

@ -418,22 +418,22 @@ static int init_fifo(GlobalInfo *g)
struct epoll_event epev;
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo);
if(lstat (fifo, &st) == 0) {
if(lstat(fifo, &st) == 0) {
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
exit(1);
return 1;
}
}
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
if(mkfifo(fifo, 0600) == -1) {
perror("mkfifo");
exit(1);
return 1;
}
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) {
perror("open");
exit(1);
return 1;
}
g->fifofd = sockfd;
@ -449,9 +449,9 @@ static int init_fifo(GlobalInfo *g)
static void clean_fifo(GlobalInfo *g)
{
epoll_ctl(g->epfd, EPOLL_CTL_DEL, g->fifofd, NULL);
fclose(g->input);
unlink(fifo);
epoll_ctl(g->epfd, EPOLL_CTL_DEL, g->fifofd, NULL);
fclose(g->input);
unlink(fifo);
}
@ -478,13 +478,13 @@ int main(int argc, char **argv)
g.epfd = epoll_create1(EPOLL_CLOEXEC);
if(g.epfd == -1) {
perror("epoll_create1 failed");
exit(1);
return 1;
}
g.tfd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
if(g.tfd == -1) {
perror("timerfd_create failed");
exit(1);
return 1;
}
memset(&its, 0, sizeof(struct itimerspec));
@ -496,7 +496,8 @@ int main(int argc, char **argv)
ev.data.fd = g.tfd;
epoll_ctl(g.epfd, EPOLL_CTL_ADD, g.tfd, &ev);
init_fifo(&g);
if(init_fifo(&g))
return 1;
g.multi = curl_multi_init();
/* setup the generic multi interface options we want */
@ -521,7 +522,7 @@ int main(int argc, char **argv)
}
else {
perror("epoll_wait");
exit(1);
return 1;
}
}

View File

@ -402,22 +402,22 @@ static int init_fifo(GlobalInfo *g)
curl_socket_t sockfd;
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo);
if(lstat (fifo, &st) == 0) {
if(lstat(fifo, &st) == 0) {
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
exit(1);
return 1;
}
}
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
if(mkfifo(fifo, 0600) == -1) {
perror("mkfifo");
exit(1);
return 1;
}
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) {
perror("open");
exit(1);
return 1;
}
g->input = fdopen(sockfd, "r");
@ -436,7 +436,8 @@ int main(int argc, char **argv)
memset(&g, 0, sizeof(GlobalInfo));
g.loop = ev_default_loop(0);
init_fifo(&g);
if(init_fifo(&g))
return 1;
g.multi = curl_multi_init();
ev_timer_init(&g.timer_event, timer_cb, 0., 0.);

View File

@ -392,21 +392,21 @@ int init_fifo(void)
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
exit(1);
return CURL_SOCKET_BAD;
}
}
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
if(mkfifo(fifo, 0600) == -1) {
perror("mkfifo");
exit(1);
return CURL_SOCKET_BAD;
}
socket = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(socket == -1) {
if(socket == CURL_SOCKET_BAD) {
perror("open");
exit(1);
return socket;
}
MSG_OUT("Now, pipe some URL's into > %s\n", fifo);
@ -421,6 +421,8 @@ int main(void)
GIOChannel* ch;
fd = init_fifo();
if(fd == CURL_SOCKET_BAD)
return 1;
ch = g_io_channel_unix_new(fd);
g_io_add_watch(ch, G_IO_IN, fifo_cb, g);
gmain = g_main_loop_new(NULL, FALSE);

View File

@ -399,22 +399,22 @@ static int init_fifo(GlobalInfo *g)
curl_socket_t sockfd;
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo);
if(lstat (fifo, &st) == 0) {
if(lstat(fifo, &st) == 0) {
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
exit(1);
return 1;
}
}
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo");
exit(1);
return 1;
}
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) {
perror("open");
exit(1);
return 1;
}
g->input = fdopen(sockfd, "r");
@ -440,7 +440,8 @@ int main(int argc, char **argv)
memset(&g, 0, sizeof(GlobalInfo));
g.evbase = event_base_new();
init_fifo(&g);
if(init_fifo(&g))
return 1;
g.multi = curl_multi_init();
evtimer_assign(&g.timer_event, g.evbase, timer_cb, &g);

View File

@ -94,7 +94,7 @@ static bool init(CURL *&conn, const char *url)
if(conn == NULL) {
fprintf(stderr, "Failed to create CURL connection\n");
exit(EXIT_FAILURE);
return false;
}
code = curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, errorBuffer);
@ -270,7 +270,7 @@ int main(int argc, char *argv[])
if(argc != 2) {
fprintf(stderr, "Usage: %s <url>\n", argv[0]);
exit(EXIT_FAILURE);
return EXIT_FAILURE;
}
curl_global_init(CURL_GLOBAL_DEFAULT);
@ -279,7 +279,7 @@ int main(int argc, char *argv[])
if(!init(conn, argv[1])) {
fprintf(stderr, "Connection initialization failed\n");
exit(EXIT_FAILURE);
return EXIT_FAILURE;
}
// Retrieve content for the URL
@ -289,7 +289,7 @@ int main(int argc, char *argv[])
if(code != CURLE_OK) {
fprintf(stderr, "Failed to get '%s' [%s]\n", argv[1], errorBuffer);
exit(EXIT_FAILURE);
return EXIT_FAILURE;
}
// Parse the (assumed) HTML code

View File

@ -142,7 +142,7 @@ int my_trace(CURL *handle, curl_infotype type,
return 0;
}
static void setup(struct transfer *t, int num)
static int setup(struct transfer *t, int num)
{
char filename[128];
CURL *hnd;
@ -155,7 +155,7 @@ static void setup(struct transfer *t, int num)
if(!t->out) {
fprintf(stderr, "error: could not open file %s for writing: %s\n",
filename, strerror(errno));
exit(1);
return 1;
}
/* write to this file */
@ -179,6 +179,7 @@ static void setup(struct transfer *t, int num)
/* wait for pipe connection to confirm */
curl_easy_setopt(hnd, CURLOPT_PIPEWAIT, 1L);
#endif
return 0;
}
/*
@ -204,7 +205,8 @@ int main(int argc, char **argv)
multi_handle = curl_multi_init();
for(i = 0; i < num_transfers; i++) {
setup(&trans[i], i);
if(setup(&trans[i], i))
return 1;
/* add the individual transfer */
curl_multi_add_handle(multi_handle, trans[i].easy);

View File

@ -200,7 +200,7 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *userp)
return retcode;
}
static void setup(struct input *i, int num, const char *upload)
static int setup(struct input *i, int num, const char *upload)
{
FILE *out;
char url[256];
@ -209,14 +209,15 @@ static void setup(struct input *i, int num, const char *upload)
curl_off_t uploadsize;
CURL *hnd;
hnd = i->hnd = curl_easy_init();
hnd = i->hnd = NULL;
i->num = num;
curl_msnprintf(filename, 128, "dl-%d", num);
out = fopen(filename, "wb");
if(!out) {
fprintf(stderr, "error: could not open file %s for writing: %s\n", upload,
strerror(errno));
exit(1);
return 1;
}
curl_msnprintf(url, 256, "https://localhost:8443/upload-%d", num);
@ -225,7 +226,8 @@ static void setup(struct input *i, int num, const char *upload)
if(stat(upload, &file_info)) {
fprintf(stderr, "error: could not stat file %s: %s\n", upload,
strerror(errno));
exit(1);
fclose(out);
return 1;
}
uploadsize = file_info.st_size;
@ -234,9 +236,12 @@ static void setup(struct input *i, int num, const char *upload)
if(!i->in) {
fprintf(stderr, "error: could not open file %s for reading: %s\n", upload,
strerror(errno));
exit(1);
fclose(out);
return 1;
}
hnd = i->hnd = curl_easy_init();
/* write to this file */
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, out);
@ -269,6 +274,7 @@ static void setup(struct input *i, int num, const char *upload)
/* wait for pipe connection to confirm */
curl_easy_setopt(hnd, CURLOPT_PIPEWAIT, 1L);
#endif
return 0;
}
/*
@ -301,7 +307,8 @@ int main(int argc, char **argv)
multi_handle = curl_multi_init();
for(i = 0; i < num_transfers; i++) {
setup(&trans[i], i, filename);
if(setup(&trans[i], i, filename))
return 1;
/* add the individual transfer */
curl_multi_add_handle(multi_handle, trans[i].hnd);

View File

@ -28,11 +28,10 @@ const struct curl_easyoption *curl_easy_option_by_id(CURLoption id);
# DESCRIPTION
Given a *CURLoption* **id**, this function returns a pointer to the
*curl_easyoption* struct, holding information about the
curl_easy_setopt(3) option using that id. The option id is the CURLOPT_
prefix ones provided in the standard curl/curl.h header file. This function
returns the non-alias version of the cases where there is an alias function as
well.
*curl_easyoption* struct, holding information about the curl_easy_setopt(3)
option using that id. The option id is the `CURLOPT_` prefixed ones provided
in the standard curl/curl.h header file. This function returns the non-alias
version of the cases where there is an alias function as well.
If libcurl has no option with the given id, this function returns NULL.

View File

@ -27,11 +27,10 @@ const struct curl_easyoption *curl_easy_option_by_name(const char *name);
# DESCRIPTION
Given a **name**, this function returns a pointer to the
*curl_easyoption* struct, holding information about the
curl_easy_setopt(3) option using that name. The name should be specified
without the "CURLOPT_" prefix and the name comparison is made case
insensitive.
Given a **name**, this function returns a pointer to the *curl_easyoption*
struct, holding information about the curl_easy_setopt(3) option using that
name. The name should be specified without the `CURLOPT_` prefix and the name
comparison is made case insensitive.
If libcurl has no option with the given name, this function returns NULL.

View File

@ -316,4 +316,4 @@ filenames are now escaped before transmission.
# RETURN VALUE
0 means everything was OK, non-zero means an error occurred corresponding to a
CURL_FORMADD_* constant defined in *\<curl/curl.h\>*.
`CURL_FORMADD_*` constant defined in *\<curl/curl.h\>*.

View File

@ -38,9 +38,9 @@ first argument to the curl_formget_callback function.
size_t len);"
~~~
The curl_formget_callback is invoked for each part of the HTTP POST chain. The
character buffer passed to the callback must not be freed. The callback should
return the buffer length passed to it on success.
The *curl_formget_callback* is invoked for each part of the HTTP POST chain.
The character buffer passed to the callback must not be freed. The callback
should return the buffer length passed to it on success.
If the **CURLFORM_STREAM** option is used in the formpost, it prevents
curl_formget(3) from working until you have performed the actual HTTP request.

View File

@ -376,9 +376,8 @@ supports HTTP zstd content encoding using zstd library (Added in 7.72.0)
*features* mask bit: CURL_VERSION_CONV
libcurl was built with support for character conversions, as provided by the
CURLOPT_CONV_* callbacks. Always 0 since 7.82.0. (Added in 7.15.4,
deprecated.)
libcurl was built with support for character conversions provided by
callbacks. Always 0 since 7.82.0. (Added in 7.15.4, deprecated.)
## no name

View File

@ -23,16 +23,16 @@ These variables are intended for internal use only, subject to change and have
many effects on the behavior of libcurl. Refer to the source code to determine
how exactly they are being used.
## CURL_ALTSVC_HTTP
## `CURL_ALTSVC_HTTP`
Bypass the AltSvc HTTPS protocol restriction if this variable exists.
## CURL_DBG_SOCK_RBLOCK
## `CURL_DBG_SOCK_RBLOCK`
The percentage of recv() calls that should be answered with a EAGAIN at random.
For TCP/UNIX sockets.
## CURL_DBG_SOCK_RMAX
## `CURL_DBG_SOCK_RMAX`
The maximum data that shall be received from the network in one recv() call.
For TCP/UNIX sockets. This is applied to every recv.
@ -40,12 +40,12 @@ For TCP/UNIX sockets. This is applied to every recv.
Example: **CURL_DBG_SOCK_RMAX=400** means recv buffer size is limited to a
maximum of 400 bytes.
## CURL_DBG_SOCK_WBLOCK
## `CURL_DBG_SOCK_WBLOCK`
The percentage of send() calls that should be answered with a EAGAIN at random.
For TCP/UNIX sockets.
## CURL_DBG_SOCK_WPARTIAL
## `CURL_DBG_SOCK_WPARTIAL`
The percentage of data that shall be written to the network. For TCP/UNIX
sockets. This is applied to every send.
@ -53,12 +53,12 @@ sockets. This is applied to every send.
Example: **CURL_DBG_SOCK_WPARTIAL=80** means a send with 1000 bytes would
only send 800.
## CURL_DBG_QUIC_WBLOCK
## `CURL_DBG_QUIC_WBLOCK`
The percentage of send() calls that should be answered with EAGAIN at random.
QUIC only.
## CURL_DEBUG
## `CURL_DEBUG`
Trace logging behavior as an alternative to calling curl_global_trace(3).
@ -73,39 +73,39 @@ Example: **CURL_DEBUG=tcp,-http/2 curl -vv url** means trace protocol details,
triggered by `-vv`, add tracing of TCP in addition and remove tracing of
HTTP/2.
## CURL_DEBUG_SIZE
## `CURL_DEBUG_SIZE`
Fake the size returned by CURLINFO_HEADER_SIZE and CURLINFO_REQUEST_SIZE.
## CURL_GETHOSTNAME
## `CURL_GETHOSTNAME`
Fake the local machine's unqualified hostname for NTLM and SMTP.
## CURL_HSTS_HTTP
## `CURL_HSTS_HTTP`
Bypass the HSTS HTTPS protocol restriction if this variable exists.
## CURL_FORCETIME
## `CURL_FORCETIME`
A time of 0 is used for AWS signatures and NTLM if this variable exists.
## CURL_ENTROPY
## `CURL_ENTROPY`
A fixed faked value to use instead of a proper random number so that functions
in libcurl that are otherwise getting random outputs can be tested for what
they generate.
## CURL_SMALLREQSEND
## `CURL_SMALLREQSEND`
An alternative size of HTTP data to be sent at a time only if smaller than the
current.
## CURL_SMALLSENDS
## `CURL_SMALLSENDS`
An alternative size of socket data to be sent at a time only if smaller than
the current.
## CURL_TIME
## `CURL_TIME`
Fake Unix timestamp to use for AltSvc, HSTS and CURLINFO variables that are
time related.
@ -114,34 +114,34 @@ This variable can also be used to fake the data returned by some CURLINFO
variables that are not time-related (such as CURLINFO_LOCAL_PORT), and in that
case the value is not a timestamp.
## CURL_TRACE
## `CURL_TRACE`
LDAP tracing is enabled if this variable exists and its value is 1 or greater.
OpenLDAP tracing is separate. Refer to CURL_OPENLDAP_TRACE.
## CURL_OPENLDAP_TRACE
## `CURL_OPENLDAP_TRACE`
OpenLDAP tracing is enabled if this variable exists and its value is 1 or
greater. There is a number of debug levels, refer to *openldap.c* comments.
## CURL_WS_CHUNK_SIZE
## `CURL_WS_CHUNK_SIZE`
Used to influence the buffer chunk size used for WebSocket encoding and
decoding.
## CURL_WS_CHUNK_EAGAIN
## `CURL_WS_CHUNK_EAGAIN`
Used to simulate blocking sends after this chunk size for WebSocket
connections.
## CURL_FORBID_REUSE
## `CURL_FORBID_REUSE`
Used to set the CURLOPT_FORBID_REUSE flag on each transfer initiated
by the curl command line tool. The value of the environment variable
does not matter.
## CURL_GRACEFUL_SHUTDOWN
## `CURL_GRACEFUL_SHUTDOWN`
Make a blocking, graceful shutdown of all remaining connections when
a multi handle is destroyed. This implicitly triggers for easy handles

View File

@ -32,7 +32,7 @@ CURLINFO_SCHEME(3) instead, because this option cannot return all
possible protocols.
Pass a pointer to a long to receive the version used in the last http
connection. The returned value is set to one of the CURLPROTO_* values:
connection. The returned value is set to one of these values:
~~~c
CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_FTP, CURLPROTO_FTPS,

View File

@ -58,12 +58,11 @@ struct curl_tlssessioninfo {
};
~~~
The *backend* struct member is one of the defines in the CURLSSLBACKEND_*
series: CURLSSLBACKEND_NONE (when built without TLS support),
CURLSSLBACKEND_WOLFSSL, CURLSSLBACKEND_SECURETRANSPORT, CURLSSLBACKEND_GNUTLS,
CURLSSLBACKEND_MBEDTLS, CURLSSLBACKEND_NSS, CURLSSLBACKEND_OPENSSL or
CURLSSLBACKEND_SCHANNEL. (Note that the OpenSSL
forks are all reported as just OpenSSL here.)
The *backend* struct member is one of these defines: CURLSSLBACKEND_NONE (when
built without TLS support), CURLSSLBACKEND_WOLFSSL,
CURLSSLBACKEND_SECURETRANSPORT, CURLSSLBACKEND_GNUTLS, CURLSSLBACKEND_MBEDTLS,
CURLSSLBACKEND_NSS, CURLSSLBACKEND_OPENSSL or CURLSSLBACKEND_SCHANNEL. (Note
that the OpenSSL forks are all reported as just OpenSSL here.)
The *internals* struct member points to a TLS library specific pointer for
the active ("in use") SSL connection, with the following underlying types:

View File

@ -28,8 +28,8 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MIME_OPTIONS, long options);
# DESCRIPTION
Pass a long that holds a bitmask of CURLMIMEOPT_* defines. Each bit is a
Boolean flag used while encoding a MIME tree or multipart form data.
Pass a long that holds a bitmask of options. Each bit is a boolean flag used
while encoding a MIME tree or multipart form data.
Available bits are:

View File

@ -31,7 +31,7 @@ This option is deprecated. We strongly recommend using
CURLOPT_PROTOCOLS_STR(3) instead because this option cannot control all
available protocols.
Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask
Pass a long that holds a bitmask of protocol bits. If used, this bitmask
limits what protocols libcurl may use in the transfer. This allows you to have
a libcurl built to support a wide range of protocols but still limit specific
transfers to only be allowed to use a subset of them. By default libcurl

View File

@ -32,10 +32,10 @@ This option is deprecated. We strongly recommend using
CURLOPT_REDIR_PROTOCOLS_STR(3) instead because this option cannot
control all available protocols.
Pass a long that holds a bitmask of CURLPROTO_* defines. If used, this bitmask
Pass a long that holds a bitmask of protocol bits. If used, this bitmask
limits what protocols libcurl may use in a transfer that it follows to in a
redirect when CURLOPT_FOLLOWLOCATION(3) is enabled. This allows you to
limit specific transfers to only be allowed to use a subset of protocols in
redirect when CURLOPT_FOLLOWLOCATION(3) is enabled. This allows you to limit
specific transfers to only be allowed to use a subset of protocols in
redirections.
Protocols denied by CURLOPT_PROTOCOLS(3) are not overridden by this

View File

@ -71,7 +71,7 @@ int main(void)
~~~
If you are on Linux and somehow have a need for paths larger than 107 bytes,
you can use the proc filesystem to bypass the limitation:
you can use the *proc* filesystem to bypass the limitation:
~~~c
int dirfd = open(long_directory_path_to_socket, O_DIRECTORY | O_RDONLY);

View File

@ -81,9 +81,8 @@ int main(void)
# HISTORY
This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants were
known as CURLFTPSSL_* Handled by LDAP since 7.81.0. Fully supported by the
OpenLDAP backend only.
This option was known as CURLOPT_FTP_SSL up to 7.16.4. Supported by LDAP since
7.81.0. Fully supported by the OpenLDAP backend only.
# %AVAILABILITY%

View File

@ -51,7 +51,7 @@ stdout
A common technique is to use the write callback to store the incoming data
into a dynamically growing allocated buffer, and then this
CURLOPT_WRITEDATA(3) is used to point to a struct or the buffer to store data
in. Like in the getinmemory example:
in. Like in the *getinmemory* example:
https://curl.se/libcurl/c/getinmemory.html
# HISTORY

View File

@ -592,7 +592,7 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
res->num_pending--;
if(CURL_ASYNC_SUCCESS == status) {
struct Curl_addrinfo *ai = Curl_he2ai(hostent, data->state.async.port);
struct Curl_addrinfo *ai = Curl_he2ai(hostent, data->conn->remote_port);
if(ai) {
compound_results(res, ai);
}
@ -774,8 +774,6 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
if(!res->hostname)
return NULL;
data->state.async.hostname = res->hostname;
data->state.async.port = port;
data->state.async.done = FALSE; /* not done */
data->state.async.dns = NULL; /* clear */
@ -811,6 +809,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
service, &hints, addrinfo_cb, data);
}
#else
(void)port;
#ifdef HAVE_CARES_IPV6
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {

View File

@ -400,7 +400,7 @@ static void destroy_async_data(struct Curl_easy *data)
td->init = FALSE;
}
Curl_safefree(async->hostname);
}
#ifdef USE_HTTPSRR_ARES
@ -414,7 +414,7 @@ static CURLcode resolve_httpsrr(struct Curl_easy *data,
memset(&async->thdata.hinfo, 0, sizeof(struct Curl_https_rrinfo));
async->thdata.hinfo.port = -1;
ares_query_dnsrec(async->thdata.channel,
async->hostname, ARES_CLASS_IN,
data->conn->host.name, ARES_CLASS_IN,
ARES_REC_TYPE_HTTPS,
Curl_dnsrec_done_cb, data, NULL);
@ -436,7 +436,6 @@ static bool init_resolve_thread(struct Curl_easy *data,
int err = ENOMEM;
struct Curl_async *async = &data->state.async;
async->port = port;
async->done = FALSE;
async->dns = NULL;
td->thread_hnd = curl_thread_t_null;
@ -447,11 +446,6 @@ static bool init_resolve_thread(struct Curl_easy *data,
goto errno_exit;
}
free(async->hostname);
async->hostname = strdup(hostname);
if(!async->hostname)
goto err_exit;
/* The thread will set this TRUE when complete. */
td->tsd.done = FALSE;

View File

@ -1181,7 +1181,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
if(dohp->probe[DOH_SLOT_IPV4].easy_mid < 0 &&
dohp->probe[DOH_SLOT_IPV6].easy_mid < 0) {
failf(data, "Could not DoH-resolve: %s", data->state.async.hostname);
failf(data, "Could not DoH-resolve: %s", dohp->host);
return CONN_IS_PROXIED(data->conn) ? CURLE_COULDNT_RESOLVE_PROXY :
CURLE_COULDNT_RESOLVE_HOST;
}

View File

@ -76,8 +76,8 @@ CURLcode Curl_addrinfo_callback(struct Curl_easy *data,
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
dns = Curl_cache_addr(data, ai,
data->state.async.hostname, 0,
data->state.async.port, FALSE);
data->conn->host.dispname, 0,
data->conn->localport, FALSE);
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);

View File

@ -1480,7 +1480,7 @@ CURLcode Curl_resolver_error(struct Curl_easy *data)
}
failf(data, "Could not resolve %s: %s", host_or_proxy,
data->state.async.hostname);
data->conn->host.dispname);
return result;
}

View File

@ -565,14 +565,12 @@ struct hostname {
#if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH)
#define USE_CURL_ASYNC
struct Curl_async {
char *hostname;
struct Curl_dns_entry *dns;
#ifdef CURLRES_ASYNCH
struct thread_data thdata;
#endif
void *resolver; /* resolver state, if it is used in the URL state -
ares_channel e.g. */
int port;
BIT(done); /* set TRUE when the lookup is complete */
};

View File

@ -959,7 +959,7 @@ static CURLcode gtls_client_init(struct Curl_cfilter *cf,
return CURLE_SSL_CONNECT_ERROR;
}
}
else if(ssl_config->key_passwd) {
else {
const unsigned int supported_key_encryption_algorithms =
GNUTLS_PKCS_USE_PKCS12_3DES | GNUTLS_PKCS_USE_PKCS12_ARCFOUR |
GNUTLS_PKCS_USE_PKCS12_RC2_40 | GNUTLS_PKCS_USE_PBES2_3DES |
@ -974,22 +974,12 @@ static CURLcode gtls_client_init(struct Curl_cfilter *cf,
supported_key_encryption_algorithms);
if(rc != GNUTLS_E_SUCCESS) {
failf(data,
"error reading X.509 potentially-encrypted key file: %s",
"error reading X.509 %skey file: %s",
ssl_config->key_passwd ? "potentially-encrypted " : "",
gnutls_strerror(rc));
return CURLE_SSL_CONNECT_ERROR;
}
}
else {
if(gnutls_certificate_set_x509_key_file(
gtls->shared_creds->creds,
config->clientcert,
ssl_config->key ? ssl_config->key : config->clientcert,
gnutls_do_file_type(ssl_config->cert_type) ) !=
GNUTLS_E_SUCCESS) {
failf(data, "error reading X.509 key or certificate file");
return CURLE_SSL_CONNECT_ERROR;
}
}
}
#ifdef USE_GNUTLS_SRP

View File

@ -482,7 +482,7 @@ AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
#endif
]],[[
int i = 0;
exit(i);
return i;
]])
],[
tmp_compiler_works="yes"

View File

@ -1270,11 +1270,12 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
struct addrinfo hints;
struct addrinfo *ai = 0;
int error;
int exitcode;
#ifdef _WIN32
WSADATA wsa;
if(WSAStartup(MAKEWORD(2, 2), &wsa))
exit(2);
return 2;
#endif
memset(&hints, 0, sizeof(hints));
@ -1283,9 +1284,15 @@ AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
if(error || !ai)
exit(1); /* fail */
else
exit(0);
exitcode = 1; /* fail */
else {
freeaddrinfo(ai);
exitcode = 0;
}
#ifdef _WIN32
WSACleanup();
#endif
return exitcode;
]])
],[
AC_MSG_RESULT([yes])
@ -1883,9 +1890,11 @@ AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [
error = getifaddrs(&ifa);
if(error || !ifa)
exit(1); /* fail */
else
exit(0);
return 1; /* fail */
else {
freeifaddrs(ifa);
return 0;
}
]])
],[
AC_MSG_RESULT([yes])
@ -2003,9 +2012,9 @@ AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
gmt = gmtime_r(&local, &result);
(void)result;
if(gmt)
exit(0);
return 0;
else
exit(1);
return 1;
]])
],[
AC_MSG_RESULT([yes])
@ -2134,13 +2143,13 @@ AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
/* - */
ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
if(!ipv4ptr)
exit(1); /* fail */
return 1; /* fail */
if(ipv4ptr != ipv4res)
exit(1); /* fail */
return 1; /* fail */
if(!ipv4ptr[0])
exit(1); /* fail */
return 1; /* fail */
if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
exit(1); /* fail */
return 1; /* fail */
/* - */
ipv6res[0] = '\0';
memset(ipv6a, 0, sizeof(ipv6a));
@ -2158,15 +2167,15 @@ AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
/* - */
ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
if(!ipv6ptr)
exit(1); /* fail */
return 1; /* fail */
if(ipv6ptr != ipv6res)
exit(1); /* fail */
return 1; /* fail */
if(!ipv6ptr[0])
exit(1); /* fail */
return 1; /* fail */
if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
exit(1); /* fail */
return 1; /* fail */
/* - */
exit(0);
return 0;
]])
],[
AC_MSG_RESULT([yes])
@ -2286,18 +2295,18 @@ AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
/* - */
memset(ipv4a, 1, sizeof(ipv4a));
if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
exit(1); /* fail */
return 1; /* fail */
/* - */
if( (ipv4a[0] != 0xc0) ||
(ipv4a[1] != 0xa8) ||
(ipv4a[2] != 0x64) ||
(ipv4a[3] != 0x01) ||
(ipv4a[4] != 0x01) )
exit(1); /* fail */
return 1; /* fail */
/* - */
memset(ipv6a, 1, sizeof(ipv6a));
if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
exit(1); /* fail */
return 1; /* fail */
/* - */
if( (ipv6a[0] != 0xfe) ||
(ipv6a[1] != 0x80) ||
@ -2310,7 +2319,7 @@ AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
(ipv6a[14] != 0x76) ||
(ipv6a[15] != 0xc8) ||
(ipv6a[16] != 0x01) )
exit(1); /* fail */
return 1; /* fail */
/* - */
if( (ipv6a[2] != 0x0) ||
(ipv6a[3] != 0x0) ||
@ -2318,9 +2327,9 @@ AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
(ipv6a[5] != 0x0) ||
(ipv6a[6] != 0x0) ||
(ipv6a[7] != 0x0) )
exit(1); /* fail */
return 1; /* fail */
/* - */
exit(0);
return 0;
]])
],[
AC_MSG_RESULT([yes])
@ -3809,11 +3818,11 @@ AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
buffer[0] = '\0';
string = strerror_r(EACCES, buffer, sizeof(buffer));
if(!string)
exit(1); /* fail */
return 1; /* fail */
if(!string[0])
exit(1); /* fail */
return 1; /* fail */
else
exit(0);
return 0;
]])
],[
AC_MSG_RESULT([yes])
@ -3872,11 +3881,11 @@ AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
buffer[0] = '\0';
error = strerror_r(EACCES, buffer, sizeof(buffer));
if(error)
exit(1); /* fail */
return 1; /* fail */
if(buffer[0] == '\0')
exit(1); /* fail */
return 1; /* fail */
else
exit(0);
return 0;
]])
],[
AC_MSG_RESULT([yes])

View File

@ -48,7 +48,7 @@ int main(int argc, char **argv)
if(argc < 1) {
puts("report_openssl_version filename");
exit(1);
return 1;
}
libptr = dlopen(argv[1], 0);
@ -65,7 +65,7 @@ int main(int argc, char **argv)
if(!ssl_version) {
puts("Unable to lookup version of OpenSSL");
exit(1);
return 1;
}
version = ssl_version(SSLEAY_VERSION);
@ -91,9 +91,9 @@ int main(int argc, char **argv)
status = LIB$SET_SYMBOL(&symbol_dsc, &value_dsc, &table_type);
if(!$VMS_STATUS_SUCCESS(status)) {
exit(status);
return status;
}
}
exit(0);
return 0;
}

View File

@ -36,7 +36,7 @@ http
Download two URLs provided on stdin
</name>
<command>
--url @-
--output-dir %LOGDIR --url @-
</command>
<stdin>
http://%HOSTIP:%HTTPPORT/a

View File

@ -73,7 +73,10 @@ BEGIN {
$dev_null
);
}
use pathhelp qw(exe_ext);
use pathhelp qw(
exe_ext
dirsepadd
);
use Cwd qw(getcwd);
use testutil qw(
shell_quote
@ -104,11 +107,11 @@ our $perlcmd=shell_quote($^X);
our $perl="$perlcmd -I. " . shell_quote("-I$srcdir"); # invoke perl like this
our $LOGDIR="log"; # root of the log directory; this will be different for
# each runner in multiprocess mode
our $LIBDIR="./libtest/" . ($ENV{'CURL_DIRSUFFIX'} || '');
our $UNITDIR="./unit/" . ($ENV{'CURL_DIRSUFFIX'} || '');
our $SRVDIR="./server/" . ($ENV{'CURL_DIRSUFFIX'} || '');
our $LIBDIR=dirsepadd("./libtest/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
our $UNITDIR=dirsepadd("./unit/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
our $SRVDIR=dirsepadd("./server/" . ($ENV{'CURL_DIRSUFFIX'} || ''));
our $TESTDIR="$srcdir/data";
our $CURL="../src/" . ($ENV{'CURL_DIRSUFFIX'} || '') . "curl".exe_ext('TOOL'); # what curl binary to run on the tests
our $CURL=dirsepadd("../src/" . ($ENV{'CURL_DIRSUFFIX'} || '')) . "curl".exe_ext('TOOL'); # what curl binary to run on the tests
our $VCURL=$CURL; # what curl binary to use to verify the servers with
# VCURL is handy to set to the system one when the one you
# just built hangs or crashes and thus prevent verification

View File

@ -34,7 +34,7 @@ if(NOT VSFTPD)
endif()
mark_as_advanced(VSFTPD)
find_program(HTTPD "apache2") # /usr/sbin/apache2
find_program(HTTPD NAMES "/usr/sbin/apache2" "httpd" "apache2")
if(NOT HTTPD)
set(HTTPD "")
endif()

View File

@ -140,12 +140,6 @@ static int debug_cb(CURL *handle, curl_infotype type,
return 0;
}
#define ERR() \
do { \
fprintf(stderr, "something unexpected went wrong - bailing out!\n"); \
exit(2); \
} while(0)
static void usage(const char *msg)
{
if(msg)
@ -196,6 +190,13 @@ static size_t cb(char *data, size_t size, size_t nmemb, void *clientp)
handle->idx, (long)realsize);
return realsize;
}
#define ERR() \
do { \
fprintf(stderr, "something unexpected went wrong - bailing out!\n"); \
return 2; \
} while(0)
#endif /* !_MSC_VER */
int main(int argc, char *argv[])
@ -254,19 +255,19 @@ int main(int argc, char *argv[])
cu = curl_url();
if(!cu) {
fprintf(stderr, "out of memory\n");
exit(1);
return 1;
}
if(curl_url_set(cu, CURLUPART_URL, url, 0)) {
fprintf(stderr, "not a URL: '%s'\n", url);
exit(1);
return 1;
}
if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) {
fprintf(stderr, "could not get host of '%s'\n", url);
exit(1);
return 1;
}
if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) {
fprintf(stderr, "could not get port of '%s'\n", url);
exit(1);
return 1;
}
memset(&resolve, 0, sizeof(resolve));
curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",

View File

@ -138,24 +138,25 @@ static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *opaque)
int main(int argc, char *argv[])
{
const char *url;
CURLM *multi;
CURLM *multi = NULL;
CURL *easy;
CURLMcode mc;
int running_handles = 0, start_count, numfds;
CURLMsg *msg;
int msgs_in_queue;
char range[128];
int exitcode = 1;
if(argc != 2) {
fprintf(stderr, "%s URL\n", argv[0]);
exit(2);
return 2;
}
url = argv[1];
multi = curl_multi_init();
if(!multi) {
fprintf(stderr, "curl_multi_init failed\n");
exit(1);
goto cleanup;
}
start_count = 200;
@ -164,7 +165,7 @@ int main(int argc, char *argv[])
easy = curl_easy_init();
if(!easy) {
fprintf(stderr, "curl_easy_init failed\n");
exit(1);
goto cleanup;
}
curl_easy_setopt(easy, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(easy, CURLOPT_DEBUGFUNCTION, debug_cb);
@ -186,8 +187,9 @@ int main(int argc, char *argv[])
mc = curl_multi_add_handle(multi, easy);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_add_handle: %s\n",
curl_multi_strerror(mc));
exit(1);
curl_multi_strerror(mc));
curl_easy_cleanup(easy);
goto cleanup;
}
--start_count;
}
@ -195,16 +197,16 @@ int main(int argc, char *argv[])
mc = curl_multi_perform(multi, &running_handles);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_perform: %s\n",
curl_multi_strerror(mc));
exit(1);
curl_multi_strerror(mc));
goto cleanup;
}
if(running_handles) {
mc = curl_multi_poll(multi, NULL, 0, 1000000, &numfds);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_poll: %s\n",
curl_multi_strerror(mc));
exit(1);
curl_multi_strerror(mc));
goto cleanup;
}
}
@ -224,12 +226,12 @@ int main(int argc, char *argv[])
else if(msg->data.result) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": failed with %d\n", xfer_id, msg->data.result);
exit(1);
goto cleanup;
}
else if(status != 206) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": wrong http status %ld (expected 206)\n", xfer_id, status);
exit(1);
goto cleanup;
}
curl_multi_remove_handle(multi, msg->easy_handle);
curl_easy_cleanup(msg->easy_handle);
@ -244,5 +246,22 @@ int main(int argc, char *argv[])
} while(running_handles > 0 || start_count);
fprintf(stderr, "exiting\n");
exit(EXIT_SUCCESS);
exitcode = EXIT_SUCCESS;
cleanup:
if(multi) {
CURL **list = curl_multi_get_handles(multi);
if(list) {
int i;
for(i = 0; list[i]; i++) {
curl_multi_remove_handle(multi, list[i]);
curl_easy_cleanup(list[i]);
}
curl_free(list);
}
curl_multi_cleanup(multi);
}
return exitcode;
}

View File

@ -136,9 +136,9 @@ static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *opaque)
return size * nmemb;
}
static void add_transfer(CURLM *multi, CURLSH *share,
struct curl_slist *resolve,
const char *url, int http_version)
static int add_transfer(CURLM *multi, CURLSH *share,
struct curl_slist *resolve,
const char *url, int http_version)
{
CURL *easy;
CURLMcode mc;
@ -146,7 +146,7 @@ static void add_transfer(CURLM *multi, CURLSH *share,
easy = curl_easy_init();
if(!easy) {
fprintf(stderr, "curl_easy_init failed\n");
exit(1);
return 1;
}
curl_easy_setopt(easy, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(easy, CURLOPT_DEBUGFUNCTION, debug_cb);
@ -167,30 +167,33 @@ static void add_transfer(CURLM *multi, CURLSH *share,
mc = curl_multi_add_handle(multi, easy);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_add_handle: %s\n",
curl_multi_strerror(mc));
exit(1);
curl_multi_strerror(mc));
curl_easy_cleanup(easy);
return 1;
}
return 0;
}
int main(int argc, char *argv[])
{
const char *url;
CURLM *multi;
CURLM *multi = NULL;
CURLMcode mc;
int running_handles = 0, numfds;
CURLMsg *msg;
CURLSH *share;
CURLSH *share = NULL;
CURLU *cu;
struct curl_slist resolve;
struct curl_slist *resolve = NULL;
char resolve_buf[1024];
int msgs_in_queue;
int add_more, waits, ongoing = 0;
char *host, *port;
char *host = NULL, *port = NULL;
int http_version = CURL_HTTP_VERSION_1_1;
int exitcode = 1;
if(argc != 3) {
fprintf(stderr, "%s proto URL\n", argv[0]);
exit(2);
return 2;
}
if(!strcmp("h2", argv[1]))
@ -202,41 +205,41 @@ int main(int argc, char *argv[])
cu = curl_url();
if(!cu) {
fprintf(stderr, "out of memory\n");
exit(1);
return 1;
}
if(curl_url_set(cu, CURLUPART_URL, url, 0)) {
fprintf(stderr, "not a URL: '%s'\n", url);
exit(1);
goto cleanup;
}
if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) {
fprintf(stderr, "could not get host of '%s'\n", url);
exit(1);
goto cleanup;
}
if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) {
fprintf(stderr, "could not get port of '%s'\n", url);
exit(1);
goto cleanup;
}
memset(&resolve, 0, sizeof(resolve));
curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",
host, port);
curl_slist_append(&resolve, resolve_buf);
resolve = curl_slist_append(resolve, resolve_buf);
multi = curl_multi_init();
if(!multi) {
fprintf(stderr, "curl_multi_init failed\n");
exit(1);
goto cleanup;
}
share = curl_share_init();
if(!share) {
fprintf(stderr, "curl_share_init failed\n");
exit(1);
goto cleanup;
}
curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
add_transfer(multi, share, &resolve, url, http_version);
if(add_transfer(multi, share, resolve, url, http_version))
goto cleanup;
++ongoing;
add_more = 6;
waits = 3;
@ -244,16 +247,16 @@ int main(int argc, char *argv[])
mc = curl_multi_perform(multi, &running_handles);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_perform: %s\n",
curl_multi_strerror(mc));
exit(1);
curl_multi_strerror(mc));
goto cleanup;
}
if(running_handles) {
mc = curl_multi_poll(multi, NULL, 0, 1000000, &numfds);
if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_poll: %s\n",
curl_multi_strerror(mc));
exit(1);
curl_multi_strerror(mc));
goto cleanup;
}
}
@ -262,7 +265,8 @@ int main(int argc, char *argv[])
}
else {
while(add_more) {
add_transfer(multi, share, &resolve, url, http_version);
if(add_transfer(multi, share, resolve, url, http_version))
goto cleanup;
++ongoing;
--add_more;
}
@ -284,12 +288,12 @@ int main(int argc, char *argv[])
else if(msg->data.result) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": failed with %d\n", xfer_id, msg->data.result);
exit(1);
goto cleanup;
}
else if(status != 200) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": wrong http status %ld (expected 200)\n", xfer_id, status);
exit(1);
goto cleanup;
}
curl_multi_remove_handle(multi, msg->easy_handle);
curl_easy_cleanup(msg->easy_handle);
@ -305,5 +309,27 @@ int main(int argc, char *argv[])
} while(ongoing || add_more);
fprintf(stderr, "exiting\n");
exit(EXIT_SUCCESS);
exitcode = EXIT_SUCCESS;
cleanup:
if(multi) {
CURL **list = curl_multi_get_handles(multi);
if(list) {
int i;
for(i = 0; list[i]; i++) {
curl_multi_remove_handle(multi, list[i]);
curl_easy_cleanup(list[i]);
}
curl_free(list);
}
curl_multi_cleanup(multi);
}
curl_share_cleanup(share);
curl_slist_free_all(resolve);
curl_free(host);
curl_free(port);
curl_url_cleanup(cu);
return exitcode;
}

View File

@ -180,12 +180,6 @@ static int progress_callback(void *clientp,
return 0;
}
#define ERR() \
do { \
fprintf(stderr, "something unexpected went wrong - bailing out!\n"); \
exit(2); \
} while(0)
static void usage(const char *msg)
{
if(msg)
@ -196,6 +190,13 @@ static void usage(const char *msg)
" -V http_version (http/1.1, h2, h3) http version to use\n"
);
}
#define ERR() \
do { \
fprintf(stderr, "something unexpected went wrong - bailing out!\n"); \
return 2; \
} while(0)
#endif /* !_MSC_VER */
int main(int argc, char *argv[])
@ -245,19 +246,19 @@ int main(int argc, char *argv[])
cu = curl_url();
if(!cu) {
fprintf(stderr, "out of memory\n");
exit(1);
return 1;
}
if(curl_url_set(cu, CURLUPART_URL, url, 0)) {
fprintf(stderr, "not a URL: '%s'\n", url);
exit(1);
return 1;
}
if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) {
fprintf(stderr, "could not get host of '%s'\n", url);
exit(1);
return 1;
}
if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) {
fprintf(stderr, "could not get port of '%s'\n", url);
exit(1);
return 1;
}
memset(&resolve, 0, sizeof(resolve));
curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",
@ -267,7 +268,7 @@ int main(int argc, char *argv[])
curl = curl_easy_init();
if(!curl) {
fprintf(stderr, "out of memory\n");
exit(1);
return 1;
}
/* We want to use our own read function. */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);

View File

@ -21,7 +21,7 @@
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* used for test case 533, 534 and 535 */
/* used for test case 533, 534, 535 and 546 */
#include "test.h"

View File

@ -59,6 +59,7 @@ BEGIN {
our @EXPORT_OK = qw(
os_is_win
exe_ext
dirsepadd
sys_native_abs_path
sys_native_current_path
build_sys_abs_path
@ -182,4 +183,13 @@ sub exe_ext {
return '';
}
#***************************************************************************
# Add ending slash if missing
#
sub dirsepadd {
my ($dir) = @_;
$dir =~ s/\/$//;
return $dir . '/';
}
1; # End of module

View File

@ -1018,8 +1018,8 @@ int main(int argc, char *argv[])
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
#ifdef _WIN32
win32_init();
atexit(win32_cleanup);
if(win32_init())
return 2;
#endif
CURL_SET_BINMODE(stdin);

View File

@ -99,8 +99,8 @@ int main(int argc, char *argv[])
}
#ifdef _WIN32
win32_init();
atexit(win32_cleanup);
if(win32_init())
return 2;
#endif
#if defined(CURLRES_IPV6)

View File

@ -1145,8 +1145,8 @@ int main(int argc, char *argv[])
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
#ifdef _WIN32
win32_init();
atexit(win32_cleanup);
if(win32_init())
return 2;
#endif
install_signal_handlers(false);

View File

@ -1507,8 +1507,8 @@ int main(int argc, char *argv[])
}
#ifdef _WIN32
win32_init();
atexit(win32_cleanup);
if(win32_init())
return 2;
#endif
CURL_SET_BINMODE(stdin);

View File

@ -1086,8 +1086,8 @@ int main(int argc, char *argv[])
}
#ifdef _WIN32
win32_init();
atexit(win32_cleanup);
if(win32_init())
return 2;
#endif
CURL_SET_BINMODE(stdin);

View File

@ -1611,7 +1611,7 @@ static void http_connect(curl_socket_t *infdp,
if(!req2) {
req2 = malloc(sizeof(*req2));
if(!req2)
exit(1);
goto http_connect_cleanup; /* fail */
}
memset(req2, 0, sizeof(*req2));
logmsg("====> Client connect DATA");
@ -2207,8 +2207,8 @@ int main(int argc, char *argv[])
is_proxy ? "-proxy" : "", socket_type);
#ifdef _WIN32
win32_init();
atexit(win32_cleanup);
if(win32_init())
return 2;
#endif
install_signal_handlers(false);

View File

@ -644,8 +644,8 @@ int main(int argc, char **argv)
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
#ifdef _WIN32
win32_init();
atexit(win32_cleanup);
if(win32_init())
return 2;
#endif
install_signal_handlers(true);

View File

@ -153,7 +153,17 @@ void win32_perror(const char *msg)
fprintf(stderr, "%s\n", buf);
}
void win32_init(void)
static void win32_cleanup(void)
{
#ifdef USE_WINSOCK
WSACleanup();
#endif /* USE_WINSOCK */
/* flush buffers of all streams regardless of their mode */
_flushall();
}
int win32_init(void)
{
#ifdef USE_WINSOCK
WORD wVersionRequested;
@ -166,7 +176,7 @@ void win32_init(void)
if(err) {
perror("Winsock init failed");
logmsg("Error initialising Winsock -- aborting");
exit(1);
return 1;
}
if(LOBYTE(wsaData.wVersion) != LOBYTE(wVersionRequested) ||
@ -174,19 +184,11 @@ void win32_init(void)
WSACleanup();
perror("Winsock init failed");
logmsg("No suitable winsock.dll found -- aborting");
exit(1);
return 1;
}
#endif /* USE_WINSOCK */
}
void win32_cleanup(void)
{
#ifdef USE_WINSOCK
WSACleanup();
#endif /* USE_WINSOCK */
/* flush buffers of all streams regardless of their mode */
_flushall();
atexit(win32_cleanup);
return 0;
}
/* socket-safe strerror (works on Winsock errors, too) */

View File

@ -51,8 +51,7 @@ extern const char *cmdfile;
#define perror(m) win32_perror(m)
void win32_perror(const char *msg);
void win32_init(void);
void win32_cleanup(void);
int win32_init(void);
const char *sstrerror(int err);
#else /* _WIN32 */

View File

@ -58,9 +58,11 @@ CFGSET=true
!ENDIF
!INCLUDE "../lib/Makefile.inc"
CSOURCES=$(CSOURCES: = )
LIBCURL_OBJS=$(CSOURCES:.c=.obj)
!INCLUDE "../src/Makefile.inc"
CURL_CFILES=$(CURL_CFILES: = )
CURL_OBJS=$(CURL_CFILES:.c=.obj)