Compare commits

..

2 Commits

Author SHA1 Message Date
Daniel Stenberg
3c7c614df5
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:02 +01:00
Daniel Stenberg
ae72de1caa
docs: minor edits to please the new spellchecker regime 2025-02-27 13:15:02 +01:00
50 changed files with 353 additions and 428 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -352,12 +352,13 @@ endif()
if(WIN32) if(WIN32)
option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF) option(CURL_STATIC_CRT "Build libcurl with static CRT with MSVC (/MT)" OFF)
if(CURL_STATIC_CRT AND MSVC) if(CURL_STATIC_CRT AND MSVC)
if(BUILD_STATIC_CURL OR NOT BUILD_CURL_EXE) if(BUILD_STATIC_CURL)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
string(APPEND CMAKE_C_FLAGS_RELEASE " -MT") string(APPEND CMAKE_C_FLAGS_RELEASE " -MT")
string(APPEND CMAKE_C_FLAGS_DEBUG " -MTd") string(APPEND CMAKE_C_FLAGS_DEBUG " -MTd")
else() else()
message(WARNING "Static CRT requires static or no curl executable.") message(WARNING "Static CRT requires curl executable built with static libcurl "
"(BUILD_STATIC_LIBS=ON and BUILD_STATIC_CURL=ON).")
endif() endif()
endif() endif()
endif() endif()
@ -1953,6 +1954,22 @@ endif()
# Some other minor tests # 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) if(_cmake_try_compile_target_type_save)
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_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) unset(_cmake_try_compile_target_type_save)

View File

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

View File

@ -61,15 +61,15 @@ environment:
SCHANNEL: 'ON' SCHANNEL: 'ON'
DEBUG: 'OFF' DEBUG: 'OFF'
CURLDEBUG: 'ON' CURLDEBUG: 'ON'
- job_name: 'CMake, VS2008, Debug, x86, OpenSSL 1.0.2 + Schannel, Shared, Build-tests & examples' - job_name: 'CMake, VS2008, Debug, x86, OpenSSL 1.1.1 + Schannel, Shared, Build-tests & examples'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2013' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
PRJ_GEN: 'Visual Studio 9 2008' PRJ_GEN: 'Visual Studio 9 2008'
TARGET: '-A Win32' TARGET: '-A Win32'
PRJ_CFG: Debug PRJ_CFG: Debug
OPENSSL: 'ON' OPENSSL: 'ON'
SCHANNEL: 'ON' SCHANNEL: 'ON'
SHARED: 'ON' SHARED: 'ON'
EXAMPLES: 'ON' EXAMPLES: 'OFF'
- job_name: 'CMake, VS2010, Debug, x64, Schannel, Shared, Build-tests & examples' - job_name: 'CMake, VS2010, Debug, x64, Schannel, Shared, Build-tests & examples'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015'
PRJ_GEN: 'Visual Studio 10 2010' PRJ_GEN: 'Visual Studio 10 2010'
@ -109,7 +109,7 @@ environment:
OPENSSL: 'ON' OPENSSL: 'ON'
SHARED: 'ON' SHARED: 'ON'
TFLAGS: 'skipall' TFLAGS: 'skipall'
- job_name: 'CMake, VS2019, Debug, x64, OpenSSL 1.1.0 + Schannel, Shared, Build-tests' - job_name: 'CMake, VS2019, Debug, x64, OpenSSL 1.0.2 + Schannel, Shared, Build-tests'
APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2019' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2019'
PRJ_GEN: 'Visual Studio 16 2019' PRJ_GEN: 'Visual Studio 16 2019'
TARGET: '-A x64' 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`: Enable libcurl versioned symbols. Default: `OFF`
- `CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX`: Override default versioned symbol prefix. Default: `<TLS-BACKEND>_` or `MULTISSL_` - `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_LTO`: Enable compiler Link Time Optimizations. Default: `OFF`
- `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`) (requires static or no curl executable). Default: `OFF` - `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`) (requires static curl executable). Default: `OFF`
- `CURL_TARGET_WINDOWS_VERSION`: Minimum target Windows version as hex string. - `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_TEST_BUNDLES`: Bundle `libtest` and `unittest` tests into single binaries. Default: `OFF`
- `CURL_WERROR`: Turn compiler warnings into errors. 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 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. already do much worse harm and the problem is not really in curl.
## Debug & Experiments ## Experiments
Vulnerabilities in features which are off by default (in the build) and Vulnerabilities in features which are off by default (in the build) and
documented as experimental, or exist only in debug mode, are not eligible for a documented as experimental, are not eligible for a reward and we do not
reward and we do not consider them security problems. consider them security problems.
## URL inconsistencies ## URL inconsistencies

View File

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

View File

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

View File

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

View File

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

View File

@ -402,22 +402,22 @@ static int init_fifo(GlobalInfo *g)
curl_socket_t sockfd; curl_socket_t sockfd;
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo); 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) { if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST; errno = EEXIST;
perror("lstat"); perror("lstat");
return 1; exit(1);
} }
} }
unlink(fifo); unlink(fifo);
if(mkfifo(fifo, 0600) == -1) { if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo"); perror("mkfifo");
return 1; exit(1);
} }
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) { if(sockfd == -1) {
perror("open"); perror("open");
return 1; exit(1);
} }
g->input = fdopen(sockfd, "r"); g->input = fdopen(sockfd, "r");
@ -436,8 +436,7 @@ int main(int argc, char **argv)
memset(&g, 0, sizeof(GlobalInfo)); memset(&g, 0, sizeof(GlobalInfo));
g.loop = ev_default_loop(0); g.loop = ev_default_loop(0);
if(init_fifo(&g)) init_fifo(&g);
return 1;
g.multi = curl_multi_init(); g.multi = curl_multi_init();
ev_timer_init(&g.timer_event, timer_cb, 0., 0.); 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) { if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST; errno = EEXIST;
perror("lstat"); perror("lstat");
return CURL_SOCKET_BAD; exit(1);
} }
} }
unlink(fifo); unlink(fifo);
if(mkfifo(fifo, 0600) == -1) { if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo"); perror("mkfifo");
return CURL_SOCKET_BAD; exit(1);
} }
socket = open(fifo, O_RDWR | O_NONBLOCK, 0); socket = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(socket == CURL_SOCKET_BAD) { if(socket == -1) {
perror("open"); perror("open");
return socket; exit(1);
} }
MSG_OUT("Now, pipe some URL's into > %s\n", fifo); MSG_OUT("Now, pipe some URL's into > %s\n", fifo);
@ -421,8 +421,6 @@ int main(void)
GIOChannel* ch; GIOChannel* ch;
fd = init_fifo(); fd = init_fifo();
if(fd == CURL_SOCKET_BAD)
return 1;
ch = g_io_channel_unix_new(fd); ch = g_io_channel_unix_new(fd);
g_io_add_watch(ch, G_IO_IN, fifo_cb, g); g_io_add_watch(ch, G_IO_IN, fifo_cb, g);
gmain = g_main_loop_new(NULL, FALSE); gmain = g_main_loop_new(NULL, FALSE);

View File

@ -399,22 +399,22 @@ static int init_fifo(GlobalInfo *g)
curl_socket_t sockfd; curl_socket_t sockfd;
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo); 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) { if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST; errno = EEXIST;
perror("lstat"); perror("lstat");
return 1; exit(1);
} }
} }
unlink(fifo); unlink(fifo);
if(mkfifo (fifo, 0600) == -1) { if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo"); perror("mkfifo");
return 1; exit(1);
} }
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0); sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) { if(sockfd == -1) {
perror("open"); perror("open");
return 1; exit(1);
} }
g->input = fdopen(sockfd, "r"); g->input = fdopen(sockfd, "r");
@ -440,8 +440,7 @@ int main(int argc, char **argv)
memset(&g, 0, sizeof(GlobalInfo)); memset(&g, 0, sizeof(GlobalInfo));
g.evbase = event_base_new(); g.evbase = event_base_new();
if(init_fifo(&g)) init_fifo(&g);
return 1;
g.multi = curl_multi_init(); g.multi = curl_multi_init();
evtimer_assign(&g.timer_event, g.evbase, timer_cb, &g); 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) { if(conn == NULL) {
fprintf(stderr, "Failed to create CURL connection\n"); fprintf(stderr, "Failed to create CURL connection\n");
return false; exit(EXIT_FAILURE);
} }
code = curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, errorBuffer); code = curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, errorBuffer);
@ -270,7 +270,7 @@ int main(int argc, char *argv[])
if(argc != 2) { if(argc != 2) {
fprintf(stderr, "Usage: %s <url>\n", argv[0]); fprintf(stderr, "Usage: %s <url>\n", argv[0]);
return EXIT_FAILURE; exit(EXIT_FAILURE);
} }
curl_global_init(CURL_GLOBAL_DEFAULT); curl_global_init(CURL_GLOBAL_DEFAULT);
@ -279,7 +279,7 @@ int main(int argc, char *argv[])
if(!init(conn, argv[1])) { if(!init(conn, argv[1])) {
fprintf(stderr, "Connection initialization failed\n"); fprintf(stderr, "Connection initialization failed\n");
return EXIT_FAILURE; exit(EXIT_FAILURE);
} }
// Retrieve content for the URL // Retrieve content for the URL
@ -289,7 +289,7 @@ int main(int argc, char *argv[])
if(code != CURLE_OK) { if(code != CURLE_OK) {
fprintf(stderr, "Failed to get '%s' [%s]\n", argv[1], errorBuffer); fprintf(stderr, "Failed to get '%s' [%s]\n", argv[1], errorBuffer);
return EXIT_FAILURE; exit(EXIT_FAILURE);
} }
// Parse the (assumed) HTML code // Parse the (assumed) HTML code

View File

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

View File

@ -592,7 +592,7 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
res->num_pending--; res->num_pending--;
if(CURL_ASYNC_SUCCESS == status) { if(CURL_ASYNC_SUCCESS == status) {
struct Curl_addrinfo *ai = Curl_he2ai(hostent, data->conn->remote_port); struct Curl_addrinfo *ai = Curl_he2ai(hostent, data->state.async.port);
if(ai) { if(ai) {
compound_results(res, ai); compound_results(res, ai);
} }
@ -774,6 +774,8 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
if(!res->hostname) if(!res->hostname)
return NULL; return NULL;
data->state.async.hostname = res->hostname;
data->state.async.port = port;
data->state.async.done = FALSE; /* not done */ data->state.async.done = FALSE; /* not done */
data->state.async.dns = NULL; /* clear */ data->state.async.dns = NULL; /* clear */
@ -809,7 +811,6 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
service, &hints, addrinfo_cb, data); service, &hints, addrinfo_cb, data);
} }
#else #else
(void)port;
#ifdef HAVE_CARES_IPV6 #ifdef HAVE_CARES_IPV6
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) { 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; td->init = FALSE;
} }
Curl_safefree(async->hostname);
} }
#ifdef USE_HTTPSRR_ARES #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)); memset(&async->thdata.hinfo, 0, sizeof(struct Curl_https_rrinfo));
async->thdata.hinfo.port = -1; async->thdata.hinfo.port = -1;
ares_query_dnsrec(async->thdata.channel, ares_query_dnsrec(async->thdata.channel,
data->conn->host.name, ARES_CLASS_IN, async->hostname, ARES_CLASS_IN,
ARES_REC_TYPE_HTTPS, ARES_REC_TYPE_HTTPS,
Curl_dnsrec_done_cb, data, NULL); Curl_dnsrec_done_cb, data, NULL);
@ -436,6 +436,7 @@ static bool init_resolve_thread(struct Curl_easy *data,
int err = ENOMEM; int err = ENOMEM;
struct Curl_async *async = &data->state.async; struct Curl_async *async = &data->state.async;
async->port = port;
async->done = FALSE; async->done = FALSE;
async->dns = NULL; async->dns = NULL;
td->thread_hnd = curl_thread_t_null; td->thread_hnd = curl_thread_t_null;
@ -446,6 +447,11 @@ static bool init_resolve_thread(struct Curl_easy *data,
goto errno_exit; goto errno_exit;
} }
free(async->hostname);
async->hostname = strdup(hostname);
if(!async->hostname)
goto err_exit;
/* The thread will set this TRUE when complete. */ /* The thread will set this TRUE when complete. */
td->tsd.done = FALSE; 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 && if(dohp->probe[DOH_SLOT_IPV4].easy_mid < 0 &&
dohp->probe[DOH_SLOT_IPV6].easy_mid < 0) { dohp->probe[DOH_SLOT_IPV6].easy_mid < 0) {
failf(data, "Could not DoH-resolve: %s", dohp->host); failf(data, "Could not DoH-resolve: %s", data->state.async.hostname);
return CONN_IS_PROXIED(data->conn) ? CURLE_COULDNT_RESOLVE_PROXY : return CONN_IS_PROXIED(data->conn) ? CURLE_COULDNT_RESOLVE_PROXY :
CURLE_COULDNT_RESOLVE_HOST; 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); Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
dns = Curl_cache_addr(data, ai, dns = Curl_cache_addr(data, ai,
data->conn->host.dispname, 0, data->state.async.hostname, 0,
data->conn->localport, FALSE); data->state.async.port, FALSE);
if(data->share) if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS); 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, failf(data, "Could not resolve %s: %s", host_or_proxy,
data->conn->host.dispname); data->state.async.hostname);
return result; return result;
} }

View File

@ -565,12 +565,14 @@ struct hostname {
#if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH) #if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH)
#define USE_CURL_ASYNC #define USE_CURL_ASYNC
struct Curl_async { struct Curl_async {
char *hostname;
struct Curl_dns_entry *dns; struct Curl_dns_entry *dns;
#ifdef CURLRES_ASYNCH #ifdef CURLRES_ASYNCH
struct thread_data thdata; struct thread_data thdata;
#endif #endif
void *resolver; /* resolver state, if it is used in the URL state - void *resolver; /* resolver state, if it is used in the URL state -
ares_channel e.g. */ ares_channel e.g. */
int port;
BIT(done); /* set TRUE when the lookup is complete */ 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; return CURLE_SSL_CONNECT_ERROR;
} }
} }
else { else if(ssl_config->key_passwd) {
const unsigned int supported_key_encryption_algorithms = const unsigned int supported_key_encryption_algorithms =
GNUTLS_PKCS_USE_PKCS12_3DES | GNUTLS_PKCS_USE_PKCS12_ARCFOUR | GNUTLS_PKCS_USE_PKCS12_3DES | GNUTLS_PKCS_USE_PKCS12_ARCFOUR |
GNUTLS_PKCS_USE_PKCS12_RC2_40 | GNUTLS_PKCS_USE_PBES2_3DES | GNUTLS_PKCS_USE_PKCS12_RC2_40 | GNUTLS_PKCS_USE_PBES2_3DES |
@ -974,12 +974,22 @@ static CURLcode gtls_client_init(struct Curl_cfilter *cf,
supported_key_encryption_algorithms); supported_key_encryption_algorithms);
if(rc != GNUTLS_E_SUCCESS) { if(rc != GNUTLS_E_SUCCESS) {
failf(data, failf(data,
"error reading X.509 %skey file: %s", "error reading X.509 potentially-encrypted key file: %s",
ssl_config->key_passwd ? "potentially-encrypted " : "",
gnutls_strerror(rc)); gnutls_strerror(rc));
return CURLE_SSL_CONNECT_ERROR; 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 #ifdef USE_GNUTLS_SRP

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -138,25 +138,24 @@ static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *opaque)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const char *url; const char *url;
CURLM *multi = NULL; CURLM *multi;
CURL *easy; CURL *easy;
CURLMcode mc; CURLMcode mc;
int running_handles = 0, start_count, numfds; int running_handles = 0, start_count, numfds;
CURLMsg *msg; CURLMsg *msg;
int msgs_in_queue; int msgs_in_queue;
char range[128]; char range[128];
int exitcode = 1;
if(argc != 2) { if(argc != 2) {
fprintf(stderr, "%s URL\n", argv[0]); fprintf(stderr, "%s URL\n", argv[0]);
return 2; exit(2);
} }
url = argv[1]; url = argv[1];
multi = curl_multi_init(); multi = curl_multi_init();
if(!multi) { if(!multi) {
fprintf(stderr, "curl_multi_init failed\n"); fprintf(stderr, "curl_multi_init failed\n");
goto cleanup; exit(1);
} }
start_count = 200; start_count = 200;
@ -165,7 +164,7 @@ int main(int argc, char *argv[])
easy = curl_easy_init(); easy = curl_easy_init();
if(!easy) { if(!easy) {
fprintf(stderr, "curl_easy_init failed\n"); fprintf(stderr, "curl_easy_init failed\n");
goto cleanup; exit(1);
} }
curl_easy_setopt(easy, CURLOPT_VERBOSE, 1L); curl_easy_setopt(easy, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(easy, CURLOPT_DEBUGFUNCTION, debug_cb); curl_easy_setopt(easy, CURLOPT_DEBUGFUNCTION, debug_cb);
@ -187,9 +186,8 @@ int main(int argc, char *argv[])
mc = curl_multi_add_handle(multi, easy); mc = curl_multi_add_handle(multi, easy);
if(mc != CURLM_OK) { if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_add_handle: %s\n", fprintf(stderr, "curl_multi_add_handle: %s\n",
curl_multi_strerror(mc)); curl_multi_strerror(mc));
curl_easy_cleanup(easy); exit(1);
goto cleanup;
} }
--start_count; --start_count;
} }
@ -197,16 +195,16 @@ int main(int argc, char *argv[])
mc = curl_multi_perform(multi, &running_handles); mc = curl_multi_perform(multi, &running_handles);
if(mc != CURLM_OK) { if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_perform: %s\n", fprintf(stderr, "curl_multi_perform: %s\n",
curl_multi_strerror(mc)); curl_multi_strerror(mc));
goto cleanup; exit(1);
} }
if(running_handles) { if(running_handles) {
mc = curl_multi_poll(multi, NULL, 0, 1000000, &numfds); mc = curl_multi_poll(multi, NULL, 0, 1000000, &numfds);
if(mc != CURLM_OK) { if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_poll: %s\n", fprintf(stderr, "curl_multi_poll: %s\n",
curl_multi_strerror(mc)); curl_multi_strerror(mc));
goto cleanup; exit(1);
} }
} }
@ -226,12 +224,12 @@ int main(int argc, char *argv[])
else if(msg->data.result) { else if(msg->data.result) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": failed with %d\n", xfer_id, msg->data.result); ": failed with %d\n", xfer_id, msg->data.result);
goto cleanup; exit(1);
} }
else if(status != 206) { else if(status != 206) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": wrong http status %ld (expected 206)\n", xfer_id, status); ": wrong http status %ld (expected 206)\n", xfer_id, status);
goto cleanup; exit(1);
} }
curl_multi_remove_handle(multi, msg->easy_handle); curl_multi_remove_handle(multi, msg->easy_handle);
curl_easy_cleanup(msg->easy_handle); curl_easy_cleanup(msg->easy_handle);
@ -246,22 +244,5 @@ int main(int argc, char *argv[])
} while(running_handles > 0 || start_count); } while(running_handles > 0 || start_count);
fprintf(stderr, "exiting\n"); fprintf(stderr, "exiting\n");
exitcode = EXIT_SUCCESS; exit(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; return size * nmemb;
} }
static int add_transfer(CURLM *multi, CURLSH *share, static void add_transfer(CURLM *multi, CURLSH *share,
struct curl_slist *resolve, struct curl_slist *resolve,
const char *url, int http_version) const char *url, int http_version)
{ {
CURL *easy; CURL *easy;
CURLMcode mc; CURLMcode mc;
@ -146,7 +146,7 @@ static int add_transfer(CURLM *multi, CURLSH *share,
easy = curl_easy_init(); easy = curl_easy_init();
if(!easy) { if(!easy) {
fprintf(stderr, "curl_easy_init failed\n"); fprintf(stderr, "curl_easy_init failed\n");
return 1; exit(1);
} }
curl_easy_setopt(easy, CURLOPT_VERBOSE, 1L); curl_easy_setopt(easy, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(easy, CURLOPT_DEBUGFUNCTION, debug_cb); curl_easy_setopt(easy, CURLOPT_DEBUGFUNCTION, debug_cb);
@ -167,33 +167,30 @@ static int add_transfer(CURLM *multi, CURLSH *share,
mc = curl_multi_add_handle(multi, easy); mc = curl_multi_add_handle(multi, easy);
if(mc != CURLM_OK) { if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_add_handle: %s\n", fprintf(stderr, "curl_multi_add_handle: %s\n",
curl_multi_strerror(mc)); curl_multi_strerror(mc));
curl_easy_cleanup(easy); exit(1);
return 1;
} }
return 0;
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const char *url; const char *url;
CURLM *multi = NULL; CURLM *multi;
CURLMcode mc; CURLMcode mc;
int running_handles = 0, numfds; int running_handles = 0, numfds;
CURLMsg *msg; CURLMsg *msg;
CURLSH *share = NULL; CURLSH *share;
CURLU *cu; CURLU *cu;
struct curl_slist *resolve = NULL; struct curl_slist resolve;
char resolve_buf[1024]; char resolve_buf[1024];
int msgs_in_queue; int msgs_in_queue;
int add_more, waits, ongoing = 0; int add_more, waits, ongoing = 0;
char *host = NULL, *port = NULL; char *host, *port;
int http_version = CURL_HTTP_VERSION_1_1; int http_version = CURL_HTTP_VERSION_1_1;
int exitcode = 1;
if(argc != 3) { if(argc != 3) {
fprintf(stderr, "%s proto URL\n", argv[0]); fprintf(stderr, "%s proto URL\n", argv[0]);
return 2; exit(2);
} }
if(!strcmp("h2", argv[1])) if(!strcmp("h2", argv[1]))
@ -205,41 +202,41 @@ int main(int argc, char *argv[])
cu = curl_url(); cu = curl_url();
if(!cu) { if(!cu) {
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
return 1; exit(1);
} }
if(curl_url_set(cu, CURLUPART_URL, url, 0)) { if(curl_url_set(cu, CURLUPART_URL, url, 0)) {
fprintf(stderr, "not a URL: '%s'\n", url); fprintf(stderr, "not a URL: '%s'\n", url);
goto cleanup; exit(1);
} }
if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) { if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) {
fprintf(stderr, "could not get host of '%s'\n", url); fprintf(stderr, "could not get host of '%s'\n", url);
goto cleanup; exit(1);
} }
if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) { if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) {
fprintf(stderr, "could not get port of '%s'\n", url); fprintf(stderr, "could not get port of '%s'\n", url);
goto cleanup; exit(1);
} }
memset(&resolve, 0, sizeof(resolve));
curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1", curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",
host, port); host, port);
resolve = curl_slist_append(resolve, resolve_buf); curl_slist_append(&resolve, resolve_buf);
multi = curl_multi_init(); multi = curl_multi_init();
if(!multi) { if(!multi) {
fprintf(stderr, "curl_multi_init failed\n"); fprintf(stderr, "curl_multi_init failed\n");
goto cleanup; exit(1);
} }
share = curl_share_init(); share = curl_share_init();
if(!share) { if(!share) {
fprintf(stderr, "curl_share_init failed\n"); fprintf(stderr, "curl_share_init failed\n");
goto cleanup; exit(1);
} }
curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION); curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
if(add_transfer(multi, share, resolve, url, http_version)) add_transfer(multi, share, &resolve, url, http_version);
goto cleanup;
++ongoing; ++ongoing;
add_more = 6; add_more = 6;
waits = 3; waits = 3;
@ -247,16 +244,16 @@ int main(int argc, char *argv[])
mc = curl_multi_perform(multi, &running_handles); mc = curl_multi_perform(multi, &running_handles);
if(mc != CURLM_OK) { if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_perform: %s\n", fprintf(stderr, "curl_multi_perform: %s\n",
curl_multi_strerror(mc)); curl_multi_strerror(mc));
goto cleanup; exit(1);
} }
if(running_handles) { if(running_handles) {
mc = curl_multi_poll(multi, NULL, 0, 1000000, &numfds); mc = curl_multi_poll(multi, NULL, 0, 1000000, &numfds);
if(mc != CURLM_OK) { if(mc != CURLM_OK) {
fprintf(stderr, "curl_multi_poll: %s\n", fprintf(stderr, "curl_multi_poll: %s\n",
curl_multi_strerror(mc)); curl_multi_strerror(mc));
goto cleanup; exit(1);
} }
} }
@ -265,8 +262,7 @@ int main(int argc, char *argv[])
} }
else { else {
while(add_more) { while(add_more) {
if(add_transfer(multi, share, resolve, url, http_version)) add_transfer(multi, share, &resolve, url, http_version);
goto cleanup;
++ongoing; ++ongoing;
--add_more; --add_more;
} }
@ -288,12 +284,12 @@ int main(int argc, char *argv[])
else if(msg->data.result) { else if(msg->data.result) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": failed with %d\n", xfer_id, msg->data.result); ": failed with %d\n", xfer_id, msg->data.result);
goto cleanup; exit(1);
} }
else if(status != 200) { else if(status != 200) {
fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T fprintf(stderr, "transfer #%" CURL_FORMAT_CURL_OFF_T
": wrong http status %ld (expected 200)\n", xfer_id, status); ": wrong http status %ld (expected 200)\n", xfer_id, status);
goto cleanup; exit(1);
} }
curl_multi_remove_handle(multi, msg->easy_handle); curl_multi_remove_handle(multi, msg->easy_handle);
curl_easy_cleanup(msg->easy_handle); curl_easy_cleanup(msg->easy_handle);
@ -309,27 +305,5 @@ int main(int argc, char *argv[])
} while(ongoing || add_more); } while(ongoing || add_more);
fprintf(stderr, "exiting\n"); fprintf(stderr, "exiting\n");
exitcode = EXIT_SUCCESS; exit(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,6 +180,12 @@ static int progress_callback(void *clientp,
return 0; return 0;
} }
#define ERR() \
do { \
fprintf(stderr, "something unexpected went wrong - bailing out!\n"); \
exit(2); \
} while(0)
static void usage(const char *msg) static void usage(const char *msg)
{ {
if(msg) if(msg)
@ -190,13 +196,6 @@ static void usage(const char *msg)
" -V http_version (http/1.1, h2, h3) http version to use\n" " -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 */ #endif /* !_MSC_VER */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -246,19 +245,19 @@ int main(int argc, char *argv[])
cu = curl_url(); cu = curl_url();
if(!cu) { if(!cu) {
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
return 1; exit(1);
} }
if(curl_url_set(cu, CURLUPART_URL, url, 0)) { if(curl_url_set(cu, CURLUPART_URL, url, 0)) {
fprintf(stderr, "not a URL: '%s'\n", url); fprintf(stderr, "not a URL: '%s'\n", url);
return 1; exit(1);
} }
if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) { if(curl_url_get(cu, CURLUPART_HOST, &host, 0)) {
fprintf(stderr, "could not get host of '%s'\n", url); fprintf(stderr, "could not get host of '%s'\n", url);
return 1; exit(1);
} }
if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) { if(curl_url_get(cu, CURLUPART_PORT, &port, 0)) {
fprintf(stderr, "could not get port of '%s'\n", url); fprintf(stderr, "could not get port of '%s'\n", url);
return 1; exit(1);
} }
memset(&resolve, 0, sizeof(resolve)); memset(&resolve, 0, sizeof(resolve));
curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1", curl_msnprintf(resolve_buf, sizeof(resolve_buf)-1, "%s:%s:127.0.0.1",
@ -268,7 +267,7 @@ int main(int argc, char *argv[])
curl = curl_easy_init(); curl = curl_easy_init();
if(!curl) { if(!curl) {
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
return 1; exit(1);
} }
/* We want to use our own read function. */ /* We want to use our own read function. */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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