diff --git a/.circleci/config.yml b/.circleci/config.yml index 63eae308c4..30eec16e5a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,28 +38,16 @@ commands: steps: - run: command: | + export DEBIAN_FRONTEND=noninteractive sudo apt-get update && sudo apt-get install -y libssh-dev install-deps: steps: - run: command: | - sudo apt-get update && sudo apt-get install -y libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev python3-pip libpsl-dev - sudo python3 -m pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary -r tests/requirements.txt - - install-wolfssl: - steps: - - run: - command: | - # renovate: datasource=github-tags depName=wolfSSL/wolfssl versioning=semver extractVersion=^v?(?.+)-stable$ registryUrl=https://github.com - WOLFSSL_VERSION=5.8.0 - echo "Installing wolfSSL $WOLFSSL_VERSION" - curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 120 --retry 6 --retry-connrefused \ - --location "https://github.com/wolfSSL/wolfssl/archive/v$WOLFSSL_VERSION-stable.tar.gz" | tar -xz - cd wolfssl-$WOLFSSL_VERSION-stable - ./autogen.sh - ./configure --disable-dependency-tracking --enable-tls13 --enable-all --enable-harden --prefix=$HOME/wssl - make install + sudo apt-get update && sudo apt-get install -y libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev python3-pip + python3 -m venv ~/venv + ~/venv/bin/pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary -r tests/requirements.txt configure: steps: @@ -109,16 +97,24 @@ commands: build: steps: - run: make -j3 V=1 + - run: src/curl --disable --version - run: make -j3 V=1 examples test: steps: - - run: make -j3 V=1 test-ci TFLAGS='-j14' + - run: + command: | + source ~/venv/bin/activate + # Revert a CircleCI-specific local setting that makes test 1459 + # return 67 (CURLE_LOGIN_DENIED) instead of the + # expected 60 (CURLE_PEER_FAILED_VERIFICATION). + echo 'StrictHostKeyChecking yes' >> ~/.ssh/config + make -j3 V=1 test-ci TFLAGS='-j14' executors: ubuntu: machine: - image: ubuntu-2004:2024.01.1 + image: ubuntu-2204:2025.09.1 jobs: basic: @@ -161,7 +157,7 @@ jobs: arm: machine: - image: ubuntu-2004:2024.01.1 + image: ubuntu-2204:2025.09.1 resource_class: arm.medium steps: - checkout @@ -172,7 +168,7 @@ jobs: arm-cares: machine: - image: ubuntu-2004:2024.01.1 + image: ubuntu-2204:2025.09.1 resource_class: arm.medium steps: - checkout diff --git a/.github/scripts/badwords.pl b/.github/scripts/badwords.pl index c6229f4ad4..014468c6f9 100755 --- a/.github/scripts/badwords.pl +++ b/.github/scripts/badwords.pl @@ -20,7 +20,12 @@ use warnings; my @whitelist; my %alt; my %exactcase; +my $skip_indented = 1; +if($ARGV[0] eq "-a") { + shift @ARGV; + $skip_indented = 0; +} my %wl; if($ARGV[0] eq "-w") { shift @ARGV; @@ -68,7 +73,7 @@ sub file { my $in = $_; $l++; chomp $in; - if($in =~ /^ /) { + if($skip_indented && $in =~ /^ /) { next; } # remove the link part @@ -94,7 +99,7 @@ sub file { } print STDERR "$f:$l:$c: error: found bad word \"$w\"\n"; - printf STDERR " %4d | $in\n", $l; + printf STDERR " %4d | %s\n", $l, $in; printf STDERR " | %*s^%s\n", length($p), " ", "~" x (length($w)-1); printf STDERR " maybe use \"%s\" instead?\n", $alt{$w}; diff --git a/.github/scripts/badwords.txt b/.github/scripts/badwords.txt index 7f6bca32b6..ca86745ebf 100644 --- a/.github/scripts/badwords.txt +++ b/.github/scripts/badwords.txt @@ -10,59 +10,56 @@ tool chain:toolchain tool-chain:toolchain wild-card:wildcard wild card:wildcard +\bit's:it is +aren't:are not +can't:cannot +could've:could have +couldn't:could not +didn't:did not +doesn't:does not +don't=do not i'm:I am -you've:You have -we've:we have -we're:we are -we'll:we will -we'd:we would -they've:They have -they're:They are -they'll:They will +isn't:is not +it'd:it would +should've:should have +that's:that is +there's:there is they'd:They would -you've:you have +they'll:They will +they're:They are +they've:They have +we'd:we would +we'll:we will +we're:we are +we've:we have +won't:will not you'd:you would you'll:you will you're:you are -should've:should have -don't=do not -could've:could have -doesn't:does not -isn't:is not -aren't:are not +you've:you have a html: an html a http: an http a ftp: an ftp a IPv4: an IPv4 a IPv6: an IPv6 - url =URL + url [^=]=URL [^/]internet\b=Internet isation:ization -\bit's:it is -it'd:it would -there's:there is [^.]\. And: Rewrite it somehow? ^(And|So|But) = Rewrite it somehow? \. But: Rewrite it somehow? \. So : Rewrite without "so" ? - dir :directory + dir [^=]=directory + Dir [^=]=Directory sub-director:subdirector -you'd:you would -you'll:you will -can't:cannot -that's:that is web page:webpage host name\b:hostname host names\b:hostnames -[^;]file name\b:filename +[^;<]file name\b:filename file names\b:filenames \buser name\b:username \buser names\b:usernames \bpass phrase:passphrase -didn't:did not -doesn't:does not -won't:will not -couldn't:could not \bwill\b:rewrite to present tense \b32bit=32-bit \b64bit=64-bit @@ -78,5 +75,5 @@ couldn't:could not ---WWW::Curl ---NET::Curl ---Curl Corporation -\bmanpages[^./&:-]:man pages -\bmanpage[^si./&:-]:man page +\bmanpages[^./;=&{:-]:man pages +\bmanpage[^si./;=&{:-]:man page diff --git a/.github/workflows/checkdocs.yml b/.github/workflows/checkdocs.yml index dbdd556557..8caf9479fd 100644 --- a/.github/workflows/checkdocs.yml +++ b/.github/workflows/checkdocs.yml @@ -14,6 +14,7 @@ name: 'Docs' - '*/ci' paths: - '.github/workflows/checkdocs.yml' + - '.github/scripts/**' - '.github/scripts/mdlinkcheck' - '/scripts/**' - '**.md' @@ -25,6 +26,7 @@ name: 'Docs' - '.github/workflows/checkdocs.yml' - '.github/scripts/**' - '.github/scripts/mdlinkcheck' + - '/scripts/**' - '**.md' - 'docs/*' diff --git a/.github/workflows/checksrc.yml b/.github/workflows/checksrc.yml index 7aa8faf6a2..9ed049c13f 100644 --- a/.github/workflows/checksrc.yml +++ b/.github/workflows/checksrc.yml @@ -103,10 +103,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 3 steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false - - name: 'install pmccabe' run: | sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list @@ -115,9 +111,25 @@ jobs: sudo apt-get -o Dpkg::Use-Pty=0 install \ pmccabe + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - name: 'check scores' run: ./scripts/top-complexity + xmllint: + name: 'xmllint' + runs-on: macos-latest + timeout-minutes: 1 + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: 'check' + run: git grep -z -i -l -E '^<\?xml' | xargs -0 -r xmllint >/dev/null + miscchecks: name: 'misc checks' runs-on: ubuntu-latest @@ -162,6 +174,7 @@ jobs: - name: 'yamlcheck' run: .github/scripts/yamlcheck.sh - # we allow some extra in source code - name: 'badwords' - run: grep -Ev '(\\bwill| url | dir )' .github/scripts/badwords.txt | .github/scripts/badwords.pl src lib include + run: | + # we allow some extra in source code + grep -Ev '(\\bwill| But: | So : )' .github/scripts/badwords.txt | .github/scripts/badwords.pl -a src lib include docs/examples diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 90e2ea5fb4..87a041563c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -39,6 +39,7 @@ permissions: {} jobs: gha_python: + if: ${{ github.repository_owner == 'curl' || github.event_name != 'schedule' }} name: 'GHA and Python' runs-on: ubuntu-latest permissions: @@ -58,6 +59,7 @@ jobs: uses: github/codeql-action/analyze@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3 c: + if: ${{ github.repository_owner == 'curl' || github.event_name != 'schedule' }} name: 'C' runs-on: ${{ matrix.platform == 'Linux' && 'ubuntu-latest' || 'windows-2022' }} permissions: diff --git a/.github/workflows/http3-linux.yml b/.github/workflows/http3-linux.yml index a844eb6c14..2979e9d7d1 100644 --- a/.github/workflows/http3-linux.yml +++ b/.github/workflows/http3-linux.yml @@ -189,7 +189,7 @@ jobs: if: ${{ steps.cache-openssl-http3-no-deprecated.outputs.cache-hit != 'true' }} run: | cd ~ - git clone --quiet --depth=1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl + git clone --quiet --depth 1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl cd openssl ./config --prefix="$PWD"/build --libdir=lib no-makedepend no-apps no-docs no-tests no-deprecated make @@ -232,7 +232,7 @@ jobs: if: ${{ steps.cache-gnutls.outputs.cache-hit != 'true' }} run: | cd ~ - git clone --quiet --depth=1 -b "${GNUTLS_VERSION}" https://github.com/gnutls/gnutls.git + git clone --quiet --depth 1 -b "${GNUTLS_VERSION}" https://github.com/gnutls/gnutls cd gnutls # required: nettle-dev libp11-kit-dev libev-dev autopoint bison gperf gtk-doc-tools libtasn1-bin ./bootstrap @@ -247,7 +247,7 @@ jobs: if: ${{ steps.cache-wolfssl.outputs.cache-hit != 'true' }} run: | cd ~ - git clone --quiet --depth=1 -b "v${WOLFSSL_VERSION}-stable" https://github.com/wolfSSL/wolfssl.git + git clone --quiet --depth 1 -b "v${WOLFSSL_VERSION}-stable" https://github.com/wolfSSL/wolfssl cd wolfssl ./autogen.sh ./configure --disable-dependency-tracking --enable-all --enable-quic \ @@ -259,9 +259,9 @@ jobs: if: ${{ steps.cache-nghttp3.outputs.cache-hit != 'true' }} run: | cd ~ - git clone --quiet --depth=1 -b "v${NGHTTP3_VERSION}" https://github.com/ngtcp2/nghttp3 + git clone --quiet --depth 1 -b "v${NGHTTP3_VERSION}" https://github.com/ngtcp2/nghttp3 cd nghttp3 - git submodule update --init --depth=1 + git submodule update --init --depth 1 autoreconf -fi ./configure --disable-dependency-tracking --prefix="$PWD"/build --enable-lib-only make @@ -272,7 +272,7 @@ jobs: # building twice to get crypto libs for ossl, libressl and awslc installed run: | cd ~ - git clone --quiet --depth=1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2 + git clone --quiet --depth 1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2 cd ngtcp2 autoreconf -fi ./configure --disable-dependency-tracking --prefix="$PWD"/build \ @@ -290,7 +290,7 @@ jobs: if: ${{ steps.cache-ngtcp2-boringssl.outputs.cache-hit != 'true' }} run: | cd ~ - git clone --quiet --depth=1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2 ngtcp2-boringssl + git clone --quiet --depth 1 -b "v${NGTCP2_VERSION}" https://github.com/ngtcp2/ngtcp2 ngtcp2-boringssl cd ngtcp2-boringssl autoreconf -fi ./configure --disable-dependency-tracking --prefix="$PWD"/build \ @@ -303,9 +303,9 @@ jobs: if: ${{ steps.cache-nghttp2.outputs.cache-hit != 'true' }} run: | cd ~ - git clone --quiet --depth=1 -b "v${NGHTTP2_VERSION}" https://github.com/nghttp2/nghttp2 + git clone --quiet --depth 1 -b "v${NGHTTP2_VERSION}" https://github.com/nghttp2/nghttp2 cd nghttp2 - git submodule update --init --depth=1 + git submodule update --init --depth 1 autoreconf -fi # required (for nghttpx application): libc-ares-dev libev-dev zlib1g-dev # optional (for nghttpx application): libbrotli-dev @@ -578,7 +578,7 @@ jobs: if: ${{ matrix.build.name == 'quiche' && steps.cache-quiche.outputs.cache-hit != 'true' }} run: | cd ~ - git clone --quiet --depth=1 -b "${QUICHE_VERSION}" --recursive https://github.com/cloudflare/quiche.git + git clone --quiet --depth 1 -b "${QUICHE_VERSION}" --recursive https://github.com/cloudflare/quiche cd quiche #### Work-around https://github.com/curl/curl/issues/7927 ####### #### See https://github.com/alexcrichton/cmake-rs/issues/131 #### diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 773e5b4e91..4cea194c76 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -329,10 +329,10 @@ jobs: install_steps: intel configure: CC=icc --enable-debug --with-openssl - - name: 'Slackware openssl gssapi gcc' - # These are essentially the same flags used to build the curl Slackware package + - name: 'Slackware !ssl gssapi gcc' + # Flags used to build the curl Slackware package, except OpenSSL 1.1.0: # https://ftpmirror.infania.net/slackware/slackware64-current/source/n/curl/curl.SlackBuild - configure: --enable-debug --with-openssl --with-libssh2 --with-gssapi --enable-ares --enable-static=no --without-ca-bundle --with-ca-path=/etc/ssl/certs + configure: --enable-debug --without-ssl --with-libssh2 --with-gssapi --enable-ares --enable-static=no --without-ca-bundle --with-ca-path=/etc/ssl/certs # Docker Hub image that `container-job` executes in container: 'andy5995/slackware-build-essential:15.0' @@ -439,6 +439,7 @@ jobs: cmake --install . - name: 'cache nghttp2 (filc)' + if: ${{ contains(matrix.build.install_steps, 'nghttp2-filc') }} uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 id: cache-nghttp2-filc env: @@ -579,7 +580,7 @@ jobs: - name: 'build openssl (thread sanitizer)' if: ${{ contains(matrix.build.install_steps, 'openssl-tsan') && steps.cache-openssl-tsan.outputs.cache-hit != 'true' }} run: | - git clone --quiet --depth=1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl + git clone --quiet --depth 1 -b "openssl-${OPENSSL_VERSION}" https://github.com/openssl/openssl cd openssl CC=clang CFLAGS='-fsanitize=thread' LDFLAGS='-fsanitize=thread' ./config --prefix=/home/runner/openssl --libdir=lib no-makedepend no-apps no-docs no-tests make diff --git a/CMake/CurlSymbolHiding.cmake b/CMake/CurlSymbolHiding.cmake index 217c8832c9..2576a1aff3 100644 --- a/CMake/CurlSymbolHiding.cmake +++ b/CMake/CurlSymbolHiding.cmake @@ -29,7 +29,7 @@ if(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG)) # e.g. curl_easy_perform_ev() or curl_dbg_*(), # so disable symbol hiding for debug builds and for memory tracking. set(CURL_HIDDEN_SYMBOLS OFF) -elseif(DOS OR AMIGA OR MINGW32CE) +elseif(DOS OR AMIGA) set(CURL_HIDDEN_SYMBOLS OFF) endif() diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index d46c878d46..e9a0d61c0e 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -232,20 +232,20 @@ if(PICKY_COMPILER) -Wcast-function-type-strict # clang 16.0 appleclang 16.0 ) endif() - if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.0) + if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.1) list(APPEND _picky_enable - -Warray-compare # clang 20.0 gcc 12.0 appleclang ? - -Wc++-hidden-decl # clang 21.0 appleclang ? - -Wno-implicit-void-ptr-cast # clang 21.0 appleclang ? - -Wtentative-definition-compat # clang 21.0 appleclang ? + -Warray-compare # clang 20.1 gcc 12.0 appleclang ? + -Wc++-hidden-decl # clang 21.1 appleclang ? + -Wno-implicit-void-ptr-cast # clang 21.1 appleclang ? + -Wtentative-definition-compat # clang 21.1 appleclang ? ) if(WIN32) list(APPEND _picky_enable - -Wno-c++-keyword # clang 21.0 appleclang ? # `wchar_t` triggers it on Windows + -Wno-c++-keyword # clang 21.1 appleclang ? # `wchar_t` triggers it on Windows ) else() list(APPEND _picky_enable - -Wc++-keyword # clang 21.0 appleclang ? + -Wc++-keyword # clang 21.1 appleclang ? ) endif() endif() diff --git a/CMake/win32-cache.cmake b/CMake/win32-cache.cmake index 8cb9b58b39..870acf80de 100644 --- a/CMake/win32-cache.cmake +++ b/CMake/win32-cache.cmake @@ -53,11 +53,7 @@ else() if(MSVC) set(HAVE_UNISTD_H 0) set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() - if(MSVC_VERSION GREATER_EQUAL 1600) - set(HAVE_STDINT_H 1) # detected by CMake internally in check_type_size() - else() - set(HAVE_STDINT_H 0) # detected by CMake internally in check_type_size() - endif() + set(HAVE_STDINT_H 1) # detected by CMake internally in check_type_size() if(MSVC_VERSION GREATER_EQUAL 1800) set(HAVE_STDBOOL_H 1) else() @@ -193,7 +189,7 @@ if(MINGW OR MSVC) curl_prefill_type_size("CURL_OFF_T" 8) curl_prefill_type_size("CURL_SOCKET_T" ${CMAKE_SIZEOF_VOID_P}) curl_prefill_type_size("SIZE_T" ${CMAKE_SIZEOF_VOID_P}) - # TIME_T: 8 for _WIN64 or UCRT or MSVC and not Windows CE, 4 otherwise + # TIME_T: 8 for _WIN64 or UCRT or MSVC, 4 otherwise # Also 4 for non-UCRT 32-bit when _USE_32BIT_TIME_T is set. # mingw-w64 sets _USE_32BIT_TIME_T unless __MINGW_USE_VC2005_COMPAT is explicit defined. if(MSVC) @@ -206,25 +202,3 @@ if(MINGW OR MSVC) curl_prefill_type_size("OFF_T" 8) # mingw-w64 v3+ endif() endif() - -# Windows CE exceptions - -if(WINCE) - set(HAVE_FREEADDRINFO 0) - set(HAVE_GETADDRINFO 0) - set(HAVE_LOCALE_H 0) - set(HAVE_SETLOCALE 0) - set(HAVE_SETMODE 0) - set(HAVE_SIGNAL 0) - set(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 0) - curl_prefill_type_size("CURL_SOCKET_T" 4) - curl_prefill_type_size("TIME_T" 4) - curl_prefill_type_size("SIZE_T" 4) - if(MINGW32CE) - set(HAVE_STRTOK_R 0) - set(HAVE__SETMODE 0) - set(HAVE_FILE_OFFSET_BITS 0) - curl_prefill_type_size("SSIZE_T" 4) - curl_prefill_type_size("OFF_T" 4) - endif() -endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 8113cdea90..30cb5f398e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,6 @@ # SPDX-License-Identifier: curl # ########################################################################### -# by Tetetest and Sukender (Benoit Neil) cmake_minimum_required(VERSION 3.7...3.16 FATAL_ERROR) message(STATUS "Using CMake version ${CMAKE_VERSION}") @@ -71,37 +70,6 @@ if(WINDOWS_STORE AND MINGW) # mingw UWP build # CMake (as of v3.31.2) gets confused and applies the MSVC rc.exe command-line # template to windres. Reset it to the windres template via 'Modules/Platform/Windows-windres.cmake': set(CMAKE_RC_COMPILE_OBJECT " -O coff ") -elseif(WIN32 AND WINCE AND CMAKE_C_COMPILER_ID STREQUAL "GNU") # mingw32ce build - if(NOT MINGW32CE_LIBRARY_DIR) - message(FATAL_ERROR "Set MINGW32CE_LIBRARY_DIR variable to the mingw32ce platform library directory.") - endif() - - set(MINGW 1) - set(MINGW32CE 1) - - # Build implib with libcurl DLL. Copied from CMake's 'Modules/Platform/Windows-GNU.cmake'. - set(CMAKE_C_CREATE_SHARED_LIBRARY " ") - string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " -o -Wl,--out-implib,") - string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " ${CMAKE_GNULD_IMAGE_VERSION} ") - - # Build resources. Copied from CMake's 'Modules/Platform/Windows-windres.cmake'. - set(CMAKE_RC_COMPILE_OBJECT " -O coff ") - enable_language(RC) - - # To compile long long integer literals - set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-std=gnu99") - string(APPEND CMAKE_REQUIRED_FLAGS " -std=gnu99") - - set(CMAKE_C_COMPILE_OPTIONS_PIC "") # CMake sets it to '-fPIC', confusing the toolchain and breaking builds. Zap it. - - set(CMAKE_STATIC_LIBRARY_PREFIX "lib") - set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") - set(CMAKE_SHARED_LIBRARY_PREFIX "lib") - set(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") - set(CMAKE_IMPORT_LIBRARY_PREFIX "lib") - set(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") - set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib") elseif(DOS AND CMAKE_C_COMPILER_ID STREQUAL "GNU") # DJGPP set(CMAKE_STATIC_LIBRARY_PREFIX "lib") set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") @@ -130,9 +98,6 @@ endif() if(WIN32) string(APPEND _target_flags " WIN32") endif() -if(WINCE) - string(APPEND _target_flags " WINCE") -endif() if(WINDOWS_STORE) string(APPEND _target_flags " UWP") endif() @@ -213,12 +178,12 @@ option(CURL_DISABLE_INSTALL "Disable installation targets" OFF) if(WIN32) option(ENABLE_UNICODE "Use the Unicode version of the Windows API functions" OFF) - if(WINDOWS_STORE OR WINCE) + if(WINDOWS_STORE) set(ENABLE_UNICODE ON) endif() if(ENABLE_UNICODE) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "UNICODE" "_UNICODE") - if(MINGW AND NOT MINGW32CE) + if(MINGW) set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "-municode") endif() endif() @@ -538,7 +503,7 @@ if(HTTP_ONLY) set(CURL_DISABLE_TFTP ON) endif() -if(WINDOWS_STORE OR WINCE) +if(WINDOWS_STORE) set(CURL_DISABLE_TELNET ON) # telnet code needs fixing to compile for UWP. endif() @@ -624,21 +589,7 @@ if(ENABLE_THREADED_RESOLVER) endif() # Check for all needed libraries -if(WIN32) - if(WINCE) - set(_win32_winsock "ws2") - else() - set(_win32_winsock "ws2_32") - endif() - set(_win32_crypt32 "crypt32") - set(_win32_secur32 "secur32") - - if(MINGW32CE) # FIXME upstream: must specify the full path to avoid CMake converting "ws2" to "ws2.lib" - set(_win32_winsock "${MINGW32CE_LIBRARY_DIR}/lib${_win32_winsock}.a") - set(_win32_crypt32 "${MINGW32CE_LIBRARY_DIR}/lib${_win32_crypt32}.a") - set(_win32_secur32 "${MINGW32CE_LIBRARY_DIR}/lib${_win32_secur32}.a") - endif() -elseif(DOS) +if(DOS) if(WATT_ROOT) set(USE_WATT32 ON) # FIXME upstream: must specify the full path to avoid CMake converting "watt" to "watt.lib" @@ -659,7 +610,7 @@ elseif(AMIGA) set(CURL_USE_OPENSSL ON) set(CURL_CA_FALLBACK ON CACHE BOOL "") endif() -elseif(NOT APPLE) +elseif(NOT WIN32 AND NOT APPLE) check_library_exists("socket" "connect" "" HAVE_LIBSOCKET) if(HAVE_LIBSOCKET) set(CURL_NETWORK_AND_TIME_LIBS "socket" ${CURL_NETWORK_AND_TIME_LIBS}) @@ -694,7 +645,7 @@ if(ENABLE_IPV6) endif() endif() endif() -if(ENABLE_IPV6 AND NOT WINCE) +if(ENABLE_IPV6) set(USE_IPV6 ON) endif() @@ -1035,7 +986,7 @@ macro(curl_openssl_check_exists) if(HAVE_LIBZ) list(APPEND CMAKE_REQUIRED_LIBRARIES ZLIB::ZLIB) endif() - if(WIN32 AND NOT WINCE) + if(WIN32) list(APPEND CMAKE_REQUIRED_LIBRARIES "bcrypt") # for OpenSSL/LibreSSL endif() endif() @@ -1049,7 +1000,7 @@ macro(curl_openssl_check_exists) list(APPEND CMAKE_REQUIRED_DEFINITIONS "-DHAVE_UINTPTR_T") # to pull in stdint.h (as of wolfSSL v5.5.4) endif() if(WIN32) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${_win32_winsock}" "${_win32_crypt32}") # for OpenSSL/wolfSSL + list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32" "crypt32") # for OpenSSL/wolfSSL endif() if(${ARGC} EQUAL 2) check_function_exists(${ARGN}) @@ -1262,7 +1213,7 @@ if(NOT CURL_DISABLE_SRP AND (HAVE_GNUTLS_SRP OR HAVE_OPENSSL_SRP)) endif() if(NOT CURL_DISABLE_LDAP) - if(WIN32 AND NOT WINDOWS_STORE AND NOT WINCE) + if(WIN32 AND NOT WINDOWS_STORE) option(USE_WIN32_LDAP "Use Windows LDAP implementation" ON) if(USE_WIN32_LDAP) list(APPEND CURL_LIBS "wldap32") @@ -1501,7 +1452,7 @@ if(USE_LIBRTMP) endif() option(ENABLE_UNIX_SOCKETS "Enable Unix domain sockets support" ON) -if(ENABLE_UNIX_SOCKETS AND NOT WINCE) +if(ENABLE_UNIX_SOCKETS) if(WIN32 OR DOS) set(USE_UNIX_SOCKETS 1) else() @@ -1618,7 +1569,7 @@ if(WIN32) list(APPEND CURL_INCLUDES "winsock2.h") list(APPEND CURL_INCLUDES "ws2tcpip.h") - if(HAVE_WIN32_WINNT AND HAVE_WIN32_WINNT LESS 0x0501 AND NOT WINCE) + if(HAVE_WIN32_WINNT AND HAVE_WIN32_WINNT LESS 0x0501) # Windows XP is required for freeaddrinfo, getaddrinfo message(FATAL_ERROR "Building for Windows XP or newer is required.") endif() @@ -1626,7 +1577,7 @@ if(WIN32) # Pre-fill detection results based on target OS version if(_CURL_PREFILL) if(NOT HAVE_WIN32_WINNT OR HAVE_WIN32_WINNT LESS 0x0600 OR # older than Windows Vista - WINCE OR WINDOWS_STORE) + WINDOWS_STORE) set(HAVE_IF_NAMETOINDEX 0) unset(HAVE_IF_NAMETOINDEX CACHE) elseif(MSVC OR MINGW) @@ -1734,8 +1685,8 @@ endif() # Apply to all feature checks if(WIN32) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${_win32_winsock}") - if(NOT WINCE AND NOT WINDOWS_STORE) + list(APPEND CMAKE_REQUIRED_LIBRARIES "ws2_32") + if(NOT WINDOWS_STORE) list(APPEND CMAKE_REQUIRED_LIBRARIES "iphlpapi") endif() elseif(HAVE_LIBSOCKET) @@ -1789,9 +1740,9 @@ check_function_exists("eventfd" HAVE_EVENTFD) check_symbol_exists("ftruncate" "unistd.h" HAVE_FTRUNCATE) check_symbol_exists("getpeername" "${CURL_INCLUDES}" HAVE_GETPEERNAME) # winsock2.h unistd.h proto/bsdsocket.h check_symbol_exists("getsockname" "${CURL_INCLUDES}" HAVE_GETSOCKNAME) # winsock2.h unistd.h proto/bsdsocket.h -check_function_exists("getrlimit" HAVE_GETRLIMIT) -check_function_exists("setlocale" HAVE_SETLOCALE) -check_function_exists("setrlimit" HAVE_SETRLIMIT) +check_function_exists("getrlimit" HAVE_GETRLIMIT) +check_function_exists("setlocale" HAVE_SETLOCALE) +check_function_exists("setrlimit" HAVE_SETRLIMIT) if(WIN32) # include wincrypt.h as a workaround for mingw-w64 __MINGW64_VERSION_MAJOR <= 5 header bug */ @@ -1800,16 +1751,14 @@ else() check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # net/if.h check_function_exists("realpath" HAVE_REALPATH) check_function_exists("sched_yield" HAVE_SCHED_YIELD) - check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP) - check_symbol_exists("stricmp" "string.h" HAVE_STRICMP) - check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI) + check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP) + check_symbol_exists("stricmp" "string.h" HAVE_STRICMP) + check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI) endif() -if(NOT MINGW32CE) # Avoid false detections - check_function_exists("setmode" HAVE_SETMODE) - if(WIN32 OR CYGWIN) - check_function_exists("_setmode" HAVE__SETMODE) - endif() +check_function_exists("setmode" HAVE_SETMODE) +if(WIN32 OR CYGWIN) + check_function_exists("_setmode" HAVE__SETMODE) endif() if(AMIGA) @@ -1971,17 +1920,13 @@ include(CMake/OtherTests.cmake) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "HAVE_CONFIG_H") if(WIN32) - list(APPEND CURL_NETWORK_AND_TIME_LIBS "${_win32_winsock}") - if(NOT WINCE AND NOT WINDOWS_STORE) + list(APPEND CURL_NETWORK_AND_TIME_LIBS "ws2_32") + if(NOT WINDOWS_STORE) list(APPEND CURL_NETWORK_AND_TIME_LIBS "iphlpapi") endif() - if(NOT WINCE) - list(APPEND CURL_LIBS "bcrypt") - endif() + list(APPEND CURL_LIBS "bcrypt") - if(NOT WINCE) - set(USE_WIN32_LARGE_FILES ON) - endif() + set(USE_WIN32_LARGE_FILES ON) # We use crypto functions that are not available for UWP apps if(NOT WINDOWS_STORE) @@ -1990,13 +1935,10 @@ if(WIN32) # Link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL if(USE_WIN32_CRYPTO OR USE_SCHANNEL) - if(NOT WINCE) - list(APPEND CURL_LIBS "advapi32") - endif() - list(APPEND CURL_LIBS "${_win32_crypt32}") + list(APPEND CURL_LIBS "advapi32" "crypt32") endif() if(USE_WINDOWS_SSPI) - list(APPEND CURL_LIBS "${_win32_secur32}") + list(APPEND CURL_LIBS "secur32") endif() endif() @@ -2209,8 +2151,7 @@ message(STATUS "Features: ${SUPPORT_FEATURES}") # Clear list and collect SSL backends set(_items "") curl_add_if("Schannel" _ssl_enabled AND USE_SCHANNEL) -curl_add_if("${_openssl}" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_LESS 3.0.0) -curl_add_if("${_openssl} v3+" _ssl_enabled AND USE_OPENSSL AND OPENSSL_VERSION VERSION_GREATER_EQUAL 3.0.0) +curl_add_if("${_openssl}" _ssl_enabled AND USE_OPENSSL) curl_add_if("mbedTLS" _ssl_enabled AND USE_MBEDTLS) curl_add_if("wolfSSL" _ssl_enabled AND USE_WOLFSSL) curl_add_if("GnuTLS" _ssl_enabled AND USE_GNUTLS) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 64d4988060..e24762bafd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -4,10 +4,13 @@ curl and libcurl 8.18.0 Command line options: 273 curl_easy_setopt() options: 308 Public functions in libcurl: 100 - Contributors: 3537 + Contributors: 3541 This release includes the following changes: + o build: drop support for VS2008 (Windows) [62] + o build: drop Windows CE / CeGCC support [69] + o openssl: bump minimum OpenSSL version to 3.0.0 [60] This release includes the following bugfixes: @@ -16,12 +19,19 @@ This release includes the following bugfixes: o autotools: drop autoconf <2.59 compatibility code (zz60-xc-ovr) [70] o ccsidcurl: make curl_mime_data_ccsid() use the converted size [74] o cf-https-connect: allocate ctx at first in cf_hc_create() [79] + o cf-socket: trace ignored errors [97] o checksrc.pl: detect assign followed by more than one space [26] o cmake: adjust defaults for target platforms not supporting shared libs [35] o cmake: disable `CURL_CA_PATH` auto-detection if `USE_APPLE_SECTRUST=ON` [16] + o code: minor indent fixes before closing braces [107] + o config2setopts: bail out if curl_url_get() returns OOM [102] + o config2setopts: exit if curl_url_set() fails on OOM [105] o conncache: silence `-Wnull-dereference` on gcc 14 RISC-V 64 [17] + o connect: reshuffle Curl_timeleft_ms to avoid 'redundant condition' [100] + o cookie: propagate errors better, cleanup the internal API [118] o cshutdn: acknowledge FD_SETSIZE for shutdown descriptors [25] o curl: fix progress meter in parallel mode [15] + o curl_setup.h: drop stray `#undef stat` (Windows) [103] o CURLINFO: remove 'get' and 'get the' from each short desc [50] o CURLINFO_SCHEME/PROTOCOL: they return the "scheme" for a "transfer" [48] o CURLINFO_TLS_SSL_PTR.md: remove CURLINFO_TLS_SESSION text [49] @@ -31,8 +41,10 @@ This release includes the following bugfixes: o docs: fix checksrc `EQUALSPACE` warnings [21] o docs: mention umask need when curl creates files [56] o examples/crawler: fix variable [92] + o examples/multithread: fix race condition [101] o ftp: refactor a piece of code by merging the repeated part [40] o ftp: remove #ifdef for define that is always defined [76] + o getinfo: improve perf in debug mode [99] o gnutls: report accurate error when TLS-SRP is not built-in [18] o gtls: add return checks and optimize the code [2] o gtls: skip session resumption when verifystatus is set @@ -41,12 +53,16 @@ This release includes the following bugfixes: o INSTALL-CMAKE.md: document static option defaults more [37] o krb5_sspi: unify a part of error handling [80] o lib: cleanup for some typos about spaces and code style [3] + o lib: eliminate size_t casts [112] o lib: fix gssapi.h include on IBMi [55] o lib: refactor the type of funcs which have useless return and checks [1] + o libtests: replace `atoi()` with `curlx_str_number()` [120] o libssh2: cleanup ssh_force_knownhost_key_type [64] o libssh2: replace atoi() in ssh_force_knownhost_key_type [63] + o limit-rate: add example using --limit-rate and --max-time together [89] o m4/sectrust: fix test(1) operator [4] o mbedtls: fix potential use of uninitialized `nread` [8] + o mk-ca-bundle.pl: default to SHA256 fingerprints with `-t` option [73] o mk-ca-bundle.pl: use `open()` with argument list to replace backticks [71] o mqtt: reject overly big messages [39] o noproxy: replace atoi with curlx_str_number [67] @@ -59,8 +75,12 @@ This release includes the following bugfixes: o pytest: skip H2 tests if feature missing from curl [46] o rtmp: fix double-free on URL parse errors [27] o rtmp: precaution for a potential integer truncation [54] + o runtests: detect bad libssh differently for test 1459 [11] + o runtests: drop Python 2 support remains [45] o rustls: fix a potential memory issue [81] + o rustls: minor adjustment of sizeof() [38] o schannel: fix memory leak of cert_store_path on four error paths [23] + o schannel: replace atoi() with curlx_str_number() [119] o scripts: fix shellcheck SC2046 warnings [90] o scripts: use end-of-options marker in `find -exec` commands [87] o setopt: disable CURLOPT_HAPROXY_CLIENT_IP on NULL [30] @@ -68,25 +88,32 @@ This release includes the following bugfixes: o sftp: fix range downloads in both SSH backends [82] o socks_sspi: use free() not FreeContextBuffer() [93] o telnet: replace atoi for BINARY handling with curlx_str_number [66] + o test07_22: fix flakiness [95] o test2045: replace HTML multi-line comment markup with `#` comments [36] o test363: delete stray character (typo) from a section tag [52] o tests/data: replace hard-coded test numbers with `%TESTNUMBER` [33] o tests/data: support using native newlines on disk, drop `.gitattributes` [91] o tests/server: do not fall back to original data file in `test2fopen()` [32] + o tests/server: replace `atoi()` and `atol()` with `curlx_str_number()` [110] o tftp: release filename if conn_get_remote_addr fails [42] o tool: consider (some) curl_easy_setopt errors fatal [7] o tool_help: add checks to avoid unsigned wrap around [14] o tool_ipfs: check return codes better [20] + o tool_operate: exit on curl_share_setopt errors [108] o tool_operate: remove redundant condition [19] o tool_operate: use curlx_str_number instead of atoi [68] o tool_paramhlp: refuse --proto remove all protocols [10] o urlapi: fix mem-leaks in curl_url_get error paths [22] o verify-release: update to avoid shellcheck warning SC2034 [88] + o vquic-tls/gnutls: call Curl_gtls_verifyserver unconditionally [96] o vtls: fix CURLOPT_CAPATH use [51] o vtls: handle possible malicious certs_num from peer [53] + o vtls: pinned key check [98] o wcurl: import v2025.11.09 [29] o wolfSSL: able to differentiate between IP and DNS in alt names [13] o wolfssl: avoid NULL dereference in OOM situation [77] + o wolfssl: fix a potential memory leak of session [6] + o wolfssl: simplify wssl_send_earlydata [111] This release includes the following known bugs: @@ -98,24 +125,22 @@ For all changes ever done in curl: Planned upcoming removals include: - o Builds using VS2008 - o OpenSSL 1.x support o OpenSSL-QUIC o Support for c-ares versions before 1.16.0 o Support for Windows XP/2003 - o Windows CE support See https://curl.se/dev/deprecate.html This release would not have looked like this without help, code, reports and advice from friends like these: - Andrew Kirillov, Brad King, Dan Fandrich, Daniel Stenberg, - Fd929c2CE5fA on github, Gisle Vanem, Jiyong Yang, Juliusz Sosinowicz, - Leonardo Taccari, Patrick Monnerat, Ray Satiro, renovate[bot], + Aleksandr Sergeev, Andrew Kirillov, Brad King, Dan Fandrich, Daniel McCarney, + Daniel Stenberg, Fd929c2CE5fA on github, Gisle Vanem, Jiyong Yang, + Juliusz Sosinowicz, Leonardo Taccari, nait-furry, Nick Korepanov, + Patrick Monnerat, pelioro on hackerone, Ray Satiro, renovate[bot], Samuel Henrique, Stanislav Fort, Stefan Eissing, Thomas Klausner, Viktor Szakats, Xiaoke Wang - (18 contributors) + (23 contributors) References to bug reports and discussions on issues: @@ -124,10 +149,12 @@ References to bug reports and discussions on issues: [3] = https://curl.se/bug/?i=19370 [4] = https://curl.se/bug/?i=19371 [5] = https://curl.se/bug/?i=19394 + [6] = https://curl.se/bug/?i=19555 [7] = https://curl.se/bug/?i=19385 [8] = https://curl.se/bug/?i=19393 [9] = https://curl.se/bug/?i=19389 [10] = https://curl.se/bug/?i=19388 + [11] = https://curl.se/bug/?i=19557 [12] = https://curl.se/bug/?i=19426 [13] = https://curl.se/bug/?i=19364 [14] = https://curl.se/bug/?i=19377 @@ -152,11 +179,13 @@ References to bug reports and discussions on issues: [35] = https://curl.se/bug/?i=19420 [36] = https://curl.se/bug/?i=19498 [37] = https://curl.se/bug/?i=19419 + [38] = https://hackerone.com/reports/3427460 [39] = https://curl.se/bug/?i=19415 [40] = https://curl.se/bug/?i=19411 [41] = https://curl.se/bug/?i=19410 [42] = https://curl.se/bug/?i=19409 [43] = https://curl.se/bug/?i=19405 + [45] = https://curl.se/bug/?i=19544 [46] = https://curl.se/bug/?i=19412 [47] = https://curl.se/bug/?i=19402 [48] = https://curl.se/bug/?i=19403 @@ -168,15 +197,19 @@ References to bug reports and discussions on issues: [54] = https://curl.se/bug/?i=19399 [55] = https://curl.se/bug/?i=19336 [56] = https://curl.se/bug/?i=19396 + [60] = https://curl.se/bug/?i=18330 [61] = https://curl.se/bug/?i=19484 + [62] = https://curl.se/bug/?i=17931 [63] = https://curl.se/bug/?i=19479 [64] = https://curl.se/bug/?i=19479 [65] = https://curl.se/bug/?i=19478 [66] = https://curl.se/bug/?i=19477 [67] = https://curl.se/bug/?i=19475 [68] = https://curl.se/bug/?i=19480 + [69] = https://curl.se/bug/?i=17927 [70] = https://curl.se/bug/?i=19464 [71] = https://curl.se/bug/?i=19461 + [73] = https://curl.se/bug/?i=19359 [74] = https://curl.se/bug/?i=19465 [76] = https://curl.se/bug/?i=19463 [77] = https://curl.se/bug/?i=19459 @@ -188,8 +221,27 @@ References to bug reports and discussions on issues: [86] = https://curl.se/bug/?i=19451 [87] = https://curl.se/bug/?i=19450 [88] = https://curl.se/bug/?i=19449 + [89] = https://curl.se/bug/?i=19473 [90] = https://curl.se/bug/?i=19432 [91] = https://curl.se/bug/?i=19398 [92] = https://curl.se/bug/?i=19446 [93] = https://curl.se/bug/?i=19445 [94] = https://curl.se/bug/?i=19444 + [95] = https://curl.se/bug/?i=19530 + [96] = https://curl.se/bug/?i=19531 + [97] = https://curl.se/bug/?i=19520 + [98] = https://curl.se/bug/?i=19529 + [99] = https://curl.se/bug/?i=19525 + [100] = https://curl.se/bug/?i=19523 + [101] = https://curl.se/bug/?i=19524 + [102] = https://curl.se/bug/?i=19518 + [103] = https://curl.se/bug/?i=19519 + [105] = https://curl.se/bug/?i=19517 + [107] = https://curl.se/bug/?i=19512 + [108] = https://curl.se/bug/?i=19513 + [110] = https://curl.se/bug/?i=19510 + [111] = https://curl.se/bug/?i=19509 + [112] = https://curl.se/bug/?i=19495 + [118] = https://curl.se/bug/?i=19493 + [119] = https://curl.se/bug/?i=19483 + [120] = https://curl.se/bug/?i=19506 diff --git a/acinclude.m4 b/acinclude.m4 index 517de0c4a6..7038f32a8b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1315,13 +1315,8 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [ AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl if test "$curl_cv_native_windows" = 'yes'; then AC_MSG_CHECKING([whether build target supports Win32 large files]) - if test "$curl_cv_wince" = 'yes'; then - dnl Windows CE does not support large files - curl_win32_has_largefile='no' - else - dnl All mingw-w64 versions support large files - curl_win32_has_largefile='yes' - fi + dnl All mingw-w64 versions support large files + curl_win32_has_largefile='yes' case "$curl_win32_has_largefile" in yes) if test x"$enable_largefile" = 'xno'; then @@ -1478,9 +1473,6 @@ AC_DEFUN([CURL_PREPARE_BUILDINFO], [ if test "$curl_cv_native_windows" = 'yes'; then curl_pflags="${curl_pflags} WIN32" fi - if test "$curl_cv_wince" = 'yes'; then - curl_pflags="${curl_pflags} WINCE" - fi if test "$curl_cv_winuwp" = 'yes'; then curl_pflags="${curl_pflags} UWP" fi diff --git a/appveyor.sh b/appveyor.sh index 81407f7f33..b20838da42 100644 --- a/appveyor.sh +++ b/appveyor.sh @@ -35,12 +35,11 @@ esac if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then openssl_root_win="C:/OpenSSL-v35${openssl_suffix}" + openssl_root="$(cygpath "${openssl_root_win}")" elif [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2019' ]; then openssl_root_win="C:/OpenSSL-v30${openssl_suffix}" -else - openssl_root_win="C:/OpenSSL-v111${openssl_suffix}" + openssl_root="$(cygpath "${openssl_root_win}")" fi -openssl_root="$(cygpath "${openssl_root_win}")" if [ "${BUILD_SYSTEM}" = 'CMake' ]; then # Set env CHKPREFILL to the value '_chkprefill' to compare feature detection @@ -76,7 +75,7 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then -DCURL_USE_OPENSSL="${OPENSSL}" \ -DCURL_USE_LIBPSL=OFF \ ${options} \ - || { cat ${root}/_bld/CMakeFiles/CMake* 2>/dev/null; false; } + || { cat "${root}"/_bld/CMakeFiles/CMake* 2>/dev/null; false; } [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ] && cd .. done if [ -d _bld_chkprefill ] && ! diff -u _bld/lib/curl_config.h _bld_chkprefill/lib/curl_config.h; then @@ -93,9 +92,11 @@ elif [ "${BUILD_SYSTEM}" = 'VisualStudioSolution' ]; then ( cd projects ./generate.bat "${VC_VERSION}" - msbuild.exe -maxcpucount "-property:Configuration=${PRJ_CFG}" "Windows/${VC_VERSION}/curl-all.sln" + msbuild.exe -maxcpucount "-property:Configuration=${PRJ_CFG}" "-property:Platform=${PLAT}" "Windows/${VC_VERSION}/curl-all.sln" ) - curl="build/Win32/${VC_VERSION}/${PRJ_CFG}/curld.exe" + [ "${PLAT}" = 'x64' ] && platdir='Win64' || platdir='Win32' + [[ "${PRJ_CFG}" = *'Debug'* ]] && binsuffix='d' || binsuffix='' + curl="build/${platdir}/${VC_VERSION}/${PRJ_CFG}/curl${binsuffix}.exe" fi find . \( -name '*.exe' -o -name '*.dll' -o -name '*.lib' -o -name '*.pdb' \) -exec file -- '{}' \; diff --git a/appveyor.yml b/appveyor.yml index 98e6e51609..d10f8d3961 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -70,35 +70,34 @@ environment: SCHANNEL: 'ON' SHARED: 'ON' EXAMPLES: 'ON' - - job_name: 'CM VS2012, Release, x86, OpenSSL 1.1.1 + Schannel, Shared, Build-tests' + - job_name: 'CM VS2012, Release, x86, Schannel, Shared, Build-tests' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' PRJ_GEN: 'Visual Studio 11 2012' TARGET: '-A Win32' PRJ_CFG: Release - OPENSSL: 'ON' SCHANNEL: 'ON' SHARED: 'ON' - - job_name: 'CM VS2013, Debug, x64, OpenSSL 1.1.1, Shared, Build-only' + - job_name: 'CM VS2013, Debug, x64, Schannel, Shared, Build-only' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' PRJ_GEN: 'Visual Studio 12 2013' TARGET: '-A x64' PRJ_CFG: Debug - OPENSSL: 'ON' + SCHANNEL: 'ON' SHARED: 'ON' TFLAGS: 'skipall' - - job_name: 'CM VS2015, Debug, x64, OpenSSL 1.1.1, Static, Build-only' + - job_name: 'CM VS2015, Debug, x64, Schannel, Static, Build-only' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' PRJ_GEN: 'Visual Studio 14 2015' TARGET: '-A x64' PRJ_CFG: Debug - OPENSSL: 'ON' + SCHANNEL: 'ON' TFLAGS: 'skipall' - - job_name: 'CM VS2017, Debug, x64, OpenSSL 1.1.1, Shared, Build-only' + - job_name: 'CM VS2017, Debug, x64, Schannel, Shared, Build-only' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' PRJ_GEN: 'Visual Studio 15 2017' TARGET: '-A x64' PRJ_CFG: Debug - OPENSSL: 'ON' + SCHANNEL: 'ON' SHARED: 'ON' TFLAGS: 'skipall' - job_name: 'CM VS2019, Debug, x64, OpenSSL 3.0 + Schannel, Shared, Build-tests' @@ -149,10 +148,17 @@ environment: # generated VisualStudioSolution-based builds - - job_name: 'VisualStudioSolution VS2013, Debug, x86, Schannel, Build-only' + - job_name: 'VisualStudioSolution VS2010, Release, x86, Schannel, Build-only' + APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2013' + BUILD_SYSTEM: VisualStudioSolution + PRJ_CFG: 'DLL Release - DLL Windows SSPI - DLL WinIDN' + PLAT: 'Win32' + VC_VERSION: VC10 + - job_name: 'VisualStudioSolution VS2013, Debug, x64, Schannel, Build-only' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' BUILD_SYSTEM: VisualStudioSolution PRJ_CFG: 'DLL Debug - DLL Windows SSPI - DLL WinIDN' + PLAT: 'x64' VC_VERSION: VC12 install: diff --git a/configure.ac b/configure.ac index e493369b9d..9602be344f 100644 --- a/configure.ac +++ b/configure.ac @@ -529,12 +529,8 @@ dnl for --enable-code-coverage CURL_COVERAGE CURL_CHECK_NATIVE_WINDOWS -curl_cv_wince='no' curl_cv_winuwp='no' if test "$curl_cv_native_windows" = "yes"; then - case $host_os in - mingw32ce*) curl_cv_wince='yes';; - esac case "$CPPFLAGS" in *-DWINSTORECOMPAT*) curl_cv_winuwp='yes';; esac @@ -896,7 +892,7 @@ AS_HELP_STRING([--disable-telnet],[Disable TELNET support]), AC_MSG_RESULT(yes) ) -if test "$curl_cv_winuwp" = 'yes' -o "$curl_cv_wince" = 'yes'; then +if test "$curl_cv_winuwp" = 'yes'; then AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET]) CURL_DISABLE_TELNET=1 fi @@ -1177,37 +1173,6 @@ if test "$HAVE_GETHOSTBYNAME" != "1"; then ]) fi -if test "$HAVE_GETHOSTBYNAME" != "1"; then - if test "$curl_cv_wince" = 'yes'; then - dnl This is for Windows CE systems - winsock_LIB="-lws2" - if test ! -z "$winsock_LIB"; then - my_ac_save_LIBS=$LIBS - LIBS="$winsock_LIB $LIBS" - AC_MSG_CHECKING([for gethostbyname in $winsock_LIB]) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ - #ifdef _WIN32 - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - #include - #endif - ]],[[ - gethostbyname("localhost"); - ]]) - ],[ - AC_MSG_RESULT([yes]) - HAVE_GETHOSTBYNAME="1" - ],[ - AC_MSG_RESULT([no]) - winsock_LIB="" - LIBS=$my_ac_save_LIBS - ]) - fi - fi -fi - # In UWP mode gethostbyname gets detected via the core libs, but some # code (in6addr_any) still need ws2_32, so let us detect and add it. if test "$HAVE_GETHOSTBYNAME" != "1" -o "$curl_cv_winuwp" = "yes"; then @@ -1693,10 +1658,6 @@ AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]), ) ) -if test "$curl_cv_wince" = 'yes'; then - ipv6=no -fi - if test "$ipv6" = yes; then curl_ipv6_msg="enabled" AC_DEFINE(USE_IPV6, 1, [Define if you want to enable IPv6 support]) @@ -1998,14 +1959,11 @@ CURL_WITH_APPLE_SECTRUST dnl link required libraries for USE_WIN32_CRYPTO or SCHANNEL_ENABLED if test "x$USE_WIN32_CRYPTO" = "x1" -o "x$SCHANNEL_ENABLED" = "x1"; then - LIBS="-lcrypt32 $LIBS" - if test "$curl_cv_wince" = 'no'; then - LIBS="-ladvapi32 $LIBS" - fi + LIBS="-ladvapi32 -lcrypt32 $LIBS" fi dnl link bcrypt for BCryptGenRandom() (used when building for Vista or newer) -if test "x$curl_cv_native_windows" = "xyes" -a "$curl_cv_wince" = 'no'; then +if test "x$curl_cv_native_windows" = "xyes"; then LIBS="-lbcrypt $LIBS" fi @@ -2750,11 +2708,7 @@ dnl ---------------------------- dnl check Windows Unicode option dnl ---------------------------- -if test "$curl_cv_wince" = 'yes'; then - want_winuni="yes" -else - want_winuni="no" -fi +want_winuni="no" if test "$curl_cv_native_windows" = "yes"; then if test "$curl_cv_winuwp" = 'yes'; then want_winuni="yes" @@ -4266,11 +4220,9 @@ else CURL_CHECK_FUNC_STRICMP fi -if test "$curl_cv_wince" = 'no'; then - AC_CHECK_FUNCS([setmode]) - if test "$curl_cv_native_windows" = 'yes' -o "$curl_cv_cygwin" = 'yes'; then - AC_CHECK_FUNCS([_setmode]) - fi +AC_CHECK_FUNCS([setmode]) +if test "$curl_cv_native_windows" = 'yes' -o "$curl_cv_cygwin" = 'yes'; then + AC_CHECK_FUNCS([_setmode]) fi if test -z "$ssl_backends"; then @@ -4639,7 +4591,7 @@ AS_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]), want_unix_sockets=auto ] ) -if test "x$want_unix_sockets" != "xno" -a "$curl_cv_wince" = 'no'; then +if test "x$want_unix_sockets" != "xno"; then if test "x$curl_cv_native_windows" = "xyes"; then USE_UNIX_SOCKETS=1 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets]) diff --git a/docs/BINDINGS.md b/docs/BINDINGS.md index 9ddbde5c42..065126efd7 100644 --- a/docs/BINDINGS.md +++ b/docs/BINDINGS.md @@ -61,7 +61,7 @@ Go: [go-curl](https://github.com/andelf/go-curl) by ShuYu Wang [Haskell](https://hackage.haskell.org/package/curl) Written by Galois, Inc -[Hollywood](https://web.archive.org/web/20250116185836/https://www.hollywood-mal.com/download.html) hURL by Andreas Falkenhahn +[Hollywood](https://web.archive.org/web/20250116185836/www.hollywood-mal.com/download.html) hURL by Andreas Falkenhahn [Java](https://github.com/covers1624/curl4j) diff --git a/docs/DEPRECATE.md b/docs/DEPRECATE.md index 43c94875b1..1629af1fff 100644 --- a/docs/DEPRECATE.md +++ b/docs/DEPRECATE.md @@ -12,24 +12,6 @@ email the as soon as possible and explain to us why this is a problem for you and how your use case cannot be satisfied properly using a workaround. -## Windows CE - -Windows CE "mainstream support" ended on October 9, 2018, and "Extended -Support" ended on October 10, 2023. - -curl drops all support in November 2025. - -## VS2008 - -curl drops support for getting built with Microsoft Visual Studio 2008 in -November 2025. - -The only reason we kept support for this version is for Windows CE - and we -intend to remove support for that Operating System in this time frame as well. -Bumping the minimum to VS2010. VS2008 is a pain to support. - -Previous discussion and details: https://github.com/curl/curl/discussions/15972 - ## Windows XP In January 2026, curl drops support for Windows XP and Server 2003. Their @@ -41,20 +23,6 @@ Making the new minimum target Windows version Vista / Server 2008. In March 2026, we drop support for all c-ares versions before 1.16.0. -## OpenSSL 1.0.2 - -OpenSSL and others only ship fixes for this version to paying customers, -meaning users of the free version risk being vulnerable. - -We remove support for this OpenSSL version from curl in December 2025. - -## OpenSSL 1.1.1 - -OpenSSL and others only ship fixes to paying customers, meaning users of the -free version risk being vulnerable. - -We remove support for this OpenSSL version from curl in December 2025. - ## OpenSSL-QUIC OpenSSL-QUIC is what we call the curl QUIC backend that uses the OpenSSL QUIC @@ -70,6 +38,18 @@ stack. We remove the OpenSSL-QUIC backend in March 2026. +## RTMP + +RTMP in curl is powered by the 3rd party library librtmp. + + - RTMP is barely used by curl users (2.2% in the 2025 survey) + - librtmp has no test cases, makes no proper releases and has not had a single + commit within the last year + - librtmp parses the URL itself and requires non-compliant URLs for this + - we have no RTMP tests + +Support for RTMP in libcurl gets removed in April 2026. + ## Past removals - axTLS (removed in 7.63.0) @@ -88,3 +68,6 @@ We remove the OpenSSL-QUIC backend in March 2026. - BearSSL (removed in 8.15.0) - msh3 (removed in 8.16.0) - winbuild build system (removed in 8.17.0) + - Windows CE (removed in 8.18.0) + - Support for Visual Studio 2008 (removed in 8.18.0) + - OpenSSL 1.1.1 and older (removed in 8.18.0) diff --git a/docs/HTTP3.md b/docs/HTTP3.md index b3ddcbaaf8..def30798ec 100644 --- a/docs/HTTP3.md +++ b/docs/HTTP3.md @@ -54,7 +54,7 @@ versions do not work. Build OpenSSL (version 3.5.0 or newer): - % git clone --quiet --depth=1 -b openssl-$OPENSSL_VERSION https://github.com/openssl/openssl + % git clone --depth 1 -b openssl-$OPENSSL_VERSION https://github.com/openssl/openssl % cd openssl % ./config --prefix= --libdir=lib % make diff --git a/docs/INSTALL.md b/docs/INSTALL.md index dfbc1eebfd..f3db34da28 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -200,7 +200,7 @@ Building for Windows XP is required as a minimum. You can build curl with: -- Microsoft Visual Studio 2008 v9.0 or later (`_MSC_VER >= 1500`) +- Microsoft Visual Studio 2010 v10.0 or later (`_MSC_VER >= 1600`) - MinGW-w64 3.0 or later (`__MINGW64_VERSION_MAJOR >= 3`) ## Building Windows DLLs and C runtime (CRT) linkage issues @@ -650,7 +650,7 @@ This is a probably incomplete list of known CPU architectures and operating systems that curl has been compiled for. If you know a system curl compiles and runs on, that is not listed, please let us know. -## 109 Operating Systems +## 108 Operating Systems AIX, AmigaOS, Android, ArcaOS, Aros, Atari FreeMiNT, Azure Sphere, BeOS, Blackberry 10, Blackberry Tablet OS, Cell OS, Cesium, CheriBSD, Chrome OS, @@ -665,7 +665,7 @@ and runs on, that is not listed, please let us know. SINIX-Z, SkyOS, SmartOS, Solaris, Sortix, SunOS, Syllable OS, Symbian, Tizen, TPF, Tru64, tvOS, ucLinux, Ultrix, UNICOS, UnixWare, visionOS, VMS, vxWorks, watchOS, Wear OS, WebOS, Wii System Software, Wii U, Windows, - Windows CE, Xbox System, Xenix, z/OS, z/TPF, z/VM, z/VSE, Zephyr + Xbox System, Xenix, z/OS, z/TPF, z/VM, z/VSE, Zephyr ## 28 CPU Architectures diff --git a/docs/INTERNALS.md b/docs/INTERNALS.md index ac90d3fe82..c21d5a9120 100644 --- a/docs/INTERNALS.md +++ b/docs/INTERNALS.md @@ -24,7 +24,7 @@ versions of libs and build tools. We aim to support these or later versions. - - OpenSSL 1.0.2a + - OpenSSL 3.0.0 - LibreSSL 2.9.1 - GnuTLS 3.1.10 - mbedTLS 3.2.0 diff --git a/docs/THANKS b/docs/THANKS index fd4015468e..d3b3efc0f1 100644 --- a/docs/THANKS +++ b/docs/THANKS @@ -361,7 +361,7 @@ Benjamin Sergeant Ben Kohler Ben Madsen Ben Noordhuis -Benoit Neil +Benoit Neil (Sukender) Benoit Pierre Benoit Sigoure Ben Van Hof @@ -3148,6 +3148,7 @@ Temprimus Terence Eden Terri Oda Terry Wu +Tetetest thanhchungbtc on github TheAssassin on github TheBitBrine @@ -3328,6 +3329,7 @@ UrsusArctos on github User Sg ustcqidi on github Vadim Grinshpun +Vaibhav Kumar Valentin David Valentín Gutiérrez Valentin Richter diff --git a/docs/cmdline-opts/limit-rate.md b/docs/cmdline-opts/limit-rate.md index c5e276e1b5..f58fd1fcd8 100644 --- a/docs/cmdline-opts/limit-rate.md +++ b/docs/cmdline-opts/limit-rate.md @@ -15,6 +15,7 @@ Example: - --limit-rate 100K $URL - --limit-rate 1000 $URL - --limit-rate 10M $URL + - --limit-rate 200K --max-time 60 $URL --- # `--limit-rate` diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c index c905b8b459..12d8de76c9 100644 --- a/docs/examples/anyauthput.c +++ b/docs/examples/anyauthput.c @@ -103,12 +103,7 @@ int main(int argc, char **argv) if(!fp) return 2; -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - if(stat(file, &file_info) != 0) { -#else if(fstat(fileno(fp), &file_info) != 0) { -#endif fclose(fp); return 1; /* cannot continue */ } @@ -152,7 +147,7 @@ int main(int argc, char **argv) data twice!!! */ curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - /* set user name and password for the authentication */ + /* set username and password for the authentication */ curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password"); /* Now run off and do what you have been told! */ diff --git a/docs/examples/block_ip.c b/docs/examples/block_ip.c index b99fab58c3..290f92a61e 100644 --- a/docs/examples/block_ip.c +++ b/docs/examples/block_ip.c @@ -29,7 +29,7 @@ * filter IP addresses. */ -#if defined(__AMIGA__) || defined(UNDER_CE) +#ifdef __AMIGA__ #include int main(void) { printf("Platform not supported.\n"); return 1; } #else diff --git a/docs/examples/connect-to.c b/docs/examples/connect-to.c index 253c531c42..b2848772d8 100644 --- a/docs/examples/connect-to.c +++ b/docs/examples/connect-to.c @@ -40,7 +40,7 @@ int main(void) /* Each single string should be written using the format HOST:PORT:CONNECT-TO-HOST:CONNECT-TO-PORT where HOST is the host of the - request, PORT is the port of the request, CONNECT-TO-HOST is the host name + request, PORT is the port of the request, CONNECT-TO-HOST is the hostname to connect to, and CONNECT-TO-PORT is the port to connect to. */ /* instead of curl.se:443, it resolves and uses example.com:443 but in other @@ -53,12 +53,12 @@ int main(void) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_URL, "https://curl.se/"); - /* since this connects to the wrong host, checking the host name in the + /* since this connects to the wrong host, checking the hostname in the server certificate fails, so unless we disable the check libcurl returns CURLE_PEER_FAILED_VERIFICATION */ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); - /* Letting the wrong host name in the certificate be okay, the transfer + /* Letting the wrong hostname in the certificate be okay, the transfer goes through but (most likely) causes a 404 or similar because it sends an unknown name in the Host: header field */ res = curl_easy_perform(curl); diff --git a/docs/examples/cookie_interface.c b/docs/examples/cookie_interface.c index cebbd3cdcf..4eee1a605d 100644 --- a/docs/examples/cookie_interface.c +++ b/docs/examples/cookie_interface.c @@ -47,7 +47,7 @@ static int print_cookies(CURL *curl) printf("Cookies, curl knows:\n"); res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); 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)); return 1; } @@ -85,7 +85,7 @@ main(void) curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* start cookie engine */ res = curl_easy_perform(curl); if(res != CURLE_OK) { - fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); + fprintf(stderr, "curl perform failed: %s\n", curl_easy_strerror(res)); return 1; } @@ -105,7 +105,7 @@ main(void) "PREF", "hello example, I like you!"); res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); if(res != CURLE_OK) { - fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", + fprintf(stderr, "curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); return 1; } @@ -120,7 +120,7 @@ main(void) "expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.example.com"); res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); if(res != CURLE_OK) { - fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", + fprintf(stderr, "curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); return 1; } @@ -129,14 +129,14 @@ main(void) res = curl_easy_perform(curl); if(res != CURLE_OK) { - fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); + fprintf(stderr, "curl perform failed: %s\n", curl_easy_strerror(res)); return 1; } curl_easy_cleanup(curl); } else { - fprintf(stderr, "Curl init failed!\n"); + fprintf(stderr, "curl init failed!\n"); return 1; } diff --git a/docs/examples/crawler.c b/docs/examples/crawler.c index 4812a67d14..bda931eb13 100644 --- a/docs/examples/crawler.c +++ b/docs/examples/crawler.c @@ -170,7 +170,7 @@ static size_t follow_links(CURLM *multi, struct memory *mem, return count; } -static int is_html(char *ctype) +static int is_html(const char *ctype) { return ctype != NULL && strlen(ctype) > 10 && strstr(ctype, "text/html"); } diff --git a/docs/examples/debug.c b/docs/examples/debug.c index ff522b0ce1..5df7aae90f 100644 --- a/docs/examples/debug.c +++ b/docs/examples/debug.c @@ -69,7 +69,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr, } fprintf(stream, "%c", (ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ + /* check again for 0D0A, to avoid an extra \n if it is at width */ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && ptr[i + c + 2] == 0x0A) { i += (c + 3 - width); diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c index 026967f3ec..b47cbbedbf 100644 --- a/docs/examples/ephiperfifo.c +++ b/docs/examples/ephiperfifo.c @@ -133,7 +133,7 @@ static void mcode_or_die(const char *where, CURLMcode code) static void timer_cb(struct GlobalInfo *g, int revents); -/* Update the timer after curl_multi library does its thing. Curl informs the +/* Update the timer after curl_multi library does its thing. curl informs the * application through this callback what it wants the new timeout to be, * after it does some work. */ static int multi_timer_cb(CURLM *multi, long timeout_ms, struct GlobalInfo *g) @@ -219,7 +219,7 @@ static void timer_cb(struct GlobalInfo *g, int revents) err = read(g->tfd, &count, sizeof(uint64_t)); if(err == -1) { /* Note that we may call the timer callback even if the timerfd is not - * readable. It's possible that there are multiple events stored in the + * readable. It is possible that there are multiple events stored in the * epoll buffer (i.e. the timer may have fired multiple times). The event * count is cleared after the first call so future events in the epoll * buffer fails to read from the timer. */ diff --git a/docs/examples/externalsocket.c b/docs/examples/externalsocket.c index 7415cff81f..6cab781a46 100644 --- a/docs/examples/externalsocket.c +++ b/docs/examples/externalsocket.c @@ -46,11 +46,7 @@ #include /* misc. Unix functions */ #endif -#ifdef UNDER_CE -#define strerror(e) "?" -#else #include -#endif /* The IP address and port number to connect to */ #define IPADDR "127.0.0.1" diff --git a/docs/examples/fileupload.c b/docs/examples/fileupload.c index 03dd323bda..fa9de2aa4f 100644 --- a/docs/examples/fileupload.c +++ b/docs/examples/fileupload.c @@ -57,12 +57,7 @@ int main(void) } /* to get the file size */ -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - if(stat("debugit", &file_info) != 0) { -#else if(fstat(fileno(fd), &file_info) != 0) { -#endif fclose(fd); curl_global_cleanup(); return 1; /* cannot continue */ diff --git a/docs/examples/ftpupload.c b/docs/examples/ftpupload.c index 0df41005f5..b334ad3273 100644 --- a/docs/examples/ftpupload.c +++ b/docs/examples/ftpupload.c @@ -28,11 +28,7 @@ #include #include #include -#ifdef UNDER_CE -#define strerror(e) "?" -#else #include -#endif #ifdef _WIN32 #include #undef stat @@ -90,17 +86,12 @@ int main(void) /* get a FILE * of the file */ hd_src = fopen(LOCAL_FILE, "rb"); if(!hd_src) { - printf("Couldn't open '%s': %s\n", LOCAL_FILE, strerror(errno)); + printf("Could not open '%s': %s\n", LOCAL_FILE, strerror(errno)); return 2; } /* to get the file size */ -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - if(stat(LOCAL_FILE, &file_info) != 0) { -#else if(fstat(fileno(hd_src), &file_info) != 0) { -#endif fclose(hd_src); return 1; /* cannot continue */ } diff --git a/docs/examples/ftpuploadfrommem.c b/docs/examples/ftpuploadfrommem.c index 3ae71fa4ab..9baf538b99 100644 --- a/docs/examples/ftpuploadfrommem.c +++ b/docs/examples/ftpuploadfrommem.c @@ -48,7 +48,7 @@ struct WriteThis { static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *userp) { struct WriteThis *upload = (struct WriteThis *)userp; - size_t max = size*nmemb; + size_t max = size * nmemb; if(max < 1) return 0; diff --git a/docs/examples/ftpuploadresume.c b/docs/examples/ftpuploadresume.c index ea972ec193..b86c23ab86 100644 --- a/docs/examples/ftpuploadresume.c +++ b/docs/examples/ftpuploadresume.c @@ -39,7 +39,7 @@ static size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, r = sscanf(ptr, "Content-Length: %ld\n", &len); if(r == 1) - *((long *) stream) = len; + *((long *)stream) = len; return size * nmemb; } @@ -77,9 +77,7 @@ static int upload(CURL *curl, const char *remotepath, f = fopen(localpath, "rb"); if(!f) { -#ifndef UNDER_CE perror(NULL); -#endif return 0; } diff --git a/docs/examples/ghiper.c b/docs/examples/ghiper.c index 45c129faea..b9edb517d3 100644 --- a/docs/examples/ghiper.c +++ b/docs/examples/ghiper.c @@ -430,9 +430,9 @@ int init_fifo(void) int main(void) { struct GlobalInfo *g = g_malloc0(sizeof(struct GlobalInfo)); - GMainLoop*gmain; + GMainLoop *gmain; int fd; - GIOChannel* ch; + GIOChannel *ch; CURLcode res = curl_global_init(CURL_GLOBAL_ALL); if(res) diff --git a/docs/examples/headerapi.c b/docs/examples/headerapi.c index 428374bac6..18588cf33f 100644 --- a/docs/examples/headerapi.c +++ b/docs/examples/headerapi.c @@ -33,7 +33,7 @@ static size_t write_cb(char *data, size_t n, size_t l, void *userp) /* take care of the data here, ignored in this example */ (void)data; (void)userp; - return n*l; + return n * l; } int main(void) diff --git a/docs/examples/htmltidy.c b/docs/examples/htmltidy.c index 0bf3155570..97eff2b45a 100644 --- a/docs/examples/htmltidy.c +++ b/docs/examples/htmltidy.c @@ -50,7 +50,7 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent) for(child = tidyGetChild(tnod); child; child = tidyGetNext(child) ) { ctmbstr name = tidyNodeGetName(child); if(name) { - /* if it has a name, then it's an HTML tag ... */ + /* if it has a name, then it is an HTML tag ... */ TidyAttr attr; printf("%*.*s%s ", indent, indent, "<", name); /* walk the attribute list */ @@ -62,7 +62,7 @@ void dumpNode(TidyDoc doc, TidyNode tnod, int indent) printf(">\n"); } else { - /* if it does not have a name, then it's probably text, cdata, etc... */ + /* if it does not have a name, then it is probably text, cdata, etc... */ TidyBuffer buf; tidyBufInit(&buf); tidyNodeGetText(doc, child, &buf); diff --git a/docs/examples/htmltitle.cpp b/docs/examples/htmltitle.cpp index 2251a215e8..cdbf0afa08 100644 --- a/docs/examples/htmltitle.cpp +++ b/docs/examples/htmltitle.cpp @@ -22,7 +22,7 @@ * ***************************************************************************/ /* - * Get a web page, extract the title with libxml. + * Get a webpage, extract the title with libxml. * Written by Lars Nilsson diff --git a/docs/examples/http2-download.c b/docs/examples/http2-download.c index efc7472153..e58742e59c 100644 --- a/docs/examples/http2-download.c +++ b/docs/examples/http2-download.c @@ -28,11 +28,7 @@ #include #include #include -#ifdef UNDER_CE -#define strerror(e) "?" -#else #include -#endif #if defined(_MSC_VER) && (_MSC_VER < 1900) #define snprintf _snprintf @@ -90,7 +86,7 @@ static void dump(const char *text, int num, unsigned char *ptr, } fprintf(stderr, "%c", (ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ + /* check again for 0D0A, to avoid an extra \n if it is at width */ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && ptr[i + c + 2] == 0x0A) { i += (c + 3 - width); diff --git a/docs/examples/http2-serverpush.c b/docs/examples/http2-serverpush.c index d501f24199..8c43075b93 100644 --- a/docs/examples/http2-serverpush.c +++ b/docs/examples/http2-serverpush.c @@ -78,7 +78,7 @@ static void dump(const char *text, unsigned char *ptr, size_t size, char nohex) } fprintf(stderr, "%c", (ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ + /* check again for 0D0A, to avoid an extra \n if it is at width */ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && ptr[i + c + 2] == 0x0A) { i += (c + 3 - width); diff --git a/docs/examples/http2-upload.c b/docs/examples/http2-upload.c index 2bff0d0506..0365d93bc5 100644 --- a/docs/examples/http2-upload.c +++ b/docs/examples/http2-upload.c @@ -30,11 +30,7 @@ #include #include #include -#ifdef UNDER_CE -#define strerror(e) "?" -#else #include -#endif /* somewhat Unix-specific */ #ifndef _MSC_VER @@ -92,7 +88,7 @@ struct input { int num; }; -static void dump(const char *text, int num, unsigned char *ptr, +static void dump(const char *text, int num, const unsigned char *ptr, size_t size, char nohex) { size_t i; @@ -128,7 +124,7 @@ static void dump(const char *text, int num, unsigned char *ptr, } fprintf(stderr, "%c", (ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ + /* check again for 0D0A, to avoid an extra \n if it is at width */ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && ptr[i + c + 2] == 0x0A) { i += (c + 3 - width); @@ -231,14 +227,9 @@ static int setup(struct input *t, int num, const char *upload) return 1; } -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - if(stat(upload, &file_info) != 0) { -#else if(fstat(fileno(t->in), &file_info) != 0) { -#endif - fprintf(stderr, "error: could not stat file %s: %s\n", - upload, strerror(errno)); + fprintf(stderr, "error: could not stat file %s: %s\n", upload, + strerror(errno)); fclose(t->out); t->out = NULL; return 1; @@ -305,7 +296,7 @@ int main(int argc, char **argv) num_transfers = 3; /* a suitable low default */ if(argc > 2) - /* if given a file name, upload this! */ + /* if given a filename, upload this! */ filename = argv[2]; } else diff --git a/docs/examples/http3.c b/docs/examples/http3.c index 323f6d7d17..217974f93c 100644 --- a/docs/examples/http3.c +++ b/docs/examples/http3.c @@ -22,7 +22,7 @@ * ***************************************************************************/ /* - * Very simple HTTP/3 GET + * Simple HTTP/3 GET * */ #include diff --git a/docs/examples/httpput.c b/docs/examples/httpput.c index 794ea99ae5..a7fac75b4a 100644 --- a/docs/examples/httpput.c +++ b/docs/examples/httpput.c @@ -90,12 +90,7 @@ int main(int argc, char **argv) return 2; /* get the file size of the local file */ -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - if(stat(file, &file_info) != 0) { -#else if(fstat(fileno(hd_src), &file_info) != 0) { -#endif fclose(hd_src); return 1; /* cannot continue */ } diff --git a/docs/examples/https.c b/docs/examples/https.c index 23729afcaa..1f7f5e1fbb 100644 --- a/docs/examples/https.c +++ b/docs/examples/https.c @@ -56,7 +56,7 @@ int main(void) #ifdef SKIP_HOSTNAME_VERIFICATION /* - * If the site you are connecting to uses a different host name that what + * If the site you are connecting to uses a different hostname that what * they have mentioned in their server certificate's commonName (or * subjectAltName) fields, libcurl refuses to connect. You can skip this * check, but it makes the connection insecure. diff --git a/docs/examples/imap-ssl.c b/docs/examples/imap-ssl.c index 59edd130e5..6eb49ae978 100644 --- a/docs/examples/imap-ssl.c +++ b/docs/examples/imap-ssl.c @@ -68,7 +68,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); #endif - /* If the site you are connecting to uses a different host name that what + /* If the site you are connecting to uses a different hostname that what * they have mentioned in their server certificate's commonName (or * subjectAltName) fields, libcurl refuses to connect. You can skip this * check, but it makes the connection insecure. */ diff --git a/docs/examples/log_failed_transfers.c b/docs/examples/log_failed_transfers.c index c9c0009763..23208d232c 100644 --- a/docs/examples/log_failed_transfers.c +++ b/docs/examples/log_failed_transfers.c @@ -32,9 +32,7 @@ * */ -#ifndef UNDER_CE #include -#endif #include #include #include @@ -140,8 +138,8 @@ static int mem_addf(struct mem *mem, const char *format, ...) /* we need about 100 chars or less to write 95% of lines */ x = 128; - /* first try: there's probably enough memory to write everything. - second try: there's definitely enough memory to write everything. */ + /* first try: there is probably enough memory to write everything. + second try: there is definitely enough memory to write everything. */ for(i = 0; i < 2; ++i) { if(x < 0 || mem_need(mem, (size_t)x + 1) < 0) break; @@ -156,7 +154,7 @@ static int mem_addf(struct mem *mem, const char *format, ...) return x; } -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 /* Not all versions of Windows CRT vsnprintf are compliant with C99. Some return -1 if buffer too small. Try _vscprintf to get the needed size. */ if(!i && x < 0) { @@ -297,11 +295,9 @@ int main(void) } } else { -#ifndef UNDER_CE mem_addf(&t->log, "Failed to create body output file %s: %s\n", t->bodyfile, strerror(errno)); fprintf(stderr, "%s", t->log.recent); -#endif failed = 1; } @@ -310,12 +306,10 @@ int main(void) if(fp && t->log.len == fwrite(t->log.buf, 1, t->log.len, fp)) fprintf(stderr, "Transfer log written to %s\n", t->logfile); -#ifndef UNDER_CE else { fprintf(stderr, "Failed to write transfer log to %s: %s\n", t->logfile, strerror(errno)); } -#endif if(fp) fclose(fp); diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c index 758cfca1de..52f00ce482 100644 --- a/docs/examples/multi-debugcallback.c +++ b/docs/examples/multi-debugcallback.c @@ -34,7 +34,7 @@ #define TRUE 1 -static void dump(const char *text, FILE *stream, unsigned char *ptr, +static void dump(const char *text, FILE *stream, const unsigned char *ptr, size_t size, char nohex) { size_t i; @@ -71,7 +71,7 @@ static void dump(const char *text, FILE *stream, unsigned char *ptr, } fprintf(stream, "%c", (ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? ptr[i + c] : '.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ + /* check again for 0D0A, to avoid an extra \n if it is at width */ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && ptr[i + c + 2] == 0x0A) { i += (c + 3 - width); diff --git a/docs/examples/multi-formadd.c b/docs/examples/multi-formadd.c index 7a1b9eb95d..068412827a 100644 --- a/docs/examples/multi-formadd.c +++ b/docs/examples/multi-formadd.c @@ -51,7 +51,7 @@ int main(void) CURL_IGNORE_DEPRECATION( /* Fill in the file upload field. This makes libcurl load data from - the given file name when curl_easy_perform() is called. */ + the given filename when curl_easy_perform() is called. */ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "sendfile", diff --git a/docs/examples/multithread.c b/docs/examples/multithread.c index 36836ef475..535788e394 100644 --- a/docs/examples/multithread.c +++ b/docs/examples/multithread.c @@ -50,14 +50,19 @@ static const char * const urls[NUMT]= { "www.example" }; -static void *pull_one_url(void *pindex) +struct targ { + const char *url; +}; + + +static void *pull_one_url(void *p) { CURL *curl; + struct targ *targ = p; curl = curl_easy_init(); if(curl) { - int i = *(int *)pindex; - curl_easy_setopt(curl, CURLOPT_URL, urls[i]); + curl_easy_setopt(curl, CURLOPT_URL, targ->url); (void)curl_easy_perform(curl); /* ignores error */ curl_easy_cleanup(curl); } @@ -76,6 +81,7 @@ int main(void) { CURLcode res; pthread_t tid[NUMT]; + struct targ targs[NUMT]; int i; /* Must initialize libcurl before any threads are started */ @@ -84,12 +90,14 @@ int main(void) return (int)res; for(i = 0; i < NUMT; i++) { - int error = pthread_create(&tid[i], - NULL, /* default attributes please */ - pull_one_url, - (void *)&i); + int error; + targs[i].url = urls[i]; + error = pthread_create(&tid[i], + NULL, /* default attributes please */ + pull_one_url, + (void *)&targs[i]); if(error) - fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); + fprintf(stderr, "Could not run thread number %d, errno %d\n", i, error); else fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); } diff --git a/docs/examples/parseurl.c b/docs/examples/parseurl.c index 8675adc623..1514a79823 100644 --- a/docs/examples/parseurl.c +++ b/docs/examples/parseurl.c @@ -51,7 +51,7 @@ int main(void) /* extract hostname from the parsed URL */ uc = curl_url_get(h, CURLUPART_HOST, &host, 0); if(!uc) { - printf("Host name: %s\n", host); + printf("Hostname: %s\n", host); curl_free(host); } diff --git a/docs/examples/pop3-ssl.c b/docs/examples/pop3-ssl.c index 63a9edca70..1be48adc82 100644 --- a/docs/examples/pop3-ssl.c +++ b/docs/examples/pop3-ssl.c @@ -67,7 +67,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); #endif - /* If the site you are connecting to uses a different host name that what + /* If the site you are connecting to uses a different hostname that what * they have mentioned in their server certificate's commonName (or * subjectAltName) fields, libcurl refuses to connect. You can skip this * check, but it makes the connection insecure. */ diff --git a/docs/examples/rtsp-options.c b/docs/examples/rtsp-options.c index 50d5e2f27e..8c160f6b76 100644 --- a/docs/examples/rtsp-options.c +++ b/docs/examples/rtsp-options.c @@ -22,7 +22,7 @@ * ***************************************************************************/ /* - * Very simple RTSP request sending OPTIONS. + * Simple RTSP request sending OPTIONS. * */ #include diff --git a/docs/examples/sftpuploadresume.c b/docs/examples/sftpuploadresume.c index cb5d1cf33e..72ae41382c 100644 --- a/docs/examples/sftpuploadresume.c +++ b/docs/examples/sftpuploadresume.c @@ -92,9 +92,7 @@ static int sftpResumeUpload(CURL *curl, const char *remotepath, f = fopen(localpath, "rb"); if(!f) { -#ifndef UNDER_CE perror(NULL); -#endif return 0; } @@ -103,7 +101,7 @@ static int sftpResumeUpload(CURL *curl, const char *remotepath, curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_cb); curl_easy_setopt(curl, CURLOPT_READDATA, f); -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 _fseeki64(f, remoteFileSizeByte, SEEK_SET); #else fseek(f, (long)remoteFileSizeByte, SEEK_SET); diff --git a/docs/examples/simple.c b/docs/examples/simple.c index 29ed14313e..a427266fd4 100644 --- a/docs/examples/simple.c +++ b/docs/examples/simple.c @@ -22,7 +22,7 @@ * ***************************************************************************/ /* - * Very simple HTTP GET + * Simple HTTP GET * */ #include diff --git a/docs/examples/simplepost.c b/docs/examples/simplepost.c index b1175ba924..824e073e2a 100644 --- a/docs/examples/simplepost.c +++ b/docs/examples/simplepost.c @@ -22,7 +22,7 @@ * ***************************************************************************/ /* - * Very simple HTTP POST + * Simple HTTP POST * */ #include diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c index 0fcffe2501..0d1438e7d7 100644 --- a/docs/examples/smooth-gtk-thread.c +++ b/docs/examples/smooth-gtk-thread.c @@ -133,7 +133,7 @@ void *create_thread(void *progress_bar) pull_one_url, NULL); if(error) - fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); + fprintf(stderr, "Could not run thread number %d, errno %d\n", i, error); else fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); } diff --git a/docs/examples/smtp-ssl.c b/docs/examples/smtp-ssl.c index 5391f3e222..36ecd18d74 100644 --- a/docs/examples/smtp-ssl.c +++ b/docs/examples/smtp-ssl.c @@ -116,7 +116,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); #endif - /* If the site you are connecting to uses a different host name that what + /* If the site you are connecting to uses a different hostname that what * they have mentioned in their server certificate's commonName (or * subjectAltName) fields, libcurl refuses to connect. You can skip this * check, but it makes the connection insecure. */ diff --git a/docs/examples/threaded-ssl.c b/docs/examples/threaded-ssl.c index 5d984a670a..8119113695 100644 --- a/docs/examples/threaded-ssl.c +++ b/docs/examples/threaded-ssl.c @@ -91,7 +91,7 @@ int main(int argc, char **argv) pull_one_url, (void *)&i); if(error) - fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error); + fprintf(stderr, "Could not run thread number %d, errno %d\n", i, error); else fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]); } diff --git a/docs/examples/urlapi.c b/docs/examples/urlapi.c index 82ef3e19aa..7afc759fa1 100644 --- a/docs/examples/urlapi.c +++ b/docs/examples/urlapi.c @@ -42,7 +42,7 @@ int main(void) if(res) return (int)res; - /* init Curl URL */ + /* init curl URL */ urlp = curl_url(); uc = curl_url_set(urlp, CURLUPART_URL, "http://example.com/path/index.html", 0); diff --git a/docs/libcurl/curl_multi_perform.md b/docs/libcurl/curl_multi_perform.md index 9ca13c6793..6e5f0cd8cf 100644 --- a/docs/libcurl/curl_multi_perform.md +++ b/docs/libcurl/curl_multi_perform.md @@ -85,8 +85,7 @@ int main(void) break; } - /* if there are still transfers, loop */ - } while(still_running); + } while(still_running); /* if there are still transfers, loop */ } } ~~~ diff --git a/docs/tests/FILEFORMAT.md b/docs/tests/FILEFORMAT.md index 3897deb9cb..c5c1bcfe90 100644 --- a/docs/tests/FILEFORMAT.md +++ b/docs/tests/FILEFORMAT.md @@ -504,7 +504,7 @@ Features testable here are: - `large-size` (size_t is larger than 32-bit) - `libssh2` - `libssh` -- `oldlibssh` (versions before 0.9.4) +- `badlibssh` (libssh configuration incompatible with the test suite) - `libz` - `local-http`. The HTTP server runs on 127.0.0.1 - `manual` diff --git a/include/curl/system.h b/include/curl/system.h index 62ed2b0f43..a5b3e9eba7 100644 --- a/include/curl/system.h +++ b/include/curl/system.h @@ -135,21 +135,12 @@ # endif #elif defined(UNDER_CE) -# ifdef __MINGW32CE__ -# define CURL_TYPEOF_CURL_OFF_T long long -# define CURL_FORMAT_CURL_OFF_T "lld" -# define CURL_FORMAT_CURL_OFF_TU "llu" -# define CURL_SUFFIX_CURL_OFF_T LL -# define CURL_SUFFIX_CURL_OFF_TU ULL -# define CURL_TYPEOF_CURL_SOCKLEN_T int -# else -# define CURL_TYPEOF_CURL_OFF_T __int64 -# define CURL_FORMAT_CURL_OFF_T "I64d" -# define CURL_FORMAT_CURL_OFF_TU "I64u" -# define CURL_SUFFIX_CURL_OFF_T i64 -# define CURL_SUFFIX_CURL_OFF_TU ui64 -# define CURL_TYPEOF_CURL_SOCKLEN_T int -# endif +# define CURL_TYPEOF_CURL_OFF_T __int64 +# define CURL_FORMAT_CURL_OFF_T "I64d" +# define CURL_FORMAT_CURL_OFF_TU "I64u" +# define CURL_SUFFIX_CURL_OFF_T i64 +# define CURL_SUFFIX_CURL_OFF_TU ui64 +# define CURL_TYPEOF_CURL_SOCKLEN_T int #elif defined(__MINGW32__) # include diff --git a/lib/altsvc.c b/lib/altsvc.c index d9933f2298..357d3bc209 100644 --- a/lib/altsvc.c +++ b/lib/altsvc.c @@ -559,7 +559,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data, } } else { - /* IPv6 host name */ + /* IPv6 hostname */ if(curlx_str_until(&p, &dsthost, MAX_IPADR_LEN, ']') || curlx_str_single(&p, ']')) { infof(data, "Bad alt-svc IPv6 hostname, ignoring."); diff --git a/lib/asyn-thrdd.c b/lib/asyn-thrdd.c index d1652d0ff4..07b6663049 100644 --- a/lib/asyn-thrdd.c +++ b/lib/asyn-thrdd.c @@ -473,7 +473,7 @@ static bool async_thrdd_init(struct Curl_easy *data, err_exit: CURL_TRC_DNS(data, "resolve thread failed init: %d", err); async_thrdd_destroy(data); - CURL_SETERRNO(err); + errno = err; return FALSE; } diff --git a/lib/cf-h2-proxy.c b/lib/cf-h2-proxy.c index d38bd46952..9a8312a042 100644 --- a/lib/cf-h2-proxy.c +++ b/lib/cf-h2-proxy.c @@ -311,7 +311,7 @@ static CURLcode cf_h2_proxy_ctx_init(struct Curl_cfilter *cf, rc = nghttp2_session_callbacks_new(&cbs); if(rc) { - failf(data, "Couldn't initialize nghttp2 callbacks"); + failf(data, "Could not initialize nghttp2 callbacks"); goto out; } @@ -331,7 +331,7 @@ static CURLcode cf_h2_proxy_ctx_init(struct Curl_cfilter *cf, /* The nghttp2 session is not yet setup, do it */ rc = proxy_h2_client_new(cf, cbs); if(rc) { - failf(data, "Couldn't initialize nghttp2"); + failf(data, "Could not initialize nghttp2"); goto out; } diff --git a/lib/cf-socket.c b/lib/cf-socket.c index d4244fc2ad..80ed212721 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -103,7 +103,9 @@ static void set_ipv6_v6only(curl_socket_t sockfd, int on) #define set_ipv6_v6only(x,y) #endif -static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd) +static void tcpnodelay(struct Curl_cfilter *cf, + struct Curl_easy *data, + curl_socket_t sockfd) { #if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED) curl_socklen_t onoff = (curl_socklen_t) 1; @@ -112,9 +114,10 @@ static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd) if(setsockopt(sockfd, level, TCP_NODELAY, (void *)&onoff, sizeof(onoff)) < 0) - infof(data, "Could not set TCP_NODELAY: %s", - curlx_strerror(SOCKERRNO, buffer, sizeof(buffer))); + CURL_TRC_CF(data, cf, "Could not set TCP_NODELAY: %s", + curlx_strerror(SOCKERRNO, buffer, sizeof(buffer))); #else + (void)cf; (void)data; (void)sockfd; #endif @@ -125,31 +128,28 @@ static void tcpnodelay(struct Curl_easy *data, curl_socket_t sockfd) sending data to a dead peer (instead of relying on the 4th argument to send being MSG_NOSIGNAL). Possibly also existing and in use on other BSD systems? */ -static void nosigpipe(struct Curl_easy *data, +static void nosigpipe(struct Curl_cfilter *cf, + struct Curl_easy *data, curl_socket_t sockfd) { int onoff = 1; - (void)data; if(setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&onoff, sizeof(onoff)) < 0) { #ifndef CURL_DISABLE_VERBOSE_STRINGS char buffer[STRERROR_LEN]; - infof(data, "Could not set SO_NOSIGPIPE: %s", - curlx_strerror(SOCKERRNO, buffer, sizeof(buffer))); + CURL_TRC_CF(data, cf, "Could not set SO_NOSIGPIPE: %s", + curlx_strerror(SOCKERRNO, buffer, sizeof(buffer))); +#else + (void)cf; + (void)data; #endif } } #else -#define nosigpipe(x,y) Curl_nop_stmt +#define nosigpipe(x,y,z) Curl_nop_stmt #endif -#if defined(USE_WINSOCK) && \ - defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL) && defined(TCP_KEEPCNT) -/* Win 10, v 1709 (10.0.16299) and later can use SetSockOpt TCP_KEEP____ - * so should use seconds */ -#define CURL_WINSOCK_KEEP_SSO -#define KEEPALIVE_FACTOR(x) -#elif defined(USE_WINSOCK) || \ +#if defined(USE_WINSOCK) || \ (defined(__sun) && !defined(TCP_KEEPIDLE)) || \ (defined(__DragonFly__) && __DragonFly_version < 500702) || \ (defined(_WIN32) && !defined(TCP_KEEPIDLE)) @@ -160,19 +160,9 @@ static void nosigpipe(struct Curl_easy *data, #define KEEPALIVE_FACTOR(x) #endif -/* Offered by mingw-w64 and MS SDK. Latter only when targeting Win7+. */ -#if defined(USE_WINSOCK) && !defined(SIO_KEEPALIVE_VALS) -#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4) - -struct tcp_keepalive { - u_long onoff; - u_long keepalivetime; - u_long keepaliveinterval; -}; -#endif - static void -tcpkeepalive(struct Curl_easy *data, +tcpkeepalive(struct Curl_cfilter *cf, + struct Curl_easy *data, curl_socket_t sockfd) { int optval = data->set.tcp_keepalive ? 1 : 0; @@ -180,62 +170,72 @@ tcpkeepalive(struct Curl_easy *data, /* only set IDLE and INTVL if setting KEEPALIVE is successful */ if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set SO_KEEPALIVE on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); + CURL_TRC_CF(data, cf, "Failed to set SO_KEEPALIVE on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } else { -#ifdef SIO_KEEPALIVE_VALS /* Windows */ -/* Windows 10, version 1709 (10.0.16299) and later versions */ -#ifdef CURL_WINSOCK_KEEP_SSO - optval = curlx_sltosi(data->set.tcp_keepidle); - KEEPALIVE_FACTOR(optval); - if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, - (const char *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPIDLE on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); - } - optval = curlx_sltosi(data->set.tcp_keepintvl); - KEEPALIVE_FACTOR(optval); - if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, - (const char *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPINTVL on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); - } - optval = curlx_sltosi(data->set.tcp_keepcnt); - if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, - (const char *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPCNT on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); - } -#else /* Windows < 10.0.16299 */ - struct tcp_keepalive vals; - DWORD dummy; - vals.onoff = 1; - optval = curlx_sltosi(data->set.tcp_keepidle); - KEEPALIVE_FACTOR(optval); - vals.keepalivetime = (u_long)optval; - optval = curlx_sltosi(data->set.tcp_keepintvl); - KEEPALIVE_FACTOR(optval); - vals.keepaliveinterval = (u_long)optval; - if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals), - NULL, 0, &dummy, NULL, NULL) != 0) { - infof(data, "Failed to set SIO_KEEPALIVE_VALS on fd " - "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); +#ifdef USE_WINSOCK +/* Offered by mingw-w64 v12+. MS SDK ~10+/~VS2017+. */ +#if defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL) && defined(TCP_KEEPCNT) + /* Windows 10, version 1709 (10.0.16299) and later versions can use + setsockopt() TCP_KEEP*. Older versions return with failure. */ + if(curlx_verify_windows_version(10, 0, 16299, PLATFORM_WINNT, + VERSION_GREATER_THAN_EQUAL)) { + CURL_TRC_CF(data, cf, "Set TCP_KEEP* on fd=%" FMT_SOCKET_T, sockfd); + optval = curlx_sltosi(data->set.tcp_keepidle); + if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, + (const char *)&optval, sizeof(optval)) < 0) { + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPIDLE on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); + } + optval = curlx_sltosi(data->set.tcp_keepintvl); + if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, + (const char *)&optval, sizeof(optval)) < 0) { + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPINTVL on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); + } + optval = curlx_sltosi(data->set.tcp_keepcnt); + if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, + (const char *)&optval, sizeof(optval)) < 0) { + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPCNT on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); + } } + else +#endif /* TCP_KEEPIDLE && TCP_KEEPINTVL && TCP_KEEPCNT */ + { +/* Offered by mingw-w64 and MS SDK. Latter only when targeting Win7+. */ +#ifndef SIO_KEEPALIVE_VALS +#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4) + struct tcp_keepalive { + u_long onoff; + u_long keepalivetime; + u_long keepaliveinterval; + }; #endif -#else /* !Windows */ + struct tcp_keepalive vals; + DWORD dummy; + vals.onoff = 1; + optval = curlx_sltosi(data->set.tcp_keepidle); + KEEPALIVE_FACTOR(optval); + vals.keepalivetime = (u_long)optval; + optval = curlx_sltosi(data->set.tcp_keepintvl); + KEEPALIVE_FACTOR(optval); + vals.keepaliveinterval = (u_long)optval; + if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID)&vals, sizeof(vals), + NULL, 0, &dummy, NULL, NULL) != 0) { + CURL_TRC_CF(data, cf, "Failed to set SIO_KEEPALIVE_VALS on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); + } + } +#else /* !USE_WINSOCK */ #ifdef TCP_KEEPIDLE optval = curlx_sltosi(data->set.tcp_keepidle); KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPIDLE on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPIDLE on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } #elif defined(TCP_KEEPALIVE) /* macOS style */ @@ -243,9 +243,8 @@ tcpkeepalive(struct Curl_easy *data, KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE, (void *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPALIVE on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } #elif defined(TCP_KEEPALIVE_THRESHOLD) /* Solaris <11.4 style */ @@ -253,9 +252,8 @@ tcpkeepalive(struct Curl_easy *data, KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE_THRESHOLD, (void *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPALIVE_THRESHOLD on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE_THRESHOLD on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } #endif #ifdef TCP_KEEPINTVL @@ -263,9 +261,8 @@ tcpkeepalive(struct Curl_easy *data, KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPINTVL on fd " - "%" FMT_SOCKET_T ": errno %d", - sockfd, SOCKERRNO); + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPINTVL on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } #elif defined(TCP_KEEPALIVE_ABORT_THRESHOLD) /* Solaris <11.4 style */ @@ -284,19 +281,19 @@ tcpkeepalive(struct Curl_easy *data, KEEPALIVE_FACTOR(optval); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE_ABORT_THRESHOLD, (void *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPALIVE_ABORT_THRESHOLD on fd " - "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPALIVE_ABORT_THRESHOLD" + " on fd %" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } #endif #ifdef TCP_KEEPCNT optval = curlx_sltosi(data->set.tcp_keepcnt); if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, (void *)&optval, sizeof(optval)) < 0) { - infof(data, "Failed to set TCP_KEEPCNT on fd " - "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); + CURL_TRC_CF(data, cf, "Failed to set TCP_KEEPCNT on fd " + "%" FMT_SOCKET_T ": errno %d", sockfd, SOCKERRNO); } #endif -#endif +#endif /* USE_WINSOCK */ } } @@ -657,7 +654,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, /* Do not fall back to treating it as a hostname */ char buffer[STRERROR_LEN]; data->state.os_errno = error = SOCKERRNO; - failf(data, "Couldn't bind to interface '%s' with errno %d: %s", + failf(data, "Could not bind to interface '%s' with errno %d: %s", iface, error, curlx_strerror(error, buffer, sizeof(buffer))); return CURLE_INTERFACE_FAILED; } @@ -761,7 +758,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, char buffer[STRERROR_LEN]; data->state.errorbuf = FALSE; data->state.os_errno = error = SOCKERRNO; - failf(data, "Couldn't bind to '%s' with errno %d: %s", host, + failf(data, "Could not bind to '%s' with errno %d: %s", host, error, curlx_strerror(error, buffer, sizeof(buffer))); return CURLE_INTERFACE_FAILED; } @@ -846,24 +843,11 @@ static bool verifyconnect(curl_socket_t sockfd, int *error) * * Someone got to verify this on Win-NT 4.0, 2000." */ - -#ifdef UNDER_CE - Sleep(0); -#else SleepEx(0, FALSE); -#endif - #endif if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize)) err = SOCKERRNO; -#ifdef UNDER_CE - /* Old Windows CE versions do not support SO_ERROR */ - if(WSAENOPROTOOPT == err) { - SET_SOCKERRNO(0); - err = 0; - } -#endif #if defined(EBADIOCTL) && defined(__minix) /* Minix 3.1.x does not support getsockopt on UDP sockets */ if(EBADIOCTL == err) { @@ -1150,14 +1134,14 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf, ctx->addr.socktype == SOCK_STREAM; #endif if(is_tcp && data->set.tcp_nodelay) - tcpnodelay(data, ctx->sock); + tcpnodelay(cf, data, ctx->sock); - nosigpipe(data, ctx->sock); + nosigpipe(cf, data, ctx->sock); Curl_sndbuf_init(ctx->sock); if(is_tcp && data->set.tcp_keepalive) - tcpkeepalive(data, ctx->sock); + tcpkeepalive(cf, data, ctx->sock); if(data->set.fsockopt) { /* activate callback for setting socket options */ @@ -1271,8 +1255,8 @@ static int do_connect(struct Curl_cfilter *cf, struct Curl_easy *data, #elif defined(TCP_FASTOPEN_CONNECT) /* Linux >= 4.11 */ if(setsockopt(ctx->sock, IPPROTO_TCP, TCP_FASTOPEN_CONNECT, (void *)&optval, sizeof(optval)) < 0) - infof(data, "Failed to enable TCP Fast Open on fd %" FMT_SOCKET_T, - ctx->sock); + CURL_TRC_CF(data, cf, "Failed to enable TCP Fast Open on fd %" + FMT_SOCKET_T, ctx->sock); rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen); #elif defined(MSG_FASTOPEN) /* old Linux */ diff --git a/lib/config-win32.h b/lib/config-win32.h index 408606d611..4bf034bea3 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -28,8 +28,6 @@ /* Hand crafted config file for Windows */ /* ================================================================ */ -#ifndef UNDER_CE - /* Define some minimum and default build targets for Visual Studio */ #ifdef _MSC_VER /* VS2012 default target settings and minimum build target check. */ @@ -58,28 +56,25 @@ # error VS2012 does not support build targets prior to Windows Vista # endif # endif - /* Default target settings and minimum build target check for - VS2008 and VS2010 */ + /* VS2010 default target settings and minimum build target check. */ # else -# define VS2008_MIN_TARGET 0x0501 /* XP */ - /* VS2008 default build target is Windows Vista (0x0600). + /* VS2010 default build target is Windows 7 (0x0601). We override default target to be Windows XP. */ -# define VS2008_DEF_TARGET 0x0501 /* XP */ +# define VS2010_MIN_TARGET 0x0501 /* XP */ +# define VS2010_DEF_TARGET 0x0501 /* XP */ # ifndef _WIN32_WINNT -# define _WIN32_WINNT VS2008_DEF_TARGET +# define _WIN32_WINNT VS2010_DEF_TARGET # endif # ifndef WINVER -# define WINVER VS2008_DEF_TARGET +# define WINVER VS2010_DEF_TARGET # endif -# if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET) -# error VS2008 does not support build targets prior to Windows XP +# if (_WIN32_WINNT < VS2010_MIN_TARGET) || (WINVER < VS2010_MIN_TARGET) +# error VS2010 does not support build targets prior to Windows XP # endif # endif #endif /* _MSC_VER */ -#endif /* UNDER_CE */ - /* ---------------------------------------------------------------- */ /* HEADER FILES */ /* ---------------------------------------------------------------- */ @@ -87,19 +82,15 @@ /* Define if you have the header file. */ /* #define HAVE_ARPA_INET_H 1 */ -#ifndef UNDER_CE - /* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 /* exists on __MINGW32CE__ */ +#define HAVE_FCNTL_H 1 /* Define if you have the header file. */ -#define HAVE_IO_H 1 /* exists on __MINGW32CE__ */ +#define HAVE_IO_H 1 /* Define if you have the header file. */ #define HAVE_LOCALE_H 1 -#endif - /* Define if you have the header file. */ /* #define HAVE_NETDB_H 1 */ @@ -107,14 +98,12 @@ /* #define HAVE_NETINET_IN_H 1 */ /* Define to 1 if you have the header file. */ -#ifndef UNDER_CE #if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__) -#define HAVE_STDBOOL_H 1 /* exists on __MINGW32CE__ */ -#endif +#define HAVE_STDBOOL_H 1 #endif /* Define to 1 if you have the header file. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1600)) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) #define HAVE_STDINT_H 1 #endif @@ -159,10 +148,8 @@ #define STDC_HEADERS 1 /* Define to 1 if bool is an available type. */ -#ifndef UNDER_CE #if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || defined(__MINGW32__) -#define HAVE_BOOL_T 1 /* exists on __MINGW32CE__ */ -#endif +#define HAVE_BOOL_T 1 #endif /* ---------------------------------------------------------------- */ @@ -200,7 +187,6 @@ /* Define if you have the select function. */ #define HAVE_SELECT 1 -#ifndef UNDER_CE /* Define if you have the setlocale function. */ #define HAVE_SETLOCALE 1 @@ -209,7 +195,6 @@ /* Define if you have the _setmode function. */ #define HAVE__SETMODE 1 -#endif /* Define if you have the socket function. */ #define HAVE_SOCKET 1 @@ -276,9 +261,7 @@ #endif /* Define to 1 if you have the signal function. */ -#ifndef UNDER_CE #define HAVE_SIGNAL 1 -#endif /* ---------------------------------------------------------------- */ /* TYPEDEF REPLACEMENTS */ @@ -347,11 +330,9 @@ #endif /* Windows XP is required for freeaddrinfo, getaddrinfo */ -#ifndef UNDER_CE #define HAVE_FREEADDRINFO 1 #define HAVE_GETADDRINFO 1 #define HAVE_GETADDRINFO_THREADSAFE 1 -#endif /* ---------------------------------------------------------------- */ /* STRUCT RELATED */ @@ -370,8 +351,6 @@ /* LARGE FILE SUPPORT */ /* ---------------------------------------------------------------- */ -#ifndef UNDER_CE - #if defined(_MSC_VER) || defined(__MINGW32__) # define USE_WIN32_LARGE_FILES /* Number of bits in a file offset, on hosts where this is settable. */ @@ -390,8 +369,6 @@ # define SIZEOF_OFF_T 4 #endif -#endif /* UNDER_CE */ - /* ---------------------------------------------------------------- */ /* DNS RESOLVER SPECIALTY */ /* ---------------------------------------------------------------- */ @@ -420,7 +397,7 @@ #ifdef CURL_HAS_OPENLDAP_LDAPSDK #undef USE_WIN32_LDAP #define HAVE_LDAP_URL_PARSE 1 -#elif !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#elif !defined(CURL_WINDOWS_UWP) #undef HAVE_LDAP_URL_PARSE #define HAVE_LDAP_SSL 1 #define USE_WIN32_LDAP 1 @@ -432,9 +409,7 @@ #endif /* Define to use Unix sockets. */ -#ifndef UNDER_CE #define USE_UNIX_SOCKETS -#endif /* ---------------------------------------------------------------- */ /* ADDITIONAL DEFINITIONS */ @@ -442,52 +417,19 @@ /* Define cpu-machine-OS */ #ifndef CURL_OS -# ifdef UNDER_CE -# ifdef _M_ARM -# define CURL_OS "arm-pc-win32ce" -# else -# define CURL_OS "i386-pc-win32ce" -# endif -# else /* !UNDER_CE */ -# if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ -# define CURL_OS "i386-pc-win32" -# elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (VS2005+ or gcc) */ -# define CURL_OS "x86_64-pc-win32" -# elif defined(_M_IA64) || defined(__ia64__) /* Itanium */ -# define CURL_OS "ia64-pc-win32" -# elif defined(_M_ARM_NT) || defined(__arm__) /* ARMv7-Thumb2 */ -# define CURL_OS "thumbv7a-pc-win32" -# elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */ -# define CURL_OS "aarch64-pc-win32" -# else -# define CURL_OS "unknown-pc-win32" -# endif -# endif /* UNDER_CE */ +# if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */ +# define CURL_OS "i386-pc-win32" +# elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (VS2005+ or gcc) */ +# define CURL_OS "x86_64-pc-win32" +# elif defined(_M_IA64) || defined(__ia64__) /* Itanium */ +# define CURL_OS "ia64-pc-win32" +# elif defined(_M_ARM_NT) || defined(__arm__) /* ARMv7-Thumb2 */ +# define CURL_OS "thumbv7a-pc-win32" +# elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */ +# define CURL_OS "aarch64-pc-win32" +# else +# define CURL_OS "unknown-pc-win32" +# endif #endif /* !CURL_OS */ -/* ---------------------------------------------------------------- */ -/* Windows CE */ -/* ---------------------------------------------------------------- */ - -#ifdef UNDER_CE - -#ifndef UNICODE -#define UNICODE -#endif - -#ifndef _UNICODE -#define _UNICODE -#endif - -#define CURL_DISABLE_FILE 1 -#define CURL_DISABLE_TELNET 1 -#define CURL_DISABLE_LDAP 1 - -#ifndef _MSC_VER -/* !checksrc! disable BANNEDFUNC 1 */ -extern int stat(const char *path, struct stat *buffer); -#endif - -#endif /* UNDER_CE */ - #endif /* HEADER_CURL_CONFIG_WIN32_H */ diff --git a/lib/connect.c b/lib/connect.c index 18d9028c6c..b5de9b4f5e 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -116,6 +116,7 @@ timediff_t Curl_timeleft_ms(struct Curl_easy *data, { timediff_t timeleft_ms = 0; timediff_t ctimeleft_ms = 0; + timediff_t ctimeout_ms; struct curltime now; /* The duration of a connect and the total transfer are calculated from two @@ -136,20 +137,19 @@ timediff_t Curl_timeleft_ms(struct Curl_easy *data, curlx_timediff_ms(*nowp, data->progress.t_startop); if(!timeleft_ms) timeleft_ms = -1; /* 0 is "no limit", fake 1 ms expiry */ - if(!duringconnect) - return timeleft_ms; /* no connect check, this is it */ } - if(duringconnect) { - timediff_t ctimeout_ms = (data->set.connecttimeout > 0) ? - data->set.connecttimeout : DEFAULT_CONNECT_TIMEOUT; - ctimeleft_ms = ctimeout_ms - - curlx_timediff_ms(*nowp, data->progress.t_startsingle); - if(!ctimeleft_ms) - ctimeleft_ms = -1; /* 0 is "no limit", fake 1 ms expiry */ - if(!timeleft_ms) - return ctimeleft_ms; /* no general timeout, this is it */ - } + if(!duringconnect) + return timeleft_ms; /* no connect check, this is it */ + ctimeout_ms = (data->set.connecttimeout > 0) ? + data->set.connecttimeout : DEFAULT_CONNECT_TIMEOUT; + ctimeleft_ms = ctimeout_ms - + curlx_timediff_ms(*nowp, data->progress.t_startsingle); + if(!ctimeleft_ms) + ctimeleft_ms = -1; /* 0 is "no limit", fake 1 ms expiry */ + if(!timeleft_ms) + return ctimeleft_ms; /* no general timeout, this is it */ + /* return minimal time left or max amount already expired */ return (ctimeleft_ms < timeleft_ms) ? ctimeleft_ms : timeleft_ms; } @@ -280,7 +280,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, addr[0] = '\0'; *port = 0; - CURL_SETERRNO(SOCKEAFNOSUPPORT); + errno = SOCKEAFNOSUPPORT; return FALSE; } diff --git a/lib/cookie.c b/lib/cookie.c index fce628cb97..3155c4b3e4 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -458,7 +458,7 @@ parse_cookie_header(struct Curl_easy *data, */ if(!co->name) { - /* The very first name/value pair is the actual cookie name */ + /* The first name/value pair is the actual cookie name */ if(!sep) /* Bad name/value pair. */ return CURLE_OK; diff --git a/lib/curl_fopen.c b/lib/curl_fopen.c index c41cff21cd..fd0c7c65d2 100644 --- a/lib/curl_fopen.c +++ b/lib/curl_fopen.c @@ -101,14 +101,7 @@ CURLcode Curl_fopen(struct Curl_easy *data, const char *filename, *fh = curlx_fopen(filename, FOPEN_WRITETEXT); if(!*fh) goto fail; - if( -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - stat(filename, &sb) == -1 -#else - fstat(fileno(*fh), &sb) == -1 -#endif - || !S_ISREG(sb.st_mode)) { + if(fstat(fileno(*fh), &sb) == -1 || !S_ISREG(sb.st_mode)) { return CURLE_OK; } curlx_fclose(*fh); diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c index c3fa864eff..9f2624ff05 100644 --- a/lib/curl_gethostname.c +++ b/lib/curl_gethostname.c @@ -62,7 +62,7 @@ int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen) if(strlen(force_hostname) < (size_t)namelen) strcpy(name, force_hostname); else - return 1; /* can't do it */ + return 1; /* cannot do it */ err = 0; } else { diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c index 28ae16d187..d013929d4d 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c @@ -469,13 +469,13 @@ static void time2filetime(struct ms_filetime *ft, time_t t) { #if SIZEOF_TIME_T > 4 t = (t + (curl_off_t)11644473600) * 10000000; - ft->dwLowDateTime = (unsigned int) (t & 0xFFFFFFFF); - ft->dwHighDateTime = (unsigned int) (t >> 32); + ft->dwLowDateTime = (unsigned int)(t & 0xFFFFFFFF); + ft->dwHighDateTime = (unsigned int)(t >> 32); #else unsigned int r, s; unsigned int i; - ft->dwLowDateTime = (unsigned int)t & 0xFFFFFFFF; + ft->dwLowDateTime = (unsigned int)(t & 0xFFFFFFFF); ft->dwHighDateTime = 0; # ifndef HAVE_TIME_T_UNSIGNED diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c index b04e958268..1c9f259de4 100644 --- a/lib/curl_sasl.c +++ b/lib/curl_sasl.c @@ -96,7 +96,7 @@ unsigned short Curl_sasl_decode_mech(const char *ptr, size_t maxlen, for(i = 0; mechtable[i].name; i++) { if(maxlen >= mechtable[i].len && - !memcmp(ptr, mechtable[i].name, mechtable[i].len)) { + curl_strnequal(ptr, mechtable[i].name, mechtable[i].len)) { if(len) *len = mechtable[i].len; diff --git a/lib/curl_setup.h b/lib/curl_setup.h index d41c9b8cea..bf7030f693 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -75,14 +75,14 @@ #endif #endif -#if defined(__MINGW32__) && !defined(__MINGW32CE__) && \ +#if defined(__MINGW32__) && \ (!defined(__MINGW64_VERSION_MAJOR) || (__MINGW64_VERSION_MAJOR < 3)) #error "Building curl requires mingw-w64 3.0 or later" #endif -/* Visual Studio 2008 is the minimum Visual Studio version we support. +/* Visual Studio 2010 is the minimum Visual Studio version we support. Workarounds for older versions of Visual Studio have been removed. */ -#if defined(_MSC_VER) && (_MSC_VER < 1500) +#if defined(_MSC_VER) && (_MSC_VER < 1600) #error "Ancient versions of Visual Studio are no longer supported due to bugs." #endif @@ -122,14 +122,6 @@ # endif #endif -/* Avoid bogus format check warnings with mingw32ce gcc 4.4.0 in - C99 (-std=gnu99) mode */ -#if defined(__MINGW32CE__) && !defined(CURL_NO_FMT_CHECKS) && \ - (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) && \ - (defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)) -#define CURL_NO_FMT_CHECKS -#endif - /* Compatibility */ #ifdef ENABLE_IPV6 #define USE_IPV6 1 @@ -497,12 +489,10 @@ # define LSEEK_ERROR (__int64)-1 # else /* Small file (<2Gb) support using Win32 functions. */ -# ifndef UNDER_CE -# undef lseek -# define lseek(fdes, offset, whence) _lseek(fdes, (long)offset, whence) -# define fstat(fdes, stp) _fstat(fdes, stp) -# define struct_stat struct _stat -# endif +# undef lseek +# define lseek(fdes, offset, whence) _lseek(fdes, (long)offset, whence) +# define fstat(fdes, stp) _fstat(fdes, stp) +# define struct_stat struct _stat # define LSEEK_ERROR (long)-1 # endif #elif defined(__DJGPP__) @@ -817,27 +807,6 @@ #include "curl_setup_once.h" #endif -#ifdef UNDER_CE -#define getenv curl_getenv /* Windows CE does not support getenv() */ -#define raise(s) ((void)(s)) -/* Terrible workarounds to make Windows CE compile */ -#define errno 0 -#define CURL_SETERRNO(x) ((void)(x)) -#define EINTR 4 -#define EAGAIN 11 -#define ENOMEM 12 -#define EACCES 13 -#define EEXIST 17 -#define EISDIR 21 -#define EINVAL 22 -#define ENOSPC 28 -#define strerror(x) "?" -#undef STDIN_FILENO -#define STDIN_FILENO 0 -#else -#define CURL_SETERRNO(x) (errno = (x)) -#endif - /* * Definition of our NOP statement Object-like macro */ @@ -926,7 +895,7 @@ endings either CRLF or LF so 't' is appropriate. /* for systems that do not detect this in configure */ #ifndef CURL_SA_FAMILY_T -# if defined(_WIN32) && !defined(UNDER_CE) +# ifdef _WIN32 # define CURL_SA_FAMILY_T ADDRESS_FAMILY # elif defined(HAVE_SA_FAMILY_T) # define CURL_SA_FAMILY_T sa_family_t diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h index 7a54760e16..7caf6c9bc5 100644 --- a/lib/curl_setup_once.h +++ b/lib/curl_setup_once.h @@ -33,9 +33,7 @@ #include #include #include -#ifndef UNDER_CE #include -#endif #ifdef HAVE_SYS_TYPES_H #include @@ -67,8 +65,6 @@ Use it for APIs that do not or cannot support the const qualifier. */ #ifdef HAVE_STDINT_H # define CURL_UNCONST(p) ((void *)(uintptr_t)(const void *)(p)) -#elif defined(_WIN32) /* for VS2008 */ -# define CURL_UNCONST(p) ((void *)(ULONG_PTR)(const void *)(p)) #else # define CURL_UNCONST(p) ((void *)(p)) /* Fall back to simple cast */ #endif @@ -356,7 +352,7 @@ typedef unsigned int bit; #ifdef __VMS #define argv_item_t __char_ptr32 -#elif defined(_UNICODE) && !defined(UNDER_CE) +#elif defined(_UNICODE) #define argv_item_t wchar_t * #else #define argv_item_t char * diff --git a/lib/curl_sha512_256.c b/lib/curl_sha512_256.c index 0d2cd3c3f9..070d1722cb 100644 --- a/lib/curl_sha512_256.c +++ b/lib/curl_sha512_256.c @@ -40,10 +40,8 @@ #ifdef USE_OPENSSL # include -# if (!defined(LIBRESSL_VERSION_NUMBER) && \ - OPENSSL_VERSION_NUMBER >= 0x10101000L) || \ - (defined(LIBRESSL_VERSION_NUMBER) && \ - LIBRESSL_VERSION_NUMBER >= 0x3080000fL) +# if !defined(LIBRESSL_VERSION_NUMBER) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x3080000fL) # include # if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512) # include diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c index c819b1c22e..32b4c894d6 100644 --- a/lib/curl_sspi.c +++ b/lib/curl_sspi.c @@ -62,11 +62,7 @@ CURLcode Curl_sspi_global_init(void) /* If security interface is not yet initialized try to do this */ if(!Curl_pSecFn) { /* Get pointer to Security Service Provider Interface dispatch table */ -#ifdef __MINGW32CE__ - Curl_pSecFn = InitSecurityInterfaceW(); -#else Curl_pSecFn = InitSecurityInterface(); -#endif if(!Curl_pSecFn) return CURLE_FAILED_INIT; } diff --git a/lib/curl_sspi.h b/lib/curl_sspi.h index 8ecd81fdea..89ebc9b0ba 100644 --- a/lib/curl_sspi.h +++ b/lib/curl_sspi.h @@ -70,225 +70,6 @@ extern PSecurityFunctionTable Curl_pSecFn; #define ISC_REQ_USE_HTTP_STYLE 0x01000000 #endif -#ifdef __MINGW32CE__ -#ifndef ISC_RET_REPLAY_DETECT -#define ISC_RET_REPLAY_DETECT 0x00000004 -#endif -#ifndef ISC_RET_SEQUENCE_DETECT -#define ISC_RET_SEQUENCE_DETECT 0x00000008 -#endif -#ifndef ISC_RET_CONFIDENTIALITY -#define ISC_RET_CONFIDENTIALITY 0x00000010 -#endif -#ifndef ISC_RET_ALLOCATED_MEMORY -#define ISC_RET_ALLOCATED_MEMORY 0x00000100 -#endif -#ifndef ISC_RET_STREAM -#define ISC_RET_STREAM 0x00008000 -#endif - -#ifndef SEC_E_INSUFFICIENT_MEMORY -#define SEC_E_INSUFFICIENT_MEMORY ((HRESULT)0x80090300L) -#endif -#ifndef SEC_E_INVALID_HANDLE -#define SEC_E_INVALID_HANDLE ((HRESULT)0x80090301L) -#endif -#ifndef SEC_E_UNSUPPORTED_FUNCTION -#define SEC_E_UNSUPPORTED_FUNCTION ((HRESULT)0x80090302L) -#endif -#ifndef SEC_E_TARGET_UNKNOWN -#define SEC_E_TARGET_UNKNOWN ((HRESULT)0x80090303L) -#endif -#ifndef SEC_E_INTERNAL_ERROR -#define SEC_E_INTERNAL_ERROR ((HRESULT)0x80090304L) -#endif -#ifndef SEC_E_SECPKG_NOT_FOUND -#define SEC_E_SECPKG_NOT_FOUND ((HRESULT)0x80090305L) -#endif -#ifndef SEC_E_NOT_OWNER -#define SEC_E_NOT_OWNER ((HRESULT)0x80090306L) -#endif -#ifndef SEC_E_CANNOT_INSTALL -#define SEC_E_CANNOT_INSTALL ((HRESULT)0x80090307L) -#endif -#ifndef SEC_E_INVALID_TOKEN -#define SEC_E_INVALID_TOKEN ((HRESULT)0x80090308L) -#endif -#ifndef SEC_E_CANNOT_PACK -#define SEC_E_CANNOT_PACK ((HRESULT)0x80090309L) -#endif -#ifndef SEC_E_QOP_NOT_SUPPORTED -#define SEC_E_QOP_NOT_SUPPORTED ((HRESULT)0x8009030AL) -#endif -#ifndef SEC_E_NO_IMPERSONATION -#define SEC_E_NO_IMPERSONATION ((HRESULT)0x8009030BL) -#endif -#ifndef SEC_E_LOGON_DENIED -#define SEC_E_LOGON_DENIED ((HRESULT)0x8009030CL) -#endif -#ifndef SEC_E_UNKNOWN_CREDENTIALS -#define SEC_E_UNKNOWN_CREDENTIALS ((HRESULT)0x8009030DL) -#endif -#ifndef SEC_E_NO_CREDENTIALS -#define SEC_E_NO_CREDENTIALS ((HRESULT)0x8009030EL) -#endif -#ifndef SEC_E_MESSAGE_ALTERED -#define SEC_E_MESSAGE_ALTERED ((HRESULT)0x8009030FL) -#endif -#ifndef SEC_E_OUT_OF_SEQUENCE -#define SEC_E_OUT_OF_SEQUENCE ((HRESULT)0x80090310L) -#endif -#ifndef SEC_E_NO_AUTHENTICATING_AUTHORITY -#define SEC_E_NO_AUTHENTICATING_AUTHORITY ((HRESULT)0x80090311L) -#endif -#ifndef SEC_E_BAD_PKGID -#define SEC_E_BAD_PKGID ((HRESULT)0x80090316L) -#endif -#ifndef SEC_E_CONTEXT_EXPIRED -#define SEC_E_CONTEXT_EXPIRED ((HRESULT)0x80090317L) -#endif -#ifndef SEC_E_INCOMPLETE_MESSAGE -#define SEC_E_INCOMPLETE_MESSAGE ((HRESULT)0x80090318L) -#endif -#ifndef SEC_E_INCOMPLETE_CREDENTIALS -#define SEC_E_INCOMPLETE_CREDENTIALS ((HRESULT)0x80090320L) -#endif -#ifndef SEC_E_BUFFER_TOO_SMALL -#define SEC_E_BUFFER_TOO_SMALL ((HRESULT)0x80090321L) -#endif -#ifndef SEC_E_WRONG_PRINCIPAL -#define SEC_E_WRONG_PRINCIPAL ((HRESULT)0x80090322L) -#endif -#ifndef SEC_E_TIME_SKEW -#define SEC_E_TIME_SKEW ((HRESULT)0x80090324L) -#endif -#ifndef SEC_E_UNTRUSTED_ROOT -#define SEC_E_UNTRUSTED_ROOT ((HRESULT)0x80090325L) -#endif -#ifndef SEC_E_ILLEGAL_MESSAGE -#define SEC_E_ILLEGAL_MESSAGE ((HRESULT)0x80090326L) -#endif -#ifndef SEC_E_CERT_UNKNOWN -#define SEC_E_CERT_UNKNOWN ((HRESULT)0x80090327L) -#endif -#ifndef SEC_E_CERT_EXPIRED -#define SEC_E_CERT_EXPIRED ((HRESULT)0x80090328L) -#endif -#ifndef SEC_E_ENCRYPT_FAILURE -#define SEC_E_ENCRYPT_FAILURE ((HRESULT)0x80090329L) -#endif -#ifndef SEC_E_DECRYPT_FAILURE -#define SEC_E_DECRYPT_FAILURE ((HRESULT)0x80090330L) -#endif -#ifndef SEC_E_ALGORITHM_MISMATCH -#define SEC_E_ALGORITHM_MISMATCH ((HRESULT)0x80090331L) -#endif -#ifndef SEC_E_SECURITY_QOS_FAILED -#define SEC_E_SECURITY_QOS_FAILED ((HRESULT)0x80090332L) -#endif -#ifndef SEC_E_UNFINISHED_CONTEXT_DELETED -#define SEC_E_UNFINISHED_CONTEXT_DELETED ((HRESULT)0x80090333L) -#endif -#ifndef SEC_E_NO_TGT_REPLY -#define SEC_E_NO_TGT_REPLY ((HRESULT)0x80090334L) -#endif -#ifndef SEC_E_NO_IP_ADDRESSES -#define SEC_E_NO_IP_ADDRESSES ((HRESULT)0x80090335L) -#endif -#ifndef SEC_E_WRONG_CREDENTIAL_HANDLE -#define SEC_E_WRONG_CREDENTIAL_HANDLE ((HRESULT)0x80090336L) -#endif -#ifndef SEC_E_CRYPTO_SYSTEM_INVALID -#define SEC_E_CRYPTO_SYSTEM_INVALID ((HRESULT)0x80090337L) -#endif -#ifndef SEC_E_MAX_REFERRALS_EXCEEDED -#define SEC_E_MAX_REFERRALS_EXCEEDED ((HRESULT)0x80090338L) -#endif -#ifndef SEC_E_MUST_BE_KDC -#define SEC_E_MUST_BE_KDC ((HRESULT)0x80090339L) -#endif -#ifndef SEC_E_STRONG_CRYPTO_NOT_SUPPORTED -#define SEC_E_STRONG_CRYPTO_NOT_SUPPORTED ((HRESULT)0x8009033AL) -#endif -#ifndef SEC_E_TOO_MANY_PRINCIPALS -#define SEC_E_TOO_MANY_PRINCIPALS ((HRESULT)0x8009033BL) -#endif -#ifndef SEC_E_NO_PA_DATA -#define SEC_E_NO_PA_DATA ((HRESULT)0x8009033CL) -#endif -#ifndef SEC_E_PKINIT_NAME_MISMATCH -#define SEC_E_PKINIT_NAME_MISMATCH ((HRESULT)0x8009033DL) -#endif -#ifndef SEC_E_SMARTCARD_LOGON_REQUIRED -#define SEC_E_SMARTCARD_LOGON_REQUIRED ((HRESULT)0x8009033EL) -#endif -#ifndef SEC_E_SHUTDOWN_IN_PROGRESS -#define SEC_E_SHUTDOWN_IN_PROGRESS ((HRESULT)0x8009033FL) -#endif -#ifndef SEC_E_KDC_INVALID_REQUEST -#define SEC_E_KDC_INVALID_REQUEST ((HRESULT)0x80090340L) -#endif -#ifndef SEC_E_KDC_UNABLE_TO_REFER -#define SEC_E_KDC_UNABLE_TO_REFER ((HRESULT)0x80090341L) -#endif -#ifndef SEC_E_KDC_UNKNOWN_ETYPE -#define SEC_E_KDC_UNKNOWN_ETYPE ((HRESULT)0x80090342L) -#endif -#ifndef SEC_E_UNSUPPORTED_PREAUTH -#define SEC_E_UNSUPPORTED_PREAUTH ((HRESULT)0x80090343L) -#endif -#ifndef SEC_E_DELEGATION_REQUIRED -#define SEC_E_DELEGATION_REQUIRED ((HRESULT)0x80090345L) -#endif -#ifndef SEC_E_BAD_BINDINGS -#define SEC_E_BAD_BINDINGS ((HRESULT)0x80090346L) -#endif -#ifndef SEC_E_MULTIPLE_ACCOUNTS -#define SEC_E_MULTIPLE_ACCOUNTS ((HRESULT)0x80090347L) -#endif -#ifndef SEC_E_NO_KERB_KEY -#define SEC_E_NO_KERB_KEY ((HRESULT)0x80090348L) -#endif -#ifndef SEC_E_CERT_WRONG_USAGE -#define SEC_E_CERT_WRONG_USAGE ((HRESULT)0x80090349L) -#endif -#ifndef SEC_E_DOWNGRADE_DETECTED -#define SEC_E_DOWNGRADE_DETECTED ((HRESULT)0x80090350L) -#endif -#ifndef SEC_E_SMARTCARD_CERT_REVOKED -#define SEC_E_SMARTCARD_CERT_REVOKED ((HRESULT)0x80090351L) -#endif -#ifndef SEC_E_ISSUING_CA_UNTRUSTED -#define SEC_E_ISSUING_CA_UNTRUSTED ((HRESULT)0x80090352L) -#endif -#ifndef SEC_E_REVOCATION_OFFLINE_C -#define SEC_E_REVOCATION_OFFLINE_C ((HRESULT)0x80090353L) -#endif -#ifndef SEC_E_PKINIT_CLIENT_FAILURE -#define SEC_E_PKINIT_CLIENT_FAILURE ((HRESULT)0x80090354L) -#endif -#ifndef SEC_E_SMARTCARD_CERT_EXPIRED -#define SEC_E_SMARTCARD_CERT_EXPIRED ((HRESULT)0x80090355L) -#endif -#ifndef SEC_E_NO_S4U_PROT_SUPPORT -#define SEC_E_NO_S4U_PROT_SUPPORT ((HRESULT)0x80090356L) -#endif -#ifndef SEC_E_CROSSREALM_DELEGATION_FAILURE -#define SEC_E_CROSSREALM_DELEGATION_FAILURE ((HRESULT)0x80090357L) -#endif -#ifndef SEC_E_REVOCATION_OFFLINE_KDC -#define SEC_E_REVOCATION_OFFLINE_KDC ((HRESULT)0x80090358L) -#endif -#ifndef SEC_E_ISSUING_CA_UNTRUSTED_KDC -#define SEC_E_ISSUING_CA_UNTRUSTED_KDC ((HRESULT)0x80090359L) -#endif -#ifndef SEC_E_KDC_CERT_EXPIRED -#define SEC_E_KDC_CERT_EXPIRED ((HRESULT)0x8009035AL) -#endif -#ifndef SEC_E_KDC_CERT_REVOKED -#define SEC_E_KDC_CERT_REVOKED ((HRESULT)0x8009035BL) -#endif -#endif /* __MINGW32CE__ */ /* Offered by mingw-w64 v8+. MS SDK 6.0A+. */ #ifndef SEC_E_INVALID_PARAMETER #define SEC_E_INVALID_PARAMETER ((HRESULT)0x8009035DL) @@ -302,44 +83,11 @@ extern PSecurityFunctionTable Curl_pSecFn; #define SEC_E_POLICY_NLTM_ONLY ((HRESULT)0x8009035FL) #endif -#ifdef __MINGW32CE__ -#ifndef SEC_I_CONTINUE_NEEDED -#define SEC_I_CONTINUE_NEEDED ((HRESULT)0x00090312L) -#endif -#ifndef SEC_I_COMPLETE_NEEDED -#define SEC_I_COMPLETE_NEEDED ((HRESULT)0x00090313L) -#endif -#ifndef SEC_I_COMPLETE_AND_CONTINUE -#define SEC_I_COMPLETE_AND_CONTINUE ((HRESULT)0x00090314L) -#endif -#ifndef SEC_I_LOCAL_LOGON -#define SEC_I_LOCAL_LOGON ((HRESULT)0x00090315L) -#endif -#ifndef SEC_I_CONTEXT_EXPIRED -#define SEC_I_CONTEXT_EXPIRED ((HRESULT)0x00090317L) -#endif -#ifndef SEC_I_INCOMPLETE_CREDENTIALS -#define SEC_I_INCOMPLETE_CREDENTIALS ((HRESULT)0x00090320L) -#endif -#ifndef SEC_I_RENEGOTIATE -#define SEC_I_RENEGOTIATE ((HRESULT)0x00090321L) -#endif -#ifndef SEC_I_NO_LSA_CONTEXT -#define SEC_I_NO_LSA_CONTEXT ((HRESULT)0x00090323L) -#endif -#endif /* __MINGW32CE__ */ - /* Offered by mingw-w64 v8+. MS SDK 6.0A+. */ #ifndef SEC_I_SIGNATURE_NEEDED #define SEC_I_SIGNATURE_NEEDED ((HRESULT)0x0009035CL) #endif -#ifdef __MINGW32CE__ -#ifndef CRYPT_E_NOT_IN_REVOCATION_DATABASE -#define CRYPT_E_NOT_IN_REVOCATION_DATABASE ((HRESULT)0x80092014L) -#endif -#endif /* __MINGW32CE__ */ - /* * Definitions required from ntsecapi.h are directly provided below this point * to avoid including ntsecapi.h due to a conflict with OpenSSL's safestack.h diff --git a/lib/curl_threads.c b/lib/curl_threads.c index 68bfddddcb..a0308f06b2 100644 --- a/lib/curl_threads.c +++ b/lib/curl_threads.c @@ -69,7 +69,7 @@ curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T rc = pthread_create(t, NULL, curl_thread_create_thunk, ac); if(rc) { - CURL_SETERRNO(rc); + errno = rc; goto err; } @@ -109,10 +109,9 @@ curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T if(!t) { DWORD gle = GetLastError(); /* !checksrc! disable ERRNOVAR 1 */ - int err = (gle == ERROR_ACCESS_DENIED || - gle == ERROR_NOT_ENOUGH_MEMORY) ? - EACCES : EINVAL; - CURL_SETERRNO(err); + errno = (gle == ERROR_ACCESS_DENIED || + gle == ERROR_NOT_ENOUGH_MEMORY) ? + EACCES : EINVAL; return curl_thread_t_null; } return t; @@ -128,11 +127,7 @@ void Curl_thread_destroy(curl_thread_t *hnd) int Curl_thread_join(curl_thread_t *hnd) { -#ifdef UNDER_CE - int ret = (WaitForSingleObject(*hnd, INFINITE) == WAIT_OBJECT_0); -#else int ret = (WaitForSingleObjectEx(*hnd, INFINITE, FALSE) == WAIT_OBJECT_0); -#endif Curl_thread_destroy(hnd); diff --git a/lib/curlx/fopen.c b/lib/curlx/fopen.c index cc164c8c29..a5311874b8 100644 --- a/lib/curlx/fopen.c +++ b/lib/curlx/fopen.c @@ -47,7 +47,7 @@ int curlx_fseek(void *stream, curl_off_t offset, int whence) #endif } -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 #include "multibyte.h" @@ -142,7 +142,7 @@ static bool fix_excessive_path(const TCHAR *in, TCHAR **out) else if(!wcsncmp(fbuf, L"\\\\.\\", 4)) fbuf[2] = '?'; else if(!wcsncmp(fbuf, L"\\\\.", 3) || !wcsncmp(fbuf, L"\\\\?", 3)) { - /* Unexpected, not UNC. The formatting doc doesn't allow this AFAICT. */ + /* Unexpected, not UNC. The formatting doc does not allow this AFAICT. */ goto cleanup; } else { @@ -235,7 +235,7 @@ int curlx_win32_open(const char *filename, int oflag, ...) } else /* !checksrc! disable ERRNOVAR 1 */ - CURL_SETERRNO(EINVAL); + errno = EINVAL; #else if(fix_excessive_path(filename, &fixed)) target = fixed; @@ -266,7 +266,7 @@ FILE *curlx_win32_fopen(const char *filename, const char *mode) } else /* !checksrc! disable ERRNOVAR 1 */ - CURL_SETERRNO(EINVAL); + errno = EINVAL; curlx_unicodefree(filename_w); curlx_unicodefree(mode_w); #else @@ -304,7 +304,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer) } else /* !checksrc! disable ERRNOVAR 1 */ - CURL_SETERRNO(EINVAL); + errno = EINVAL; #else if(fix_excessive_path(path, &fixed)) target = fixed; @@ -321,4 +321,4 @@ int curlx_win32_stat(const char *path, struct_stat *buffer) return result; } -#endif /* _WIN32 && !UNDER_CE */ +#endif /* _WIN32 */ diff --git a/lib/curlx/fopen.h b/lib/curlx/fopen.h index 51f4dbca17..da9eb55ec9 100644 --- a/lib/curlx/fopen.h +++ b/lib/curlx/fopen.h @@ -34,7 +34,7 @@ int curlx_fseek(void *stream, curl_off_t offset, int whence); -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 FILE *curlx_win32_fopen(const char *filename, const char *mode); int curlx_win32_stat(const char *path, struct_stat *buffer); int curlx_win32_open(const char *filename, int oflag, ...); diff --git a/lib/curlx/inet_ntop.c b/lib/curlx/inet_ntop.c index 884cfb79c2..d4053f1a60 100644 --- a/lib/curlx/inet_ntop.c +++ b/lib/curlx/inet_ntop.c @@ -72,9 +72,9 @@ static char *inet_ntop4(const unsigned char *src, char *dst, size_t size) len = strlen(tmp); if(len == 0 || len >= size) { #ifdef USE_WINSOCK - CURL_SETERRNO(WSAEINVAL); + errno = WSAEINVAL; #else - CURL_SETERRNO(ENOSPC); + errno = ENOSPC; #endif return NULL; } @@ -160,7 +160,7 @@ static char *inet_ntop6(const unsigned char *src, char *dst, size_t size) break; } else { - /* Lower-case digits. Can't use the set from mprintf.c since this + /* Lower-case digits. Cannot use the set from mprintf.c since this needs to work as a curlx function */ static const unsigned char ldigits[] = "0123456789abcdef"; @@ -186,9 +186,9 @@ static char *inet_ntop6(const unsigned char *src, char *dst, size_t size) */ if((size_t)(tp - tmp) > size) { #ifdef USE_WINSOCK - CURL_SETERRNO(WSAEINVAL); + errno = WSAEINVAL; #else - CURL_SETERRNO(ENOSPC); + errno = ENOSPC; #endif return NULL; } @@ -215,7 +215,7 @@ char *curlx_inet_ntop(int af, const void *src, char *buf, size_t size) case AF_INET6: return inet_ntop6((const unsigned char *)src, buf, size); default: - CURL_SETERRNO(SOCKEAFNOSUPPORT); + errno = SOCKEAFNOSUPPORT; return NULL; } } diff --git a/lib/curlx/inet_pton.c b/lib/curlx/inet_pton.c index d2b39ae9f1..b78fa5d746 100644 --- a/lib/curlx/inet_pton.c +++ b/lib/curlx/inet_pton.c @@ -82,7 +82,7 @@ curlx_inet_pton(int af, const char *src, void *dst) case AF_INET6: return inet_pton6(src, (unsigned char *)dst); default: - CURL_SETERRNO(SOCKEAFNOSUPPORT); + errno = SOCKEAFNOSUPPORT; return -1; } /* NOTREACHED */ diff --git a/lib/curlx/strerr.c b/lib/curlx/strerr.c index e5227554e5..047588ed18 100644 --- a/lib/curlx/strerr.c +++ b/lib/curlx/strerr.c @@ -287,13 +287,10 @@ const char *curlx_strerror(int err, char *buf, size_t buflen) *buf = '\0'; #ifdef _WIN32 -#ifndef UNDER_CE /* 'sys_nerr' is the maximum errno number, it is not widely portable */ if(err >= 0 && err < sys_nerr) SNPRINTF(buf, buflen, "%s", sys_errlist[err]); - else -#endif - { + else { if( #ifdef USE_WINSOCK !get_winsock_error(err, buf, buflen) && @@ -350,7 +347,7 @@ const char *curlx_strerror(int err, char *buf, size_t buflen) *p = '\0'; if(errno != old_errno) - CURL_SETERRNO(old_errno); + errno = old_errno; #ifdef _WIN32 if(old_win_err != GetLastError()) diff --git a/lib/curlx/version_win32.c b/lib/curlx/version_win32.c index 7e415dfe89..cc86b71d3e 100644 --- a/lib/curlx/version_win32.c +++ b/lib/curlx/version_win32.c @@ -111,12 +111,6 @@ bool curlx_verify_windows_version(const unsigned int majorVersion, /* we are always running on PLATFORM_WINNT */ matched = FALSE; } -#elif defined(UNDER_CE) - (void)majorVersion; - (void)minorVersion; - (void)buildVersion; - (void)platform; - (void)condition; #else ULONGLONG cm = 0; struct OUR_OSVERSIONINFOEXW osver; @@ -139,7 +133,7 @@ bool curlx_verify_windows_version(const unsigned int majorVersion, #pragma clang diagnostic ignored "-Wcast-function-type-strict" #endif pRtlVerifyVersionInfo = CURLX_FUNCTION_CAST(RTLVERIFYVERSIONINFO_FN, - GetProcAddress(GetModuleHandleA("ntdll"), "RtlVerifyVersionInfo")); + GetProcAddress(GetModuleHandle(TEXT("ntdll")), "RtlVerifyVersionInfo")); #if defined(__clang__) && __clang_major__ >= 16 #pragma clang diagnostic pop #endif diff --git a/lib/curlx/winapi.c b/lib/curlx/winapi.c index de1218cec7..2dc277c1c1 100644 --- a/lib/curlx/winapi.c +++ b/lib/curlx/winapi.c @@ -61,8 +61,7 @@ const char *curlx_get_winapi_error(DWORD err, char *buf, size_t buflen) /* We return the local codepage version of the error string because if it is output to the user's terminal it will likely be with functions which - expect the local codepage (eg fprintf, failf, infof). - FormatMessageW -> wcstombs is used for Windows CE compatibility. */ + expect the local codepage (eg fprintf, failf, infof). */ if(FormatMessageW((FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err, LANG_NEUTRAL, wbuf, CURL_ARRAYSIZE(wbuf), NULL)) { @@ -118,7 +117,7 @@ const char *curlx_winapi_strerror(DWORD err, char *buf, size_t buflen) #endif if(errno != old_errno) - CURL_SETERRNO(old_errno); + errno = old_errno; if(old_win_err != GetLastError()) SetLastError(old_win_err); diff --git a/lib/dllmain.c b/lib/dllmain.c index d871a52484..011090589b 100644 --- a/lib/dllmain.c +++ b/lib/dllmain.c @@ -37,7 +37,7 @@ #if defined(USE_OPENSSL) && \ !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC) && \ - !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L + !defined(LIBRESSL_VERSION_NUMBER) #define PREVENT_OPENSSL_MEMLEAK #endif diff --git a/lib/easy.c b/lib/easy.c index c5ccc5b1e6..54896a8d55 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -106,12 +106,10 @@ static curl_simple_lock s_lock = CURL_SIMPLE_LOCK_INIT; * ways, but at this point it must be defined as the system-supplied strdup * so the callback pointer is initialized correctly. */ -#ifdef UNDER_CE -#define system_strdup _strdup -#elif !defined(HAVE_STRDUP) -#define system_strdup Curl_strdup -#else +#ifdef HAVE_STRDUP #define system_strdup strdup +#else +#define system_strdup Curl_strdup #endif #if defined(_MSC_VER) && defined(_DLL) diff --git a/lib/fake_addrinfo.c b/lib/fake_addrinfo.c index 80edf78648..9789d1ef62 100644 --- a/lib/fake_addrinfo.c +++ b/lib/fake_addrinfo.c @@ -180,7 +180,7 @@ int r_getaddrinfo(const char *node, curl_mfprintf(stderr, "ares_set_servers_ports_csv failed: %d", rc); /* Cleanup */ ares_destroy(channel); - return EAI_MEMORY; /* we can't run */ + return EAI_MEMORY; /* we cannot run */ } } } diff --git a/lib/file.c b/lib/file.c index f45a487c90..5fff5d0a82 100644 --- a/lib/file.c +++ b/lib/file.c @@ -275,7 +275,7 @@ static CURLcode file_connect(struct Curl_easy *data, bool *done) file->fd = fd; if(!data->state.upload && (fd == -1)) { - failf(data, "Couldn't open file %s", data->state.up.path); + failf(data, "Could not open file %s", data->state.up.path); file_done(data, CURLE_FILE_COULDNT_READ_FILE, FALSE); return CURLE_FILE_COULDNT_READ_FILE; } @@ -572,7 +572,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done) if(data->state.resume_from) { if(!S_ISDIR(statbuf.st_mode)) { -#if defined(__AMIGA__) || defined(__MINGW32CE__) +#ifdef __AMIGA__ if(data->state.resume_from != lseek(fd, (off_t)data->state.resume_from, SEEK_SET)) #else diff --git a/lib/ftp.c b/lib/ftp.c index ca6b9497b2..bcf4b809cc 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1867,7 +1867,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, } if(!*str) { - failf(data, "Couldn't interpret the 227-response"); + failf(data, "Could not interpret the 227-response"); return CURLE_FTP_WEIRD_227_FORMAT; } @@ -2202,7 +2202,7 @@ static CURLcode ftp_state_type_resp(struct Curl_easy *data, /* "sasserftpd" and "(u)r(x)bot ftpd" both responds with 226 after a successful 'TYPE I'. While that is not as RFC959 says, it is still a positive response code and we allow that. */ - failf(data, "Couldn't set desired mode"); + failf(data, "Could not set desired mode"); return CURLE_FTP_COULDNT_SET_TYPE; } if(ftpcode != 200) @@ -2392,7 +2392,7 @@ static CURLcode ftp_state_rest_resp(struct Curl_easy *data, case FTP_RETR_REST: if(ftpcode != 350) { - failf(data, "Couldn't use REST"); + failf(data, "Could not use REST"); result = CURLE_FTP_COULDNT_USE_REST; } else { @@ -2537,7 +2537,7 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data, } else { if((instate == FTP_LIST) && (ftpcode == 450)) { - /* simply no matching files in the dir listing */ + /* simply no matching files in the directory listing */ ftp->transfer = PPTRANSFER_NONE; /* do not download anything */ ftp_state(data, ftpc, FTP_STOP); /* this phase is over */ } @@ -3052,7 +3052,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data, case FTP_MKD: if((ftpcode/100 != 2) && !ftpc->count3--) { - /* failure to MKD the dir */ + /* failure to MKD the directory */ failf(data, "Failed to MKD dir: %03d", ftpcode); result = CURLE_REMOTE_ACCESS_DENIED; } @@ -3306,15 +3306,11 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status, } } if(ftpc->prevpath) - infof(data, "Remembering we are in dir \"%s\"", ftpc->prevpath); + infof(data, "Remembering we are in directory \"%s\"", ftpc->prevpath); } /* shut down the socket to inform the server we are done */ -#ifdef UNDER_CE - shutdown(conn->sock[SECONDARYSOCKET], 2); /* SD_BOTH */ -#endif - if(Curl_conn_is_setup(conn, SECONDARYSOCKET)) { if(!result && ftpc->dont_check && data->req.maxdownload > 0) { /* partial download completed */ @@ -4192,7 +4188,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data, ftpc->dirs[0].start = 0; ftpc->dirs[0].len = (int)dirlen; - ftpc->dirdepth = 1; /* we consider it to be a single dir */ + ftpc->dirdepth = 1; /* we consider it to be a single directory */ fileName = slashPos + 1; /* rest is filename */ } else @@ -4208,7 +4204,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data, size_t dirAlloc = numof_slashes(rawPath); if(dirAlloc >= FTP_MAX_DIR_DEPTH) - /* suspiciously deep dir hierarchy */ + /* suspiciously deep directory hierarchy */ return CURLE_URL_MALFORMAT; if(dirAlloc) { diff --git a/lib/ftp.h b/lib/ftp.h index 8d5f9c2031..f4ddb1a37c 100644 --- a/lib/ftp.h +++ b/lib/ftp.h @@ -61,11 +61,11 @@ enum { FTP_STOR_PREQUOTE, FTP_LIST_PREQUOTE, FTP_POSTQUOTE, - FTP_CWD, /* change dir */ - FTP_MKD, /* if the dir did not exist */ + FTP_CWD, /* change directory */ + FTP_MKD, /* if the directory did not exist */ FTP_MDTM, /* to figure out the datestamp */ FTP_TYPE, /* to set type when doing a head-like request */ - FTP_LIST_TYPE, /* set type when about to do a dir list */ + FTP_LIST_TYPE, /* set type when about to do a directory list */ FTP_RETR_LIST_TYPE, FTP_RETR_TYPE, /* set type when about to RETR a file */ FTP_STOR_TYPE, /* set type when about to STOR a file */ diff --git a/lib/getenv.c b/lib/getenv.c index 3bfcf707a4..a2d8056fcc 100644 --- a/lib/getenv.c +++ b/lib/getenv.c @@ -31,7 +31,7 @@ static char *GetEnv(const char *variable) { -#if defined(CURL_WINDOWS_UWP) || defined(UNDER_CE) || \ +#if defined(CURL_WINDOWS_UWP) || \ defined(__ORBIS__) || defined(__PROSPERO__) /* PlayStation 4 and 5 */ (void)variable; return NULL; diff --git a/lib/getinfo.c b/lib/getinfo.c index f57a454d5d..6a16258b13 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -204,31 +204,31 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info, } lptr; #ifdef DEBUGBUILD - const char *timestr = getenv("CURL_TIME"); - if(timestr) { - curl_off_t val; - curlx_str_number(×tr, &val, TIME_T_MAX); - switch(info) { - case CURLINFO_LOCAL_PORT: - *param_longp = (long)val; - return CURLE_OK; - default: - break; - } - } + const char *envstr; + /* use another variable for this to allow different values */ - timestr = getenv("CURL_DEBUG_SIZE"); - if(timestr) { - curl_off_t val; - curlx_str_number(×tr, &val, LONG_MAX); - switch(info) { - case CURLINFO_HEADER_SIZE: - case CURLINFO_REQUEST_SIZE: + switch(info) { + case CURLINFO_LOCAL_PORT: + envstr = getenv("CURL_TIME"); + if(envstr) { + curl_off_t val; + curlx_str_number(&envstr, &val, TIME_T_MAX); *param_longp = (long)val; return CURLE_OK; - default: - break; } + break; + case CURLINFO_HEADER_SIZE: + case CURLINFO_REQUEST_SIZE: + envstr = getenv("CURL_DEBUG_SIZE"); + if(envstr) { + curl_off_t val; + curlx_str_number(&envstr, &val, LONG_MAX); + *param_longp = (long)val; + return CURLE_OK; + } + break; + default: + break; } #endif @@ -381,28 +381,29 @@ static CURLcode getinfo_offt(struct Curl_easy *data, CURLINFO info, curl_off_t *param_offt) { #ifdef DEBUGBUILD - const char *timestr = getenv("CURL_TIME"); - if(timestr) { - curl_off_t val; - curlx_str_number(×tr, &val, CURL_OFF_T_MAX); - - switch(info) { - case CURLINFO_TOTAL_TIME_T: - case CURLINFO_NAMELOOKUP_TIME_T: - case CURLINFO_CONNECT_TIME_T: - case CURLINFO_APPCONNECT_TIME_T: - case CURLINFO_PRETRANSFER_TIME_T: - case CURLINFO_POSTTRANSFER_TIME_T: - case CURLINFO_QUEUE_TIME_T: - case CURLINFO_STARTTRANSFER_TIME_T: - case CURLINFO_REDIRECT_TIME_T: - case CURLINFO_SPEED_DOWNLOAD_T: - case CURLINFO_SPEED_UPLOAD_T: + const char *envstr; + switch(info) { + case CURLINFO_TOTAL_TIME_T: + case CURLINFO_NAMELOOKUP_TIME_T: + case CURLINFO_CONNECT_TIME_T: + case CURLINFO_APPCONNECT_TIME_T: + case CURLINFO_PRETRANSFER_TIME_T: + case CURLINFO_POSTTRANSFER_TIME_T: + case CURLINFO_QUEUE_TIME_T: + case CURLINFO_STARTTRANSFER_TIME_T: + case CURLINFO_REDIRECT_TIME_T: + case CURLINFO_SPEED_DOWNLOAD_T: + case CURLINFO_SPEED_UPLOAD_T: + envstr = getenv("CURL_TIME"); + if(envstr) { + curl_off_t val; + curlx_str_number(&envstr, &val, CURL_OFF_T_MAX); *param_offt = (curl_off_t)val; return CURLE_OK; - default: - break; } + break; + default: + break; } #endif switch(info) { @@ -480,26 +481,28 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info, double *param_doublep) { #ifdef DEBUGBUILD - const char *timestr = getenv("CURL_TIME"); - if(timestr) { - curl_off_t val; - curlx_str_number(×tr, &val, CURL_OFF_T_MAX); + const char *envstr; - switch(info) { - case CURLINFO_TOTAL_TIME: - case CURLINFO_NAMELOOKUP_TIME: - case CURLINFO_CONNECT_TIME: - case CURLINFO_APPCONNECT_TIME: - case CURLINFO_PRETRANSFER_TIME: - case CURLINFO_STARTTRANSFER_TIME: - case CURLINFO_REDIRECT_TIME: - case CURLINFO_SPEED_DOWNLOAD: - case CURLINFO_SPEED_UPLOAD: + switch(info) { + case CURLINFO_TOTAL_TIME: + case CURLINFO_NAMELOOKUP_TIME: + case CURLINFO_CONNECT_TIME: + case CURLINFO_APPCONNECT_TIME: + case CURLINFO_PRETRANSFER_TIME: + case CURLINFO_STARTTRANSFER_TIME: + case CURLINFO_REDIRECT_TIME: + case CURLINFO_SPEED_DOWNLOAD: + case CURLINFO_SPEED_UPLOAD: + envstr = getenv("CURL_TIME"); + if(envstr) { + curl_off_t val; + curlx_str_number(&envstr, &val, CURL_OFF_T_MAX); *param_doublep = (double)val; return CURLE_OK; - default: - break; } + break; + default: + break; } #endif switch(info) { diff --git a/lib/headers.c b/lib/headers.c index 5a57257113..feb52e087d 100644 --- a/lib/headers.c +++ b/lib/headers.c @@ -51,7 +51,7 @@ static void copy_header_external(struct Curl_header_store *hs, h->index = index; /* this will randomly OR a reserved bit for the sole purpose of making it impossible for applications to do == comparisons, as that would otherwise - be very tempting and then lead to the reserved bits not being reserved + be tempting and then lead to the reserved bits not being reserved anymore. */ h->origin = (unsigned int)(hs->type | (1 << 27)); h->anchor = e; diff --git a/lib/hostip.c b/lib/hostip.c index ef000aab69..48889dcb43 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -42,9 +42,7 @@ #endif #include -#ifndef UNDER_CE #include -#endif #include "urldata.h" #include "sendf.h" @@ -956,7 +954,7 @@ out: /* we got a response, create a dns entry, add to cache, return */ dns = Curl_dnscache_mk_entry(data, addr, hostname, 0, port, FALSE); if(!dns || Curl_dnscache_add(data, dns)) { - /* this is OOM or similar, don't store such negative resolves */ + /* this is OOM or similar, do not store such negative resolves */ keep_negative = FALSE; goto error; } @@ -1393,7 +1391,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) error = FALSE; err: if(error) { - failf(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'", + failf(data, "Could not parse CURLOPT_RESOLVE entry '%s'", hostp->data); Curl_freeaddrinfo(head); return CURLE_SETOPT_OPTION_SYNTAX; diff --git a/lib/hsts.c b/lib/hsts.c index 4e41155f30..437851b8ba 100644 --- a/lib/hsts.c +++ b/lib/hsts.c @@ -277,7 +277,7 @@ struct stsentry *Curl_hsts(struct hsts *h, const char *hostname, blen = ntail; } } - /* avoid curl_strequal because the host name is not null-terminated */ + /* avoid curl_strequal because the hostname is not null-terminated */ if((hlen == ntail) && curl_strnequal(hostname, sts->host, hlen)) return sts; } diff --git a/lib/http.c b/lib/http.c index f3444d46a9..aa921fd602 100644 --- a/lib/http.c +++ b/lib/http.c @@ -504,7 +504,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data, return CURLE_OK; if(abort_upload) { - /* We'd like to abort the upload - but should we? */ + /* We would like to abort the upload - but should we? */ #ifdef USE_NTLM if((data->state.authproxy.picked == CURLAUTH_NTLM) || (data->state.authhost.picked == CURLAUTH_NTLM)) { @@ -1716,7 +1716,7 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data, curlx_str_untilnl(&p, &val, MAX_HTTP_RESP_HEADER_SIZE); curlx_str_trimblanks(&val); if(!curlx_strlen(&val)) - /* no content, don't send this */ + /* no content, do not send this */ continue; } else @@ -2404,7 +2404,7 @@ static CURLcode http_add_content_hds(struct Curl_easy *data, (data->req.authneg || !Curl_checkheaders(data, STRCONST("Content-Length")))) { /* we allow replacing this header if not during auth negotiation, - although it is not very wise to actually set your own */ + although it is not wise to actually set your own */ result = curlx_dyn_addf(r, "Content-Length: %" FMT_OFF_T "\r\n", req_clen); } @@ -4018,7 +4018,7 @@ static CURLcode http_on_response(struct Curl_easy *data, * * The check for close above is done simply because of something * else has already deemed the connection to get closed then - * something else should've considered the big picture and we + * something else should have considered the big picture and we * avoid this check. * */ @@ -4187,7 +4187,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data, k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 + (p[2] - '0'); /* RFC 9112 requires a single space following the status code, - but the browsers don't so let's not insist */ + but the browsers do not so let's not insist */ fine_statusline = TRUE; } } @@ -4558,12 +4558,12 @@ out: static CURLcode req_assign_url_authority(struct httpreq *req, CURLU *url) { - char *user, *pass, *host, *port; + char *host, *port; struct dynbuf buf; CURLUcode uc; CURLcode result = CURLE_URL_MALFORMAT; - user = pass = host = port = NULL; + host = port = NULL; curlx_dyn_init(&buf, DYN_HTTP_REQUEST); uc = curl_url_get(url, CURLUPART_HOST, &host, 0); @@ -4578,28 +4578,7 @@ static CURLcode req_assign_url_authority(struct httpreq *req, CURLU *url) uc = curl_url_get(url, CURLUPART_PORT, &port, CURLU_NO_DEFAULT_PORT); if(uc && uc != CURLUE_NO_PORT) goto out; - uc = curl_url_get(url, CURLUPART_USER, &user, 0); - if(uc && uc != CURLUE_NO_USER) - goto out; - if(user) { - uc = curl_url_get(url, CURLUPART_PASSWORD, &pass, 0); - if(uc && uc != CURLUE_NO_PASSWORD) - goto out; - } - if(user) { - result = curlx_dyn_add(&buf, user); - if(result) - goto out; - if(pass) { - result = curlx_dyn_addf(&buf, ":%s", pass); - if(result) - goto out; - } - result = curlx_dyn_add(&buf, "@"); - if(result) - goto out; - } result = curlx_dyn_add(&buf, host); if(result) goto out; @@ -4614,8 +4593,6 @@ static CURLcode req_assign_url_authority(struct httpreq *req, CURLU *url) result = CURLE_OK; out: - free(user); - free(pass); free(host); free(port); curlx_dyn_free(&buf); diff --git a/lib/http1.c b/lib/http1.c index 0403e95ba2..c487597e34 100644 --- a/lib/http1.c +++ b/lib/http1.c @@ -134,7 +134,9 @@ static ssize_t next_line(struct h1_req_parser *parser, } static CURLcode start_req(struct h1_req_parser *parser, - const char *scheme_default, int options) + const char *scheme_default, + const char *custom_method, + int options) { const char *p, *m, *target, *hv, *scheme, *authority, *path; size_t m_len, target_len, hv_len, scheme_len, authority_len, path_len; @@ -144,9 +146,15 @@ static CURLcode start_req(struct h1_req_parser *parser, DEBUGASSERT(!parser->req); /* line must match: "METHOD TARGET HTTP_VERSION" */ - p = memchr(parser->line, ' ', parser->line_len); - if(!p || p == parser->line) - goto out; + if(custom_method && custom_method[0] && + !strncmp(custom_method, parser->line, strlen(custom_method))) { + p = parser->line + strlen(custom_method); + } + else { + p = memchr(parser->line, ' ', parser->line_len); + if(!p || p == parser->line) + goto out; + } m = parser->line; m_len = p - parser->line; @@ -258,8 +266,9 @@ out: ssize_t Curl_h1_req_parse_read(struct h1_req_parser *parser, const char *buf, size_t buflen, - const char *scheme_default, int options, - CURLcode *err) + const char *scheme_default, + const char *custom_method, + int options, CURLcode *err) { ssize_t nread = 0, n; @@ -285,7 +294,7 @@ ssize_t Curl_h1_req_parse_read(struct h1_req_parser *parser, goto out; } else if(!parser->req) { - *err = start_req(parser, scheme_default, options); + *err = start_req(parser, scheme_default, custom_method, options); if(*err) { nread = -1; goto out; diff --git a/lib/http1.h b/lib/http1.h index b38b32f591..94b5a44e31 100644 --- a/lib/http1.h +++ b/lib/http1.h @@ -50,8 +50,9 @@ void Curl_h1_req_parse_free(struct h1_req_parser *parser); ssize_t Curl_h1_req_parse_read(struct h1_req_parser *parser, const char *buf, size_t buflen, - const char *scheme_default, int options, - CURLcode *err); + const char *scheme_default, + const char *custom_method, + int options, CURLcode *err); CURLcode Curl_h1_req_dprint(const struct httpreq *req, struct dynbuf *dbuf); diff --git a/lib/http2.c b/lib/http2.c index 68446d5177..1565e0b9ea 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -506,7 +506,7 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf, rc = nghttp2_session_callbacks_new(&cbs); if(rc) { - failf(data, "Couldn't initialize nghttp2 callbacks"); + failf(data, "Could not initialize nghttp2 callbacks"); goto out; } @@ -530,7 +530,7 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf, /* The nghttp2 session is not yet setup, do it */ rc = h2_client_new(cf, cbs); if(rc) { - failf(data, "Couldn't initialize nghttp2"); + failf(data, "Could not initialize nghttp2"); goto out; } ctx->max_concurrent_streams = DEFAULT_MAX_CONCURRENT_STREAMS; @@ -972,7 +972,7 @@ static int push_promise(struct Curl_cfilter *cf, rv = set_transfer_url(newhandle, &heads); if(rv) { - CURL_TRC_CF(data, cf, "[%d] PUSH_PROMISE, failed to set url -> %d", + CURL_TRC_CF(data, cf, "[%d] PUSH_PROMISE, failed to set URL -> %d", frame->promised_stream_id, rv); discard_newhandle(cf, newhandle); rv = CURL_PUSH_DENY; @@ -2248,7 +2248,10 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream, if(result) goto out; - rc = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, &result); + rc = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, + !data->state.http_ignorecustom ? + data->set.str[STRING_CUSTOMREQUEST] : NULL, + 0, &result); if(!curlx_sztouz(rc, &nwritten)) goto out; *pnwritten = nwritten; diff --git a/lib/http_aws_sigv4.c b/lib/http_aws_sigv4.c index b5601f45a2..d3d4760be7 100644 --- a/lib/http_aws_sigv4.c +++ b/lib/http_aws_sigv4.c @@ -1141,10 +1141,10 @@ static CURLcode http_aws_decode_encode(const char *in, size_t in_len, static bool should_urlencode(struct Curl_str *service_name) { /* - * These services require unmodified (not additionally url encoded) URL + * These services require unmodified (not additionally URL-encoded) URL * paths. * should_urlencode == true is equivalent to should_urlencode_uri_path - * from the AWS SDK. Urls are already normalized by the curl url parser + * from the AWS SDK. Urls are already normalized by the curl URL parser */ if(curlx_str_cmp(service_name, "s3") || diff --git a/lib/md4.c b/lib/md4.c index d86a24628c..0cc62f8152 100644 --- a/lib/md4.c +++ b/lib/md4.c @@ -133,12 +133,7 @@ static int MD4_Init(MD4_CTX *ctx) static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size) { -#ifdef __MINGW32CE__ - CryptHashData(ctx->hHash, (BYTE *)CURL_UNCONST(data), - (unsigned int) size, 0); -#else CryptHashData(ctx->hHash, (const BYTE *)data, (unsigned int) size, 0); -#endif } static void MD4_Final(unsigned char *result, MD4_CTX *ctx) diff --git a/lib/md5.c b/lib/md5.c index d99554a4aa..4b38bb070b 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -240,11 +240,7 @@ static void my_md5_update(void *in, unsigned int inputLen) { my_md5_ctx *ctx = in; -#ifdef __MINGW32CE__ - CryptHashData(ctx->hHash, (BYTE *)CURL_UNCONST(input), inputLen, 0); -#else CryptHashData(ctx->hHash, (const BYTE *)input, inputLen, 0); -#endif } static void my_md5_final(unsigned char *digest, void *in) diff --git a/lib/memdebug.c b/lib/memdebug.c index 7ded52c1e9..11e924a55b 100644 --- a/lib/memdebug.c +++ b/lib/memdebug.c @@ -117,7 +117,7 @@ static bool countcheck(const char *func, int line, const char *source) source, line, func); fflush(curl_dbg_logfile); /* because it might crash now */ /* !checksrc! disable ERRNOVAR 1 */ - CURL_SETERRNO(ENOMEM); + errno = ENOMEM; return TRUE; /* RETURN ERROR! */ } else diff --git a/lib/multi.c b/lib/multi.c index a47336457b..c52ee54c77 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -1038,7 +1038,7 @@ CURLMcode Curl_multi_pollset(struct Curl_easy *data, case MSTATE_RESOLVING: result = Curl_resolv_pollset(data, ps); - /* connection filters are not involved in this phase. It's ok if we get no + /* connection filters are not involved in this phase. It is OK if we get no * sockets to wait for. Resolving can wake up from other sources. */ expect_sockets = FALSE; break; diff --git a/lib/multi_ev.c b/lib/multi_ev.c index ff755caa6a..f5000a4562 100644 --- a/lib/multi_ev.c +++ b/lib/multi_ev.c @@ -340,7 +340,7 @@ static CURLMcode mev_pollset_diff(struct Curl_multi *multi, /* What was the previous action the transfer had regarding this socket? * If the transfer is new to the socket, disregard the information * in `last_poll`, because the socket might have been destroyed and - * reopened. We'd have cleared the sh_entry for that, but the socket + * reopened. We would have cleared the sh_entry for that, but the socket * might still be mentioned in the hashed pollsets. */ last_action = 0; if(first_time) { diff --git a/lib/parsedate.c b/lib/parsedate.c index 3fa5919c05..2c3eb67fd2 100644 --- a/lib/parsedate.c +++ b/lib/parsedate.c @@ -286,7 +286,7 @@ enum assume { static time_t time2epoch(int sec, int min, int hour, int mday, int mon, int year) { - static const int month_days_cumulative [12] = + static const int month_days_cumulative[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; int leap_days = year - (mon <= 1); leap_days = ((leap_days / 4) - (leap_days / 100) + (leap_days / 400) diff --git a/lib/pop3.c b/lib/pop3.c index affd64276c..d469dc0766 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -1742,9 +1742,8 @@ static CURLcode pop3_write(struct Curl_easy *data, const char *str, /* Did we have a partial match which has subsequently failed? */ if(prev && prev >= pop3c->eob) { - /* Strip can only be non-zero for the very first mismatch after CRLF - and then both prev and strip are equal and nothing will be output - below */ + /* Strip can only be non-zero for the first mismatch after CRLF and + then both prev and strip are equal and nothing will be output below */ while(prev && pop3c->strip) { prev--; pop3c->strip--; diff --git a/lib/progress.c b/lib/progress.c index 02841544dd..228f5dc197 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -280,7 +280,7 @@ timediff_t Curl_pgrsLimitWaitTime(struct pgrs_dir *d, should_ms = (timediff_t) (1000 * bytes / bytes_per_sec); } else { - /* very large `bytes`, first calc the seconds it should have taken. + /* large `bytes`, first calc the seconds it should have taken. * if that is small enough, convert to milliseconds. */ should_ms = (timediff_t) (bytes / bytes_per_sec); if(should_ms < TIMEDIFF_T_MAX/1000) diff --git a/lib/rand.c b/lib/rand.c index cbfcbf2740..5eace02833 100644 --- a/lib/rand.c +++ b/lib/rand.c @@ -50,10 +50,6 @@ # include # ifdef _MSC_VER # pragma comment(lib, "bcrypt.lib") -# endif - /* Offered by mingw-w64 v3+. MS SDK v7.0A+. */ -# ifndef BCRYPT_USE_SYSTEM_PREFERRED_RNG -# define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002 # endif # ifndef STATUS_SUCCESS # define STATUS_SUCCESS ((NTSTATUS)0x00000000L) diff --git a/lib/rename.c b/lib/rename.c index 225811e65a..911afca575 100644 --- a/lib/rename.c +++ b/lib/rename.c @@ -39,7 +39,7 @@ /* return 0 on success, 1 on error */ int Curl_rename(const char *oldpath, const char *newpath) { -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 /* rename() on Windows does not overwrite, so we cannot use it here. MoveFileEx() will overwrite and is usually atomic, however it fails when there are open handles to the file. */ diff --git a/lib/sha256.c b/lib/sha256.c index f7bb545613..3e3205e36b 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -214,11 +214,7 @@ static void my_sha256_update(void *in, unsigned int length) { my_sha256_ctx *ctx = (my_sha256_ctx *)in; -#ifdef __MINGW32CE__ - CryptHashData(ctx->hHash, (BYTE *)CURL_UNCONST(data), length, 0); -#else CryptHashData(ctx->hHash, (const BYTE *)data, length, 0); -#endif } static void my_sha256_final(unsigned char *digest, void *in) diff --git a/lib/socks.c b/lib/socks.c index 5185913a24..3434030c83 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -308,7 +308,7 @@ static CURLproxycode socks4_req_add_user(struct socks_state *sx, return CURLPX_SEND_REQUEST; } else { - /* empty user name */ + /* empty username */ unsigned char b = 0; result = Curl_bufq_write(&sx->iobuf, &b, 1, &nwritten); if(result || (nwritten != 1)) diff --git a/lib/speedcheck.c b/lib/speedcheck.c index 3b128655f5..aede060019 100644 --- a/lib/speedcheck.c +++ b/lib/speedcheck.c @@ -49,7 +49,7 @@ CURLcode Curl_speedcheck(struct Curl_easy *data, if((data->progress.current_speed >= 0) && data->set.low_speed_time) { if(data->progress.current_speed < data->set.low_speed_limit) { if(!data->state.keeps_speed.tv_sec) - /* under the limit at this very moment */ + /* under the limit at this moment */ data->state.keeps_speed = now; else { /* how long has it been under the limit */ diff --git a/lib/strerror.c b/lib/strerror.c index 5b82d7f965..afe69756bc 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -679,7 +679,7 @@ const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen) #endif if(errno != old_errno) - CURL_SETERRNO(old_errno); + errno = old_errno; #ifdef _WIN32 if(old_win_err != GetLastError()) diff --git a/lib/system_win32.c b/lib/system_win32.c index cd01fd2ebf..bdbed66162 100644 --- a/lib/system_win32.c +++ b/lib/system_win32.c @@ -99,15 +99,9 @@ CURLcode Curl_win32_init(long flags) s_hIpHlpApiDll = curl_load_library(TEXT("iphlpapi.dll")); if(s_hIpHlpApiDll) { /* Get the address of the if_nametoindex function */ -#ifdef UNDER_CE - #define CURL_TEXT(n) TEXT(n) -#else - #define CURL_TEXT(n) (n) -#endif IF_NAMETOINDEX_FN pIfNameToIndex = CURLX_FUNCTION_CAST(IF_NAMETOINDEX_FN, - GetProcAddress(s_hIpHlpApiDll, - CURL_TEXT("if_nametoindex"))); + GetProcAddress(s_hIpHlpApiDll, "if_nametoindex")); if(pIfNameToIndex) Curl_if_nametoindex = pIfNameToIndex; @@ -164,13 +158,9 @@ typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD); /* See function definitions in winbase.h */ #ifdef UNICODE -# ifdef UNDER_CE -# define LOADLIBARYEX L"LoadLibraryExW" -# else -# define LOADLIBARYEX "LoadLibraryExW" -# endif +# define LOADLIBARYEX "LoadLibraryExW" #else -# define LOADLIBARYEX "LoadLibraryExA" +# define LOADLIBARYEX "LoadLibraryExA" #endif /* @@ -189,7 +179,7 @@ typedef HMODULE (APIENTRY *LOADLIBRARYEX_FN)(LPCTSTR, HANDLE, DWORD); */ static HMODULE curl_load_library(LPCTSTR filename) { -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP HMODULE hModule = NULL; LOADLIBRARYEX_FN pLoadLibraryEx = NULL; diff --git a/lib/tftp.c b/lib/tftp.c index 91a8c25ff3..c730f8499e 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -241,7 +241,7 @@ static CURLcode tftp_set_timeouts(struct tftp_conn *state) state->retry_time = 1; infof(state->data, - "set timeouts for state %d; Total % " FMT_OFF_T ", retry %d maxtry %d", + "set timeouts for state %d; Total %" FMT_OFF_T ", retry %d maxtry %d", (int)state->state, timeout_ms, state->retry_time, state->retry_max); /* init RX time */ @@ -381,7 +381,7 @@ static CURLcode tftp_parse_option_ack(struct tftp_conn *state, static CURLcode tftp_option_add(struct tftp_conn *state, size_t *csize, char *buf, const char *option) { - if(( strlen(option) + *csize + 1) > (size_t)state->blksize) + if((strlen(option) + *csize + 1) > (size_t)state->blksize) return CURLE_TFTP_ILLEGAL; strcpy(buf, option); *csize += strlen(option) + 1; diff --git a/lib/transfer.c b/lib/transfer.c index 4c17cbb50d..2b06566f73 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -39,9 +39,7 @@ #ifdef HAVE_SYS_IOCTL_H #include #endif -#ifndef UNDER_CE #include -#endif #ifdef HAVE_SYS_PARAM_H #include diff --git a/lib/url.c b/lib/url.c index 0a0b6ff3a2..cf34514b1a 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1283,7 +1283,7 @@ static bool url_match_result(bool result, void *userdata) return TRUE; } else if(match->seen_single_use_conn && !match->seen_multiplex_conn) { - /* We've seen a single-use, existing connection to the destination and + /* We have seen a single-use, existing connection to the destination and * no multiplexed one. It seems safe to assume that the server does * not support multiplexing. */ match->wait_pipe = FALSE; @@ -2740,7 +2740,7 @@ static CURLcode override_login(struct Curl_easy *data, data->set.str[STRING_NETRC_FILE]); if(ret && ((ret == NETRC_NO_MATCH) || (data->set.use_netrc == CURL_NETRC_OPTIONAL))) { - infof(data, "Couldn't find host %s in the %s file; using defaults", + infof(data, "Could not find host %s in the %s file; using defaults", conn->host.name, (data->set.str[STRING_NETRC_FILE] ? data->set.str[STRING_NETRC_FILE] : ".netrc")); @@ -2752,7 +2752,7 @@ static CURLcode override_login(struct Curl_easy *data, } else { if(!(conn->handler->flags&PROTOPT_USERPWDCTRL)) { - /* if the protocol can't handle control codes in credentials, make + /* if the protocol cannot handle control codes in credentials, make sure there are none */ if(str_has_ctrl(*userp) || str_has_ctrl(*passwdp)) { failf(data, "control code detected in .netrc credentials"); diff --git a/lib/urlapi.c b/lib/urlapi.c index 73f476ed3f..a3d9efdb91 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -1940,7 +1940,7 @@ nomem: if(!n) bad = TRUE; /* empty hostname is not okay */ else if(!urlencode) { - /* if the host name part was not URL encoded here, it was set ready + /* if the hostname part was not URL encoded here, it was set ready URL encoded so we need to decode it to check */ size_t dlen; char *decoded = NULL; diff --git a/lib/urldata.h b/lib/urldata.h index f92bfcb3b2..4b112e7072 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -238,7 +238,7 @@ struct ssl_backend_data; struct Curl_ssl_scache_entry; struct ssl_primary_config { - char *CApath; /* certificate dir (does not work on Windows) */ + char *CApath; /* certificate directory (does not work on Windows) */ char *CAfile; /* certificate to verify peer against */ char *issuercert; /* optional issuer certificate filename */ char *clientcert; diff --git a/lib/vauth/digest.c b/lib/vauth/digest.c index a8d4ffe5b7..c1c0ab2ab2 100644 --- a/lib/vauth/digest.c +++ b/lib/vauth/digest.c @@ -216,7 +216,7 @@ static bool auth_digest_get_key_value(const char *chlg, const char *key, if(curlx_str_cmp(&name, key)) { /* if this is our key, return the value */ if(curlx_strlen(&data) >= buflen) - /* doesn't fit */ + /* does not fit */ return FALSE; memcpy(buf, curlx_str(&data), curlx_strlen(&data)); buf[curlx_strlen(&data)] = 0; diff --git a/lib/vauth/digest_sspi.c b/lib/vauth/digest_sspi.c index f04c3845ab..f730c52987 100644 --- a/lib/vauth/digest_sspi.c +++ b/lib/vauth/digest_sspi.c @@ -583,6 +583,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, /* Allocate our new context handle */ digest->http_context = calloc(1, sizeof(CtxtHandle)); if(!digest->http_context) { + Curl_pSecFn->FreeCredentialsHandle(&credentials); curlx_unicodefree(spn); Curl_sspi_free_identity(p_identity); free(output_token); diff --git a/lib/vquic/curl_ngtcp2.c b/lib/vquic/curl_ngtcp2.c index 475060ebdd..ce5786ca83 100644 --- a/lib/vquic/curl_ngtcp2.c +++ b/lib/vquic/curl_ngtcp2.c @@ -1531,7 +1531,10 @@ static CURLcode h3_stream_open(struct Curl_cfilter *cf, goto out; } - nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, &result); + nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, + !data->state.http_ignorecustom ? + data->set.str[STRING_CUSTOMREQUEST] : NULL, + 0, &result); if(nwritten < 0) goto out; *pnwritten = (size_t)nwritten; diff --git a/lib/vquic/curl_osslq.c b/lib/vquic/curl_osslq.c index 145a2831db..f328c08e35 100644 --- a/lib/vquic/curl_osslq.c +++ b/lib/vquic/curl_osslq.c @@ -781,7 +781,7 @@ static CURLcode write_resp_raw(struct Curl_cfilter *cf, if(nwritten < memlen) { /* This MUST not happen. Our recbuf is dimensioned to hold the - * full max_stream_window and then some for this very reason. */ + * full max_stream_window and then some for this reason. */ DEBUGASSERT(0); return CURLE_RECV_ERROR; } @@ -1900,7 +1900,10 @@ static ssize_t h3_stream_open(struct Curl_cfilter *cf, goto out; } - nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, err); + nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, + !data->state.http_ignorecustom ? + data->set.str[STRING_CUSTOMREQUEST] : NULL, + 0, err); if(nwritten < 0) goto out; if(!stream->h1.done) { diff --git a/lib/vquic/curl_quiche.c b/lib/vquic/curl_quiche.c index d8d063b2ec..02b679ab84 100644 --- a/lib/vquic/curl_quiche.c +++ b/lib/vquic/curl_quiche.c @@ -342,7 +342,7 @@ static CURLcode write_resp_raw(struct Curl_cfilter *cf, if(nwritten < memlen) { /* This MUST not happen. Our recbuf is dimensioned to hold the - * full max_stream_window and then some for this very reason. */ + * full max_stream_window and then some for this reason. */ DEBUGASSERT(0); return CURLE_RECV_ERROR; } @@ -991,7 +991,10 @@ static CURLcode h3_open_stream(struct Curl_cfilter *cf, Curl_dynhds_init(&h2_headers, 0, DYN_HTTP_REQUEST); DEBUGASSERT(stream); - nwritten = Curl_h1_req_parse_read(&stream->h1, buf, blen, NULL, 0, &result); + nwritten = Curl_h1_req_parse_read(&stream->h1, buf, blen, NULL, + !data->state.http_ignorecustom ? + data->set.str[STRING_CUSTOMREQUEST] : NULL, + 0, &result); if(nwritten < 0) goto out; if(!stream->h1.done) { diff --git a/lib/vquic/vquic-tls.c b/lib/vquic/vquic-tls.c index f4ef06c33b..46bb4c7d4c 100644 --- a/lib/vquic/vquic-tls.c +++ b/lib/vquic/vquic-tls.c @@ -168,13 +168,11 @@ CURLcode Curl_vquic_tls_verify_peer(struct curl_tls_ctx *ctx, (void)conn_config; result = Curl_ossl_check_peer_cert(cf, data, &ctx->ossl, peer); #elif defined(USE_GNUTLS) - if(conn_config->verifyhost) { - result = Curl_gtls_verifyserver(cf, data, ctx->gtls.session, - conn_config, &data->set.ssl, peer, - data->set.str[STRING_SSL_PINNEDPUBLICKEY]); - if(result) - return result; - } + result = Curl_gtls_verifyserver(cf, data, ctx->gtls.session, + conn_config, &data->set.ssl, peer, + data->set.str[STRING_SSL_PINNEDPUBLICKEY]); + if(result) + return result; #elif defined(USE_WOLFSSL) (void)data; if(conn_config->verifyhost) { diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 07036f900a..9428a20a5f 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -1137,14 +1137,13 @@ static int myssh_in_UPLOAD_INIT(struct Curl_easy *data, attrs = sftp_stat(sshc->sftp_session, sshp->path); if(attrs) { curl_off_t size = attrs->size; + sftp_attributes_free(attrs); if(size < 0) { failf(data, "Bad file size (%" FMT_OFF_T ")", size); rc = myssh_to_ERROR(data, sshc, CURLE_BAD_DOWNLOAD_RESUME); return rc; } - data->state.resume_from = attrs->size; - - sftp_attributes_free(attrs); + data->state.resume_from = size; } else { data->state.resume_from = 0; @@ -1574,8 +1573,8 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, Curl_debug(data, CURLINFO_HEADER_OUT, "PWD\n", 4); Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp)); - /* this sends an FTP-like "header" to the header callback so that the - current directory can be read very similar to how it is read when + /* this sends an FTP-like "header" to the header callback so that + the current directory can be read similar to how it is read when using ordinary FTP. */ result = Curl_client_write(data, CLIENTWRITE_HEADER, tmp, strlen(tmp)); free(tmp); @@ -1677,7 +1676,7 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, else if(!strncmp(cmd, "mkdir ", 6)) { if(*cp) return return_quote_error(data, sshc); - /* create dir */ + /* create directory */ myssh_to(data, sshc, SSH_SFTP_QUOTE_MKDIR); return SSH_NO_ERROR; } @@ -1703,7 +1702,7 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, return SSH_NO_ERROR; } else if(!strncmp(cmd, "rmdir ", 6)) { - /* delete dir */ + /* delete directory */ if(*cp) return return_quote_error(data, sshc); myssh_to(data, sshc, SSH_SFTP_QUOTE_RMDIR); @@ -1860,7 +1859,7 @@ static int myssh_in_SFTP_QUOTE_STAT(struct Curl_easy *data, return SSH_NO_ERROR; } if(date > UINT_MAX) - /* because the liubssh API can't deal with a larger value */ + /* because the liubssh API cannot deal with a larger value */ date = UINT_MAX; if(!strncmp(cmd, "atime", 5)) sshc->quote_attrs->atime = (uint32_t)date; @@ -2157,9 +2156,9 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, ++sshc->slash_pos; if(rc < 0) { /* - * Abort if failure was not that the dir already exists or the - * permission was denied (creation might succeed further down the - * path) - retry on unspecific FAILURE also + * Abort if failure was not that the directory already exists or + * the permission was denied (creation might succeed further down + * the path) - retry on unspecific FAILURE also */ err = sftp_get_error(sshc->sftp_session); if((err != SSH_FX_FILE_ALREADY_EXISTS) && @@ -2744,7 +2743,7 @@ static CURLcode myssh_do_it(struct Curl_easy *data, bool *done) data->req.size = -1; /* make sure this is unknown at this point */ sshc->actualcode = CURLE_OK; /* reset error code */ - sshc->secondCreateDirs = 0; /* reset the create dir attempt state + sshc->secondCreateDirs = 0; /* reset the create directory attempt state variable */ Curl_pgrsSetUploadCounter(data, 0); diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index b414dfcf2d..f5cb5f9a1d 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -878,8 +878,8 @@ static CURLcode sftp_quote(struct Curl_easy *data, Curl_debug(data, CURLINFO_HEADER_OUT, "PWD\n", 4); Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp)); - /* this sends an FTP-like "header" to the header callback so that the - current directory can be read very similar to how it is read when + /* this sends an FTP-like "header" to the header callback so that + the current directory can be read similar to how it is read when using ordinary FTP. */ result = Curl_client_write(data, CLIENTWRITE_HEADER, tmp, strlen(tmp)); free(tmp); @@ -957,7 +957,7 @@ static CURLcode sftp_quote(struct Curl_easy *data, else if(!strncmp(cmd, "mkdir ", 6)) { if(*cp) return_quote_error(data, sshc); - /* create dir */ + /* create directory */ myssh_state(data, sshc, SSH_SFTP_QUOTE_MKDIR); return result; } @@ -980,7 +980,7 @@ static CURLcode sftp_quote(struct Curl_easy *data, else if(!strncmp(cmd, "rmdir ", 6)) { if(*cp) return_quote_error(data, sshc); - /* delete dir */ + /* delete directory */ myssh_state(data, sshc, SSH_SFTP_QUOTE_RMDIR); return result; } @@ -2275,9 +2275,9 @@ static CURLcode ssh_state_sftp_create_dirs_mkdir(struct Curl_easy *data, ++sshc->slash_pos; if(rc < 0) { /* - * Abort if failure was not that the dir already exists or the - * permission was denied (creation might succeed further down the - * path) - retry on unspecific FAILURE also + * Abort if failure was not that the directory already exists or + * the permission was denied (creation might succeed further down + * the path) - retry on unspecific FAILURE also */ unsigned long sftperr = libssh2_sftp_last_error(sshc->sftp_session); if((sftperr != LIBSSH2_FX_FILE_ALREADY_EXISTS) && @@ -3528,7 +3528,7 @@ static CURLcode ssh_do(struct Curl_easy *data, bool *done) return CURLE_FAILED_INIT; data->req.size = -1; /* make sure this is unknown at this point */ - sshc->secondCreateDirs = 0; /* reset the create dir attempt state + sshc->secondCreateDirs = 0; /* reset the create directory attempt state variable */ Curl_pgrsSetUploadCounter(data, 0); diff --git a/lib/vssh/ssh.h b/lib/vssh/ssh.h index 9d03b52f40..5317351478 100644 --- a/lib/vssh/ssh.h +++ b/lib/vssh/ssh.h @@ -149,8 +149,8 @@ struct ssh_conn { char *quote_path1; /* two generic pointers for the QUOTE stuff */ char *quote_path2; - char *homedir; /* when doing SFTP we figure out home dir in the - connect phase */ + char *homedir; /* when doing SFTP we figure out home directory + in the connect phase */ /* end of READDIR stuff */ int secondCreateDirs; /* counter use by the code to see if the diff --git a/lib/vtls/apple.c b/lib/vtls/apple.c index 87d5208d73..297ebc39f3 100644 --- a/lib/vtls/apple.c +++ b/lib/vtls/apple.c @@ -148,7 +148,7 @@ CURLcode Curl_vtls_apple_verify(struct Curl_cfilter *cf, * add `kSecRevocationRequirePositiveResponse` to the Apple * Trust policies, it interprets this as it NEEDs a confirmation * of a cert being NOT REVOKED. Which not in general available for - * certificates on the internet. + * certificates on the Internet. * It seems that applications using this policy are expected to PIN * their certificate public keys or verification will fail. * This does not seem to be what we want here. */ diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 533597ed41..fd6396471c 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -108,8 +108,10 @@ # if LIBRESSL_VERSION_NUMBER < 0x2090100fL /* 2019-04-13 */ # error "LibreSSL 2.9.1 or later required" # endif -#elif OPENSSL_VERSION_NUMBER < 0x1000201fL /* 2015-03-19 */ -# error "OpenSSL 1.0.2a or later required" +#elif !defined(HAVE_BORINGSSL_LIKE) +# ifndef HAVE_OPENSSL3 /* 2021-09-07 */ +# error "OpenSSL 3.0.0 or later required" +# endif #endif #if defined(HAVE_OPENSSL3) && !defined(OPENSSL_NO_UI_CONSOLE) @@ -123,8 +125,7 @@ static void ossl_provider_cleanup(struct Curl_easy *data); /* AWS-LC fixed a bug with large buffers in v1.61.0 which also introduced * X509_V_ERR_EC_KEY_EXPLICIT_PARAMS. */ -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ - !defined(LIBRESSL_VERSION_NUMBER) && !defined(OPENSSL_IS_BORINGSSL) && \ +#if !defined(LIBRESSL_VERSION_NUMBER) && !defined(OPENSSL_IS_BORINGSSL) && \ (!defined(OPENSSL_IS_AWSLC) || defined(X509_V_ERR_EC_KEY_EXPLICIT_PARAMS)) #define HAVE_SSL_CTX_SET_DEFAULT_READ_BUFFER_LEN 1 #endif @@ -137,31 +138,6 @@ static void ossl_provider_cleanup(struct Curl_easy *data); #if defined(USE_OPENSSL_ENGINE) || defined(OPENSSL_HAS_PROVIDERS) #include - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L -#define OSSL_UI_METHOD_CAST(x) (x) -#else -#define OSSL_UI_METHOD_CAST(x) CURL_UNCONST(x) -#endif -#endif - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* OpenSSL 1.1.0+ and LibreSSL */ -#define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */ -#define HAVE_OPAQUE_EVP_PKEY 1 /* since 1.1.0 -pre3 */ -#define HAVE_OPAQUE_RSA_DSA_DH 1 /* since 1.1.0 -pre5 */ -#define HAVE_ERR_REMOVE_THREAD_STATE_DEPRECATED 1 -#else -/* For OpenSSL before 1.1.0 */ -#define ASN1_STRING_get0_data(x) ASN1_STRING_data(x) -#define X509_get0_notBefore(x) X509_get_notBefore(x) -#define X509_get0_notAfter(x) X509_get_notAfter(x) -#define OpenSSL_version_num() SSLeay() -#endif - -#if OPENSSL_VERSION_NUMBER >= 0x10002003L && \ - OPENSSL_VERSION_NUMBER <= 0x10002FFFL && \ - !defined(OPENSSL_NO_COMP) -#define HAVE_SSL_COMP_FREE_COMPRESSION_METHODS 1 #endif #ifdef HAVE_OPENSSL3 @@ -182,8 +158,7 @@ static void ossl_provider_cleanup(struct Curl_easy *data); * BoringSSL: no * LibreSSL: supported since 3.4.1 (released 2021-10-14) */ -#if ((OPENSSL_VERSION_NUMBER >= 0x10101000L && \ - !defined(LIBRESSL_VERSION_NUMBER)) || \ +#if (!defined(LIBRESSL_VERSION_NUMBER) || \ (defined(LIBRESSL_VERSION_NUMBER) && \ LIBRESSL_VERSION_NUMBER >= 0x3040100fL)) && \ !defined(OPENSSL_IS_BORINGSSL) @@ -198,7 +173,7 @@ static void ossl_provider_cleanup(struct Curl_easy *data); * BoringSSL: supported since 0.20240913.0 (commit 826ce15) * LibreSSL: no */ -#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER) +#ifndef LIBRESSL_VERSION_NUMBER #define HAVE_SSL_CTX_SET1_SIGALGS #endif @@ -224,30 +199,6 @@ typedef unsigned long sslerr_t; #endif #define ossl_valsize_t numcert_t -#if OPENSSL_VERSION_NUMBER >= 0x10100000L -/* up2date versions of OpenSSL maintain reasonably secure defaults without - * breaking compatibility, so it is better not to override the defaults in curl - */ -#define DEFAULT_CIPHER_SELECTION NULL -#else -/* not the case with old versions of OpenSSL */ -#define DEFAULT_CIPHER_SELECTION \ - "ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH" -#endif - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L -#define HAVE_RANDOM_INIT_BY_DEFAULT 1 -#endif - -/* - * Whether the OpenSSL version has the API needed to support sharing an - * X509_STORE between connections. The API is: - * * `X509_STORE_up_ref` -- Introduced: OpenSSL 1.1.0. - */ -#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* OpenSSL >= 1.1.0 */ -#define HAVE_SSL_X509_STORE_SHARE -#endif - static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl); static CURLcode push_certinfo(struct Curl_easy *data, @@ -280,27 +231,12 @@ static CURLcode pubkey_show(struct Curl_easy *data, return push_certinfo(data, mem, namebuf, num); } -#ifdef HAVE_OPAQUE_RSA_DSA_DH #define print_pubkey_BN(_type, _name, _num) \ pubkey_show(data, mem, _num, #_type, #_name, _name) -#else -#define print_pubkey_BN(_type, _name, _num) \ -do { \ - if(_type->_name) { \ - pubkey_show(data, mem, _num, #_type, #_name, _type->_name); \ - } \ -} while(0) -#endif - static int asn1_object_dump(const ASN1_OBJECT *a, char *buf, size_t len) { - int i; -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - i = i2t_ASN1_OBJECT(buf, (int)len, a); -#else - i = i2t_ASN1_OBJECT(buf, (int)len, CURL_UNCONST(a)); -#endif + int i = i2t_ASN1_OBJECT(buf, (int)len, a); return (i >= (int)len); /* buffer too small */ } @@ -310,10 +246,10 @@ static CURLcode X509V3_ext(struct Curl_easy *data, { int i; CURLcode result = CURLE_OK; -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - const STACK_OF(X509_EXTENSION) *exts = extsarg; -#else +#ifdef LIBRESSL_VERSION_NUMBER STACK_OF(X509_EXTENSION) *exts = CURL_UNCONST(extsarg); +#else + const STACK_OF(X509_EXTENSION) *exts = extsarg; #endif if((int)sk_X509_EXTENSION_num(exts) <= 0) @@ -409,7 +345,6 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) if(result) break; -#ifdef HAVE_X509_GET0_EXTENSIONS { const X509_ALGOR *sigalg = NULL; X509_PUBKEY *xpubkey = NULL; @@ -440,28 +375,6 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) if(result) break; } -#else - { - /* before OpenSSL 1.0.2 */ - X509_CINF *cinf = x->cert_info; - - i2a_ASN1_OBJECT(mem, cinf->signature->algorithm); - result = push_certinfo(data, mem, "Signature Algorithm", i); - - if(!result) { - i2a_ASN1_OBJECT(mem, cinf->key->algor->algorithm); - result = push_certinfo(data, mem, "Public Key Algorithm", i); - } - - if(!result) - result = X509V3_ext(data, i, cinf->extensions); - - if(result) - break; - - psig = x->signature; - } -#endif ASN1_TIME_print(mem, X509_get0_notBefore(x)); result = push_certinfo(data, mem, "Start date", i); @@ -477,25 +390,14 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) if(!pubkey) infof(data, " Unable to load public key"); else { - int pktype; -#ifdef HAVE_OPAQUE_EVP_PKEY - pktype = EVP_PKEY_id(pubkey); -#else - pktype = pubkey->type; -#endif - switch(pktype) { + switch(EVP_PKEY_id(pubkey)) { case EVP_PKEY_RSA: { #ifndef HAVE_EVP_PKEY_GET_PARAMS RSA *rsa; -#ifdef HAVE_OPAQUE_EVP_PKEY rsa = EVP_PKEY_get0_RSA(pubkey); -#else - rsa = pubkey->pkey.rsa; -#endif /* HAVE_OPAQUE_EVP_PKEY */ #endif /* !HAVE_EVP_PKEY_GET_PARAMS */ { -#ifdef HAVE_OPAQUE_RSA_DSA_DH DECLARE_PKEY_PARAM_BIGNUM(n); DECLARE_PKEY_PARAM_BIGNUM(e); #ifdef HAVE_EVP_PKEY_GET_PARAMS @@ -505,9 +407,6 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) RSA_get0_key(rsa, &n, &e, NULL); #endif /* HAVE_EVP_PKEY_GET_PARAMS */ BIO_printf(mem, "%d", n ? BN_num_bits(n) : 0); -#else - BIO_printf(mem, "%d", rsa->n ? BN_num_bits(rsa->n) : 0); -#endif /* HAVE_OPAQUE_RSA_DSA_DH */ result = push_certinfo(data, mem, "RSA Public Key", i); if(result) break; @@ -523,15 +422,9 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) { #ifndef OPENSSL_NO_DSA #ifndef HAVE_EVP_PKEY_GET_PARAMS - DSA *dsa; -#ifdef HAVE_OPAQUE_EVP_PKEY - dsa = EVP_PKEY_get0_DSA(pubkey); -#else - dsa = pubkey->pkey.dsa; -#endif /* HAVE_OPAQUE_EVP_PKEY */ + DSA *dsa = EVP_PKEY_get0_DSA(pubkey); #endif /* !HAVE_EVP_PKEY_GET_PARAMS */ { -#ifdef HAVE_OPAQUE_RSA_DSA_DH DECLARE_PKEY_PARAM_BIGNUM(p); DECLARE_PKEY_PARAM_BIGNUM(q); DECLARE_PKEY_PARAM_BIGNUM(g); @@ -545,7 +438,6 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) DSA_get0_pqg(dsa, &p, &q, &g); DSA_get0_key(dsa, &pub_key, NULL); #endif /* HAVE_EVP_PKEY_GET_PARAMS */ -#endif /* HAVE_OPAQUE_RSA_DSA_DH */ print_pubkey_BN(dsa, p, i); print_pubkey_BN(dsa, q, i); print_pubkey_BN(dsa, g, i); @@ -560,15 +452,9 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) } case EVP_PKEY_DH: { #ifndef HAVE_EVP_PKEY_GET_PARAMS - DH *dh; -#ifdef HAVE_OPAQUE_EVP_PKEY - dh = EVP_PKEY_get0_DH(pubkey); -#else - dh = pubkey->pkey.dh; -#endif /* HAVE_OPAQUE_EVP_PKEY */ + DH *dh = EVP_PKEY_get0_DH(pubkey); #endif /* !HAVE_EVP_PKEY_GET_PARAMS */ { -#ifdef HAVE_OPAQUE_RSA_DSA_DH DECLARE_PKEY_PARAM_BIGNUM(p); DECLARE_PKEY_PARAM_BIGNUM(q); DECLARE_PKEY_PARAM_BIGNUM(g); @@ -585,10 +471,6 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) print_pubkey_BN(dh, p, i); print_pubkey_BN(dh, q, i); print_pubkey_BN(dh, g, i); -#else - print_pubkey_BN(dh, p, i); - print_pubkey_BN(dh, g, i); -#endif /* HAVE_OPAQUE_RSA_DSA_DH */ print_pubkey_BN(dh, pub_key, i); FREE_PKEY_PARAM_BIGNUM(p); FREE_PKEY_PARAM_BIGNUM(q); @@ -626,21 +508,10 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl) #ifdef USE_OPENSSL -#if OPENSSL_VERSION_NUMBER < 0x10100000L -#define BIO_set_init(x,v) ((x)->init=(v)) -#define BIO_get_data(x) ((x)->ptr) -#define BIO_set_data(x,v) ((x)->ptr=(v)) -#define BIO_get_shutdown(x) ((x)->shutdown) -#define BIO_set_shutdown(x,v) ((x)->shutdown=(v)) -#endif /* HAVE_PRE_1_1_API */ - static int ossl_bio_cf_create(BIO *bio) { BIO_set_shutdown(bio, 1); BIO_set_init(bio, 1); -#if OPENSSL_VERSION_NUMBER < 0x10100000L - bio->num = -1; -#endif BIO_set_data(bio, NULL); return 1; } @@ -759,30 +630,6 @@ static int ossl_bio_cf_in_read(BIO *bio, char *buf, int blen) return result ? -1 : (int)nread; } -#if OPENSSL_VERSION_NUMBER < 0x10100000L - -static BIO_METHOD ossl_bio_cf_meth_1_0 = { - BIO_TYPE_MEM, - "OpenSSL CF BIO", - ossl_bio_cf_out_write, - ossl_bio_cf_in_read, - NULL, /* puts is never called */ - NULL, /* gets is never called */ - ossl_bio_cf_ctrl, - ossl_bio_cf_create, - ossl_bio_cf_destroy, - NULL -}; - -static BIO_METHOD *ossl_bio_cf_method_create(void) -{ - return &ossl_bio_cf_meth_1_0; -} - -#define ossl_bio_cf_method_free(m) Curl_nop_stmt - -#else - static BIO_METHOD *ossl_bio_cf_method_create(void) { BIO_METHOD *m = BIO_meth_new(BIO_TYPE_MEM, "OpenSSL CF BIO"); @@ -802,9 +649,6 @@ static void ossl_bio_cf_method_free(BIO_METHOD *m) BIO_meth_free(m); } -#endif - - #ifdef HAVE_KEYLOG_CALLBACK static void ossl_keylog_callback(const SSL *ssl, const char *line) { @@ -834,19 +678,9 @@ ossl_log_tls12_secret(const SSL *ssl, bool *keylog_done) return; } -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - /* ssl->s3 is not checked in OpenSSL 1.1.0-pre6, but let's assume that - * we have a valid SSL context if we have a non-NULL session. */ SSL_get_client_random(ssl, client_random, SSL3_RANDOM_SIZE); master_key_length = (int) SSL_SESSION_get_master_key(session, master_key, SSL_MAX_MASTER_KEY_LENGTH); -#else - if(ssl->s3 && session->master_key_length > 0) { - master_key_length = session->master_key_length; - memcpy(master_key, session->master_key, session->master_key_length); - memcpy(client_random, ssl->s3->client_random, SSL3_RANDOM_SIZE); - } -#endif ERR_pop_to_mark(); @@ -968,58 +802,8 @@ static CURLcode ossl_seed(struct Curl_easy *data) data->multi->ssl_seeded = TRUE; return CURLE_OK; } -#ifdef HAVE_RANDOM_INIT_BY_DEFAULT - /* with OpenSSL 1.1.0+, a failed RAND_status is a showstopper */ failf(data, "Insufficient randomness"); return CURLE_SSL_CONNECT_ERROR; -#else - - /* fallback to a custom seeding of the PRNG using a hash based on a current - time */ - do { - unsigned char randb[64]; - size_t len = sizeof(randb); - size_t i, i_max; - for(i = 0, i_max = len / sizeof(struct curltime); i < i_max; ++i) { - struct curltime tv = curlx_now(); - curlx_wait_ms(1); - tv.tv_sec *= (time_t)i + 1; - tv.tv_usec *= (int)i + 2; - tv.tv_sec ^= ((curlx_now().tv_sec + (time_t)curlx_now().tv_usec) * - (time_t)(i + 3)) << 8; - tv.tv_usec ^= (int) ((curlx_now().tv_sec + (time_t)curlx_now().tv_usec) * - (time_t)(i + 4)) << 16; - memcpy(&randb[i * sizeof(struct curltime)], &tv, - sizeof(struct curltime)); - } - RAND_add(randb, (int)len, (double)len/2); - } while(!rand_enough()); - - /* - * Number of bytes to read from the random number seed file. This must be - * a finite value (because some entropy "files" like /dev/urandom have - * an infinite length), but must be large enough to provide enough - * entropy to properly seed OpenSSL's PRNG. - */ -# define RAND_LOAD_LENGTH 1024 - - { - /* generates a default path for the random seed file */ - char fname[256]; - fname[0] = 0; /* blank it first */ - RAND_file_name(fname, sizeof(fname)); - if(fname[0]) { - /* we got a filename to try */ - RAND_load_file(fname, RAND_LOAD_LENGTH); - if(rand_enough()) - return CURLE_OK; - } - } - - infof(data, "libcurl is now using a weak random seed"); - return rand_enough() ? CURLE_OK : - CURLE_SSL_CONNECT_ERROR; /* confusing error code */ -#endif } #ifndef SSL_FILETYPE_ENGINE @@ -1247,7 +1031,7 @@ static int enginecheck(struct Curl_easy *data, if(data->state.engine) { UI_METHOD *ui_method = - UI_create_method(OSSL_UI_METHOD_CAST("curl user interface")); + UI_create_method("curl user interface"); if(!ui_method) { failf(data, "unable to create " OSSL_PACKAGE " user-interface method"); return 0; @@ -1309,7 +1093,7 @@ static int providercheck(struct Curl_easy *data, OSSL_STORE_CTX *store = NULL; OSSL_STORE_INFO *info = NULL; UI_METHOD *ui_method = - UI_create_method(OSSL_UI_METHOD_CAST("curl user interface")); + UI_create_method("curl user interface"); if(!ui_method) { failf(data, "unable to create " OSSL_PACKAGE " user-interface method"); return 0; @@ -1430,6 +1214,7 @@ static int engineload(struct Curl_easy *data, failf(data, "unable to set client certificate [%s]", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer))); + X509_free(params.cert); return 0; } X509_free(params.cert); /* we do not need the handle any more... */ @@ -1688,7 +1473,7 @@ static CURLcode client_cert(struct Curl_easy *data, failf(data, "could not load PEM client certificate from %s, " OSSL_PACKAGE " error %s, " - "(no key found, wrong pass phrase, or wrong file format?)", + "(no key found, wrong passphrase, or wrong file format?)", (cert_blob ? "CURLOPT_SSLCERT_BLOB" : cert_file), ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)) ); @@ -1708,7 +1493,7 @@ static CURLcode client_cert(struct Curl_easy *data, failf(data, "could not load ASN1 client certificate from %s, " OSSL_PACKAGE " error %s, " - "(no key found, wrong pass phrase, or wrong file format?)", + "(no key found, wrong passphrase, or wrong file format?)", (cert_blob ? "CURLOPT_SSLCERT_BLOB" : cert_file), ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)) ); @@ -1797,13 +1582,7 @@ static CURLcode client_cert(struct Curl_easy *data, /* If RSA is used, do not check the private key if its flags indicate * it does not support it. */ EVP_PKEY *priv_key = SSL_get_privatekey(ssl); - int pktype; -#ifdef HAVE_OPAQUE_EVP_PKEY - pktype = EVP_PKEY_id(priv_key); -#else - pktype = priv_key->type; -#endif - if(pktype == EVP_PKEY_RSA) { + if(EVP_PKEY_id(priv_key) == EVP_PKEY_RSA) { RSA *rsa = EVP_PKEY_get1_RSA(priv_key); if(RSA_flags(rsa) & RSA_METHOD_FLAG_NO_CHECK) check_privkey = FALSE; @@ -1846,8 +1625,8 @@ static CURLcode x509_name_oneline(X509_NAME *a, struct dynbuf *d) if(rc != -1) { BIO_get_mem_ptr(bio_out, &biomem); result = curlx_dyn_addn(d, biomem->data, biomem->length); - BIO_free(bio_out); } + BIO_free(bio_out); } return result; } @@ -1861,7 +1640,6 @@ static CURLcode x509_name_oneline(X509_NAME *a, struct dynbuf *d) */ static int ossl_init(void) { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L const uint64_t flags = #ifdef OPENSSL_INIT_ENGINE_ALL_BUILTIN /* not present in BoringSSL */ @@ -1874,28 +1652,6 @@ static int ossl_init(void) #endif 0; OPENSSL_init_ssl(flags, NULL); -#else - OPENSSL_load_builtin_modules(); - -#ifdef USE_OPENSSL_ENGINE - ENGINE_load_builtin_engines(); -#endif - -#ifndef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG - CONF_modules_load_file(NULL, NULL, - CONF_MFLAGS_DEFAULT_SECTION| - CONF_MFLAGS_IGNORE_MISSING_FILE); -#endif - - /* Let's get nice error messages */ - SSL_load_error_strings(); - - /* Init the global ciphers and digests */ - if(!SSLeay_add_ssl_algorithms()) - return 0; - - OpenSSL_add_all_algorithms(); -#endif Curl_tls_keylog_open(); @@ -1905,32 +1661,6 @@ static int ossl_init(void) /* Global cleanup */ static void ossl_cleanup(void) { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - /* OpenSSL 1.1 deprecates all these cleanup functions and - turns them into no-ops in OpenSSL 1.0 compatibility mode */ -#else - /* Free ciphers and digests lists */ - EVP_cleanup(); - -#ifdef USE_OPENSSL_ENGINE - /* Free engine list */ - ENGINE_cleanup(); -#endif - - /* Free OpenSSL error strings */ - ERR_free_strings(); - - /* Free thread local error state, destroying hash upon zero refcount */ - ERR_remove_thread_state(NULL); - - /* Free all memory allocated by all configuration modules */ - CONF_modules_free(); - -#ifdef HAVE_SSL_COMP_FREE_COMPRESSION_METHODS - SSL_COMP_free_compression_methods(); -#endif -#endif - Curl_tls_keylog_close(); } @@ -2284,13 +2014,6 @@ static void ossl_close_all(struct Curl_easy *data) #ifdef OPENSSL_HAS_PROVIDERS ossl_provider_cleanup(data); #endif -#ifndef HAVE_ERR_REMOVE_THREAD_STATE_DEPRECATED - /* OpenSSL 1.0.1 and 1.0.2 build an error queue that is stored per-thread - so we need to clean it here in case the thread will be killed. All OpenSSL - code should extract the error in association with the error so clearing - this queue here should be harmless at worst. */ - ERR_remove_thread_state(NULL); -#endif } /* ====================================================== */ @@ -2777,7 +2500,7 @@ static void ossl_trace(int direction, int ssl_ver, int content_type, const void *buf, size_t len, SSL *ssl, void *userp) { - const char *verstr = "???"; + const char *verstr; struct Curl_cfilter *cf = userp; struct Curl_easy *data = NULL; char unknown[32]; @@ -2812,13 +2535,9 @@ static void ossl_trace(int direction, int ssl_ver, int content_type, verstr = "TLSv1.2"; break; #endif -#ifdef TLS1_3_VERSION /* OpenSSL 1.1.1+, all forks */ case TLS1_3_VERSION: verstr = "TLSv1.3"; break; -#endif - case 0: - break; default: curl_msnprintf(unknown, sizeof(unknown), "(%x)", ssl_ver); verstr = unknown; @@ -2884,7 +2603,6 @@ static void ossl_trace(int direction, int ssl_ver, int content_type, # define HAS_ALPN_OPENSSL #endif -#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* 1.1.0 */ static CURLcode ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx, unsigned int ssl_version_min) @@ -2916,12 +2634,8 @@ ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx, ossl_ssl_version_min = TLS1_2_VERSION; break; case CURL_SSLVERSION_TLSv1_3: -#ifdef TLS1_3_VERSION ossl_ssl_version_min = TLS1_3_VERSION; break; -#else - return CURLE_NOT_BUILT_IN; -#endif } /* ... then, TLS max version */ @@ -2938,11 +2652,9 @@ ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx, case CURL_SSLVERSION_MAX_TLSv1_2: ossl_ssl_version_max = TLS1_2_VERSION; break; -#ifdef TLS1_3_VERSION case CURL_SSLVERSION_MAX_TLSv1_3: ossl_ssl_version_max = TLS1_3_VERSION; break; -#endif case CURL_SSLVERSION_MAX_NONE: /* none selected */ case CURL_SSLVERSION_MAX_DEFAULT: /* max selected */ default: @@ -2959,80 +2671,15 @@ ossl_set_ssl_version_min_max(struct Curl_cfilter *cf, SSL_CTX *ctx, return CURLE_OK; } -#endif #ifdef HAVE_BORINGSSL_LIKE typedef uint32_t ctx_option_t; #elif defined(HAVE_OPENSSL3) typedef uint64_t ctx_option_t; -#elif OPENSSL_VERSION_NUMBER >= 0x10100000L && \ - !defined(LIBRESSL_VERSION_NUMBER) -typedef unsigned long ctx_option_t; -#else +#elif defined(LIBRESSL_VERSION_NUMBER) typedef long ctx_option_t; -#endif - -#if OPENSSL_VERSION_NUMBER < 0x10100000L /* 1.1.0 */ -static CURLcode -ossl_set_ssl_version_min_max_legacy(ctx_option_t *ctx_options, - struct Curl_cfilter *cf, - struct Curl_easy *data) -{ - struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf); - long ssl_version = conn_config->version; - long ssl_version_max = conn_config->version_max; - - (void)data; /* In case it is unused. */ - - switch(ssl_version) { - case CURL_SSLVERSION_TLSv1_3: -#ifdef TLS1_3_VERSION - { - struct ssl_connect_data *connssl = cf->ctx; - struct ossl_ctx *octx = (struct ossl_ctx *)connssl->backend; - DEBUGASSERT(octx); - SSL_CTX_set_max_proto_version(octx->ssl_ctx, TLS1_3_VERSION); - *ctx_options |= SSL_OP_NO_TLSv1_2; - } #else - (void)ctx_options; - failf(data, OSSL_PACKAGE " was built without TLS 1.3 support"); - return CURLE_NOT_BUILT_IN; -#endif - FALLTHROUGH(); - case CURL_SSLVERSION_TLSv1_2: - *ctx_options |= SSL_OP_NO_TLSv1_1; - FALLTHROUGH(); - case CURL_SSLVERSION_TLSv1_1: - *ctx_options |= SSL_OP_NO_TLSv1; - FALLTHROUGH(); - case CURL_SSLVERSION_TLSv1_0: - case CURL_SSLVERSION_TLSv1: - break; - } - - switch(ssl_version_max) { - case CURL_SSLVERSION_MAX_TLSv1_0: - *ctx_options |= SSL_OP_NO_TLSv1_1; - FALLTHROUGH(); - case CURL_SSLVERSION_MAX_TLSv1_1: - *ctx_options |= SSL_OP_NO_TLSv1_2; - FALLTHROUGH(); - case CURL_SSLVERSION_MAX_TLSv1_2: -#ifdef TLS1_3_VERSION - *ctx_options |= SSL_OP_NO_TLSv1_3; -#endif - break; - case CURL_SSLVERSION_MAX_TLSv1_3: -#ifdef TLS1_3_VERSION - break; -#else - failf(data, OSSL_PACKAGE " was built without TLS 1.3 support"); - return CURLE_NOT_BUILT_IN; -#endif - } - return CURLE_OK; -} +typedef unsigned long ctx_option_t; #endif CURLcode Curl_ossl_add_session(struct Curl_cfilter *cf, @@ -3538,8 +3185,6 @@ static CURLcode ossl_populate_x509_store(struct Curl_cfilter *cf, return result; } -#ifdef HAVE_SSL_X509_STORE_SHARE - /* key to use at `multi->proto_hash` */ #define MPROTO_OSSL_X509_KEY "tls:ossl:x509:share" @@ -3706,25 +3351,6 @@ CURLcode Curl_ssl_setup_x509_store(struct Curl_cfilter *cf, return result; } -#else /* HAVE_SSL_X509_STORE_SHARE */ -CURLcode Curl_ssl_setup_x509_store(struct Curl_cfilter *cf, - struct Curl_easy *data, - struct ossl_ctx *octx) -{ - CURLcode result; - X509_STORE *store; - - ERR_set_mark(); - - store = SSL_CTX_get_cert_store(octx->ssl_ctx); - result = ossl_populate_x509_store(cf, data, octx, store); - - ERR_pop_to_mark(); - - return result; -} -#endif /* HAVE_SSL_X509_STORE_SHARE */ - static CURLcode ossl_init_session_and_alpns(struct ossl_ctx *octx, @@ -4020,11 +3646,7 @@ static CURLcode ossl_init_method(struct Curl_cfilter *cf, case CURL_SSLVERSION_TLSv1_2: case CURL_SSLVERSION_TLSv1_3: /* it will be handled later with the context options */ -#if OPENSSL_VERSION_NUMBER >= 0x10100000L *pmethod = TLS_client_method(); -#else - *pmethod = SSLv23_client_method(); -#endif break; case CURL_SSLVERSION_SSLv2: failf(data, "No SSLv2 support"); @@ -4048,10 +3670,8 @@ static CURLcode ossl_init_method(struct Curl_cfilter *cf, #ifdef USE_OPENSSL_QUIC *pmethod = OSSL_QUIC_client_method(); -#elif (OPENSSL_VERSION_NUMBER >= 0x10100000L) - *pmethod = TLS_method(); #else - *pmethod = SSLv23_client_method(); + *pmethod = TLS_method(); #endif break; default: @@ -4187,11 +3807,7 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx, ctx_options |= SSL_OP_NO_SSLv2; ctx_options |= SSL_OP_NO_SSLv3; -#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* 1.1.0 */ result = ossl_set_ssl_version_min_max(cf, octx->ssl_ctx, ssl_version_min); -#else - result = ossl_set_ssl_version_min_max_legacy(&ctx_options, cf, data); -#endif if(result) return result; break; @@ -4222,7 +3838,7 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx, ciphers = conn_config->cipher_list; if(!ciphers && (peer->transport != TRNSPRT_QUIC)) - ciphers = DEFAULT_CIPHER_SELECTION; + ciphers = NULL; if(ciphers && (ssl_version_min < CURL_SSLVERSION_TLSv1_3)) { if(!SSL_CTX_set_cipher_list(octx->ssl_ctx, ciphers)) { failf(data, "failed setting cipher list: %s", ciphers); @@ -4829,9 +4445,8 @@ static CURLcode ossl_pkp_pin_peer_pubkey(struct Curl_easy *data, X509* cert, return result; } -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \ - !(defined(LIBRESSL_VERSION_NUMBER) && \ - LIBRESSL_VERSION_NUMBER < 0x3060000fL) && \ +#if !(defined(LIBRESSL_VERSION_NUMBER) && \ + LIBRESSL_VERSION_NUMBER < 0x3060000fL) && \ !defined(HAVE_BORINGSSL_LIKE) && !defined(CURL_DISABLE_VERBOSE_STRINGS) static void infof_certstack(struct Curl_easy *data, const SSL *ssl) { @@ -5154,7 +4769,7 @@ CURLcode Curl_ossl_check_peer_cert(struct Curl_cfilter *cf, #endif if(data->set.ssl.certinfo && !octx->reused_session) { - /* asked to gather certificate info. Reused sessions don't have cert + /* asked to gather certificate info. Reused sessions do not have cert chains */ result = ossl_certchain(data, octx->ssl); if(result) @@ -5650,8 +5265,6 @@ out: static CURLcode ossl_get_channel_binding(struct Curl_easy *data, int sockindex, struct dynbuf *binding) { - /* required for X509_get_signature_nid support */ -#if OPENSSL_VERSION_NUMBER > 0x10100000L X509 *cert; int algo_nid; const EVP_MD *algo_type; @@ -5684,7 +5297,7 @@ static CURLcode ossl_get_channel_binding(struct Curl_easy *data, int sockindex, cert = SSL_get1_peer_certificate(octx->ssl); if(!cert) - /* No server certificate, don't do channel binding */ + /* No server certificate, do not do channel binding */ return CURLE_OK; if(!OBJ_find_sigid_algs(X509_get_signature_nid(cert), &algo_nid, NULL)) { @@ -5726,13 +5339,6 @@ static CURLcode ossl_get_channel_binding(struct Curl_easy *data, int sockindex, error: X509_free(cert); return result; -#else - /* No X509_get_signature_nid support */ - (void)data; - (void)sockindex; - (void)binding; - return CURLE_OK; -#endif } size_t Curl_ossl_version(char *buffer, size_t size) @@ -5761,41 +5367,9 @@ size_t Curl_ossl_version(char *buffer, size_t size) #elif defined(OPENSSL_IS_AWSLC) return curl_msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, AWSLC_VERSION_NUMBER_STRING); -#elif defined(OPENSSL_VERSION_STRING) /* OpenSSL 3+ */ +#else /* OpenSSL 3+ */ return curl_msnprintf(buffer, size, "%s/%s", OSSL_PACKAGE, OpenSSL_version(OPENSSL_VERSION_STRING)); -#else - /* not LibreSSL, BoringSSL and not using OpenSSL_version */ - - char sub[3]; - unsigned long ssleay_value; - sub[2]='\0'; - sub[1]='\0'; - ssleay_value = OpenSSL_version_num(); - if(ssleay_value&0xff0) { - int minor_ver = (ssleay_value >> 4) & 0xff; - if(minor_ver > 26) { - /* handle extended version introduced for 0.9.8za */ - sub[1] = (char) ((minor_ver - 1) % 26 + 'a' + 1); - sub[0] = 'z'; - } - else { - sub[0] = (char) (minor_ver + 'a' - 1); - } - } - else - sub[0]='\0'; - - return curl_msnprintf(buffer, size, "%s/%lx.%lx.%lx%s" -#ifdef OPENSSL_FIPS - "-fips" -#endif - , - OSSL_PACKAGE, - (ssleay_value >> 28) & 0xf, - (ssleay_value >> 20) & 0xff, - (ssleay_value >> 12) & 0xff, - sub); #endif } diff --git a/lib/vtls/openssl.h b/lib/vtls/openssl.h index 021d754a62..5b6f35396d 100644 --- a/lib/vtls/openssl.h +++ b/lib/vtls/openssl.h @@ -51,8 +51,7 @@ * BoringSSL: supported since d28f59c27bac (committed 2015-11-19) * LibreSSL: not supported. 3.5.0+ has a stub function that does nothing. */ -#if (OPENSSL_VERSION_NUMBER >= 0x10101000L && \ - !defined(LIBRESSL_VERSION_NUMBER)) || defined(HAVE_BORINGSSL_LIKE) +#if !defined(LIBRESSL_VERSION_NUMBER) || defined(HAVE_BORINGSSL_LIKE) #define HAVE_KEYLOG_CALLBACK #endif diff --git a/lib/vtls/rustls.c b/lib/vtls/rustls.c index ab22909278..3b5bea2c6f 100644 --- a/lib/vtls/rustls.c +++ b/lib/vtls/rustls.c @@ -494,7 +494,7 @@ add_ciphers: for(j = 0; j < default_len; j++) { entry = rustls_default_crypto_provider_ciphersuites_get(j); if(rustls_supported_ciphersuite_protocol_version(entry) == - RUSTLS_TLS_VERSION_TLSV1_3) + RUSTLS_TLS_VERSION_TLSV1_3) continue; /* No duplicates allowed (so selected cannot overflow) */ @@ -586,7 +586,7 @@ init_config_builder(struct Curl_easy *data, } #endif /* USE_ECH */ - cipher_suites = malloc(sizeof(cipher_suites) * (cipher_suites_len)); + cipher_suites = malloc(sizeof(*cipher_suites) * (cipher_suites_len)); if(!cipher_suites) { result = CURLE_OUT_OF_MEMORY; goto cleanup; diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 137e525722..a40c440234 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -119,12 +119,6 @@ #define CALG_SHA_256 0x0000800c #endif -/* Work around typo in CeGCC (as of 0.59.1) w32api headers */ -#if defined(__MINGW32CE__) && \ - !defined(ALG_CLASS_DHASH) && defined(ALG_CLASS_HASH) -#define ALG_CLASS_DHASH ALG_CLASS_HASH -#endif - /* Offered by mingw-w64 v4+. MS SDK 6.0A+. */ #ifndef PKCS12_NO_PERSIST_KEY #define PKCS12_NO_PERSIST_KEY 0x00008000 @@ -385,7 +379,6 @@ set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers, return CURLE_OK; } -#ifndef UNDER_CE /* Function allocates memory for store_path only if CURLE_OK is returned */ static CURLcode get_cert_location(TCHAR *path, DWORD *store_name, TCHAR **store_path, @@ -441,7 +434,6 @@ get_cert_location(TCHAR *path, DWORD *store_name, TCHAR **store_path, return CURLE_OK; } -#endif static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf, @@ -536,7 +528,6 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf, return CURLE_SSL_CONNECT_ERROR; } -#ifndef UNDER_CE /* client certificate */ if(data->set.ssl.primary.clientcert || data->set.ssl.primary.cert_blob) { DWORD cert_store_name = 0; @@ -575,8 +566,8 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf, } } - if((fInCert || blob) && (data->set.ssl.cert_type) && - (!curl_strequal(data->set.ssl.cert_type, "P12"))) { + if((fInCert || blob) && data->set.ssl.cert_type && + !curl_strequal(data->set.ssl.cert_type, "P12")) { failf(data, "schannel: certificate format compatibility error " " for %s", blob ? "(memory blob)" : data->set.ssl.primary.clientcert); @@ -744,7 +735,6 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf, } client_cert_store = cert_store; } -#endif /* allocate memory for the reusable credential handle */ backend->cred = (struct Curl_schannel_cred *) @@ -875,9 +865,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) struct ssl_connect_data *connssl = cf->ctx; struct schannel_ssl_backend_data *backend = (struct schannel_ssl_backend_data *)connssl->backend; -#ifndef UNDER_CE struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf); -#endif struct ssl_config_data *ssl_config = Curl_ssl_cf_get_config(cf, data); SecBuffer outbuf; SecBufferDesc outbuf_desc; @@ -908,11 +896,6 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) backend->use_alpn = FALSE; #endif -#ifdef UNDER_CE - /* certificate validation on Windows CE does not seem to work right; we will - * do it following a more manual process. */ - backend->use_manual_cred_validation = TRUE; -#else if(conn_config->CAfile || conn_config->ca_info_blob) { if(curlx_verify_windows_version(6, 1, 0, PLATFORM_WINNT, VERSION_GREATER_THAN_EQUAL)) { @@ -926,7 +909,6 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) } else backend->use_manual_cred_validation = FALSE; -#endif backend->cred = NULL; @@ -1286,7 +1268,7 @@ schannel_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data) /* The socket must be writeable (or a poll error occurred) before we call InitializeSecurityContext to continue processing the received TLS - records. This is because that function is not idempotent and we don't + records. This is because that function is not idempotent and we do not support partial save/resume sending replies of handshake tokens. */ if(!SOCKET_WRITABLE(Curl_conn_cf_get_socket(cf, data), 0)) { SCH_DEV(infof(data, "schannel: handshake waiting for writeable socket")); @@ -1809,7 +1791,7 @@ schannel_recv_renegotiate(struct Curl_cfilter *cf, struct Curl_easy *data, * data needs to be sent then we block for a writeable socket that should * be writeable immediately except for OS resource constraints. For caller * send if handshake data needs to be received then we block for a readable - * socket, which could take some time, but it's more likely the user has + * socket, which could take some time, but it is more likely the user has * called recv since they had called it prior (only recv can start * renegotiation and probably the user is going to call it again to get * more of their data before calling send). @@ -2573,7 +2555,7 @@ static void schannel_close(struct Curl_cfilter *cf, struct Curl_easy *data) static int schannel_init(void) { -#if defined(HAS_ALPN_SCHANNEL) && !defined(UNDER_CE) +#ifdef HAS_ALPN_SCHANNEL typedef const char *(APIENTRY *WINE_GET_VERSION_FN)(void); #if defined(__clang__) && __clang_major__ >= 16 #pragma clang diagnostic push @@ -2581,8 +2563,7 @@ static int schannel_init(void) #endif WINE_GET_VERSION_FN p_wine_get_version = CURLX_FUNCTION_CAST(WINE_GET_VERSION_FN, - GetProcAddress(GetModuleHandleA("ntdll"), - "wine_get_version")); + GetProcAddress(GetModuleHandle(TEXT("ntdll")), "wine_get_version")); #if defined(__clang__) && __clang_major__ >= 16 #pragma clang diagnostic pop #endif @@ -2599,7 +2580,7 @@ static int schannel_init(void) s_win_has_alpn = curlx_verify_windows_version(6, 3, 0, PLATFORM_WINNT, VERSION_GREATER_THAN_EQUAL); } -#endif /* HAS_ALPN_SCHANNEL && !UNDER_CE */ +#endif /* HAS_ALPN_SCHANNEL */ return Curl_sspi_global_init() == CURLE_OK ? 1 : 0; } @@ -2716,12 +2697,7 @@ static void schannel_checksum(const unsigned char *input, if(!CryptCreateHash(hProv, algId, 0, 0, &hHash)) break; /* failed */ -#ifdef __MINGW32CE__ - /* workaround for CeGCC, should be (const BYTE*) */ - if(!CryptHashData(hHash, (BYTE*)CURL_UNCONST(input), (DWORD)inputlen, 0)) -#else if(!CryptHashData(hHash, input, (DWORD)inputlen, 0)) -#endif break; /* failed */ /* get hash size */ diff --git a/lib/vtls/schannel_int.h b/lib/vtls/schannel_int.h index 05116dfa1a..88f03aaf68 100644 --- a/lib/vtls/schannel_int.h +++ b/lib/vtls/schannel_int.h @@ -31,7 +31,7 @@ #include "vtls.h" #include "../curl_sha256.h" -#if defined(_MSC_VER) && (_MSC_VER <= 1600) +#if defined(_MSC_VER) && (_MSC_VER < 1700) /* Workaround for warning: 'type cast' : conversion from 'int' to 'LPCSTR' of greater size */ #undef CERT_STORE_PROV_MEMORY diff --git a/lib/vtls/schannel_verify.c b/lib/vtls/schannel_verify.c index a508494484..72c42ed353 100644 --- a/lib/vtls/schannel_verify.c +++ b/lib/vtls/schannel_verify.c @@ -55,22 +55,6 @@ #define BACKEND ((struct schannel_ssl_backend_data *)connssl->backend) -#ifdef __MINGW32CE__ -#define CERT_QUERY_OBJECT_BLOB 0x00000002 -#define CERT_QUERY_CONTENT_CERT 1 -#define CERT_QUERY_CONTENT_FLAG_CERT (1 << CERT_QUERY_CONTENT_CERT) -#define CERT_QUERY_FORMAT_BINARY 1 -#define CERT_QUERY_FORMAT_BASE64_ENCODED 2 -#define CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED 3 -#define CERT_QUERY_FORMAT_FLAG_ALL \ - (1 << CERT_QUERY_FORMAT_BINARY) | \ - (1 << CERT_QUERY_FORMAT_BASE64_ENCODED) | \ - (1 << CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED) -#define CERT_CHAIN_REVOCATION_CHECK_CHAIN 0x20000000 -#define CERT_NAME_DISABLE_IE4_UTF8_FLAG 0x00010000 -#define CERT_TRUST_IS_OFFLINE_REVOCATION 0x01000000 -#endif /* __MINGW32CE__ */ - #define MAX_CAFILE_SIZE 1048576 /* 1 MiB */ #define BEGIN_CERT "-----BEGIN CERTIFICATE-----" #define END_CERT "\n-----END CERTIFICATE-----" @@ -112,7 +96,6 @@ struct cert_chain_engine_config_win7 { HCERTSTORE hExclusiveTrustedPeople; }; -#ifndef UNDER_CE static int is_cr_or_lf(char c) { return c == '\r' || c == '\n'; @@ -183,6 +166,7 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store, cert_blob.pbData = (BYTE *)CURL_UNCONST(begin_cert_ptr); cert_blob.cbData = cert_size; + /* Caution: CryptQueryObject() is deprecated */ if(!CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &cert_blob, CERT_QUERY_CONTENT_FLAG_CERT, @@ -221,7 +205,6 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store, cert_context, CERT_STORE_ADD_ALWAYS, NULL); - CertFreeCertificateContext(cert_context); if(!add_cert_result) { char buffer[WINAPI_ERROR_LEN]; failf(data, @@ -237,6 +220,21 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store, num_certs++; } } + + switch(actual_content_type) { + case CERT_QUERY_CONTENT_CERT: + case CERT_QUERY_CONTENT_SERIALIZED_CERT: + CertFreeCertificateContext(cert_context); + break; + case CERT_QUERY_CONTENT_CRL: + case CERT_QUERY_CONTENT_SERIALIZED_CRL: + CertFreeCRLContext((PCCRL_CONTEXT)cert_context); + break; + case CERT_QUERY_CONTENT_CTL: + case CERT_QUERY_CONTENT_SERIALIZED_CTL: + CertFreeCTLContext((PCCTL_CONTEXT)cert_context); + break; + } } } } @@ -534,7 +532,6 @@ static bool get_alt_name_info(struct Curl_easy *data, result = TRUE; return result; } -#endif /* !UNDER_CE */ /* Verify the server's hostname */ CURLcode Curl_verify_host(struct Curl_cfilter *cf, @@ -543,58 +540,6 @@ CURLcode Curl_verify_host(struct Curl_cfilter *cf, CURLcode result = CURLE_PEER_FAILED_VERIFICATION; struct ssl_connect_data *connssl = cf->ctx; CERT_CONTEXT *pCertContextServer = NULL; -#ifdef UNDER_CE - TCHAR cert_hostname_buff[256]; - DWORD len; - - /* This code does not support certificates with multiple alternative names. - * Right now we are only asking for the first preferred alternative name. - * Instead we would need to do all via CERT_NAME_SEARCH_ALL_NAMES_FLAG - * (If Windows CE supports that?) and run this section in a loop for each. - * https://learn.microsoft.com/windows/win32/api/wincrypt/nf-wincrypt-certgetnamestringa - * curl: (51) schannel: CertGetNameString() certificate hostname - * (.google.com) did not match connection (google.com) - */ - len = CertGetNameString(pCertContextServer, - CERT_NAME_DNS_TYPE, - CERT_NAME_DISABLE_IE4_UTF8_FLAG, - NULL, - cert_hostname_buff, - 256); - if(len > 0) { - /* Comparing the cert name and the connection hostname encoded as UTF-8 - * is acceptable since both values are assumed to use ASCII - * (or some equivalent) encoding - */ - char *cert_hostname = curlx_convert_tchar_to_UTF8(cert_hostname_buff); - if(!cert_hostname) { - result = CURLE_OUT_OF_MEMORY; - } - else{ - const char *conn_hostname = connssl->peer.hostname; - if(Curl_cert_hostcheck(cert_hostname, strlen(cert_hostname), - conn_hostname, strlen(conn_hostname))) { - infof(data, - "schannel: connection hostname (%s) validated " - "against certificate name (%s)", - conn_hostname, cert_hostname); - result = CURLE_OK; - } - else{ - failf(data, - "schannel: connection hostname (%s) " - "does not match certificate name (%s)", - conn_hostname, cert_hostname); - } - Curl_safefree(cert_hostname); - } - } - else { - failf(data, - "schannel: CertGetNameString did not provide any " - "certificate name information"); - } -#else SECURITY_STATUS sspi_status; TCHAR *cert_hostname_buff = NULL; size_t cert_hostname_buff_index = 0; @@ -740,7 +685,6 @@ cleanup: if(pCertContextServer) CertFreeCertificateContext(pCertContextServer); -#endif /* !UNDER_CE */ return result; } @@ -757,10 +701,8 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, CERT_CONTEXT *pCertContextServer = NULL; const CERT_CHAIN_CONTEXT *pChainContext = NULL; HCERTCHAINENGINE cert_chain_engine = NULL; -#ifndef UNDER_CE HCERTSTORE trust_store = NULL; HCERTSTORE own_trust_store = NULL; -#endif /* !UNDER_CE */ DEBUGASSERT(BACKEND); @@ -776,7 +718,6 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, result = CURLE_PEER_FAILED_VERIFICATION; } -#ifndef UNDER_CE if(result == CURLE_OK && (conn_config->CAfile || conn_config->ca_info_blob) && BACKEND->use_manual_cred_validation) { @@ -870,7 +811,6 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, } } } -#endif /* !UNDER_CE */ if(result == CURLE_OK) { CERT_CHAIN_PARA ChainPara; @@ -934,7 +874,6 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, } } -#ifndef UNDER_CE if(cert_chain_engine) { CertFreeCertificateChainEngine(cert_chain_engine); } @@ -942,7 +881,6 @@ CURLcode Curl_verify_certificate(struct Curl_cfilter *cf, if(own_trust_store) { CertCloseStore(own_trust_store, 0); } -#endif /* !UNDER_CE */ if(pChainContext) CertFreeCertificateChain(pChainContext); diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 3858cad983..ed0af3d53b 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -772,8 +772,9 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data, /* only do this if pinnedpubkey starts with "sha256//", length 8 */ if(!strncmp(pinnedpubkey, "sha256//", 8)) { CURLcode encode; - size_t encodedlen = 0; - char *encoded = NULL, *pinkeycopy, *begin_pos, *end_pos; + char *cert_hash = NULL; + const char *pinned_hash, *end_pos; + size_t cert_hash_len = 0, pinned_hash_len; unsigned char *sha256sumdigest; if(!Curl_ssl->sha256sum) { @@ -790,50 +791,37 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data, if(!encode) encode = curlx_base64_encode((char *)sha256sumdigest, - CURL_SHA256_DIGEST_LENGTH, &encoded, - &encodedlen); + CURL_SHA256_DIGEST_LENGTH, + &cert_hash, &cert_hash_len); Curl_safefree(sha256sumdigest); if(encode) return encode; - infof(data, " public key hash: sha256//%s", encoded); + infof(data, " public key hash: sha256//%s", cert_hash); - /* it starts with sha256//, copy so we can modify it */ - pinkeycopy = strdup(pinnedpubkey); - if(!pinkeycopy) { - Curl_safefree(encoded); - return CURLE_OUT_OF_MEMORY; - } - /* point begin_pos to the copy, and start extracting keys */ - begin_pos = pinkeycopy; - do { - end_pos = strstr(begin_pos, ";sha256//"); - /* - * if there is an end_pos, null-terminate, otherwise it will go to the - * end of the original string - */ - if(end_pos) - end_pos[0] = '\0'; + pinned_hash = pinnedpubkey; + while(pinned_hash && + !strncmp(pinned_hash, "sha256//", (sizeof("sha256//")-1))) { + pinned_hash = pinned_hash + (sizeof("sha256//")-1); + end_pos = strchr(pinned_hash, ';'); + pinned_hash_len = end_pos ? + (size_t)(end_pos - pinned_hash) : strlen(pinned_hash); - /* compare base64 sha256 digests, 8 is the length of "sha256//" */ - if(encodedlen == strlen(begin_pos + 8) && - !memcmp(encoded, begin_pos + 8, encodedlen)) { + /* compare base64 sha256 digests" */ + if(cert_hash_len == pinned_hash_len && + !memcmp(cert_hash, pinned_hash, cert_hash_len)) { + DEBUGF(infof(data, "public key hash matches pinned value")); result = CURLE_OK; break; } - /* - * change back the null-terminator we changed earlier, - * and look for next begin - */ - if(end_pos) { - end_pos[0] = ';'; - begin_pos = strstr(end_pos, "sha256//"); - } - } while(end_pos && begin_pos); - Curl_safefree(encoded); - Curl_safefree(pinkeycopy); + DEBUGF(infof(data, "public key hash does not match 'sha256//%.*s'", + (int)pinned_hash_len, pinned_hash)); + /* next one or we are at the end */ + pinned_hash = end_pos ? (end_pos + 1) : NULL; + } + Curl_safefree(cert_hash); } else { long filesize; @@ -1435,7 +1423,7 @@ static CURLcode ssl_cf_connect_deferred(struct Curl_cfilter *cf, result = ssl_cf_set_earlydata(cf, data, buf, blen); if(result) return result; - /* we buffered any early data we'd like to send. Actually + /* we buffered any early data we would like to send. Actually * do the connect now which sends it and performs the handshake. */ connssl->earlydata_state = ssl_earlydata_sending; connssl->earlydata_skip = Curl_bufq_len(&connssl->earlydata); diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index b9abc6e3fa..328b12403e 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -386,10 +386,7 @@ static CURLcode cf_ssl_peer_key_add_path(struct dynbuf *buf, * valid when used in another process with different CWD. However, * when a path does not exist, this does not work. Then, we add * the path as is. */ -#ifdef UNDER_CE - (void)is_local; - return curlx_dyn_addf(buf, ":%s-%s", name, path); -#elif defined(_WIN32) +#ifdef _WIN32 char abspath[_MAX_PATH]; if(_fullpath(abspath, path, _MAX_PATH)) return curlx_dyn_addf(buf, ":%s-%s", name, abspath); diff --git a/lib/vtls/vtls_spack.c b/lib/vtls/vtls_spack.c index 10d16f213d..d86f31d727 100644 --- a/lib/vtls/vtls_spack.c +++ b/lib/vtls/vtls_spack.c @@ -36,17 +36,6 @@ #include "../curl_memory.h" #include "../memdebug.h" -#ifdef _MSC_VER -#if _MSC_VER >= 1600 -#include -#else -typedef unsigned char uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -#endif -#endif /* _MSC_VER */ - #ifndef UINT16_MAX #define UINT16_MAX 0xffff #endif diff --git a/lib/vtls/wolfssl.c b/lib/vtls/wolfssl.c index a7883fe08a..a8090d1bf1 100644 --- a/lib/vtls/wolfssl.c +++ b/lib/vtls/wolfssl.c @@ -581,8 +581,10 @@ wssl_setup_session(struct Curl_cfilter *cf, bool do_early_data = FALSE; if(sess_reuse_cb) { result = sess_reuse_cb(cf, data, alpns, scs, &do_early_data); - if(result) + if(result) { + wolfSSL_SESSION_free(session); goto out; + } } #ifdef WOLFSSL_EARLY_DATA if(do_early_data) { @@ -1725,7 +1727,7 @@ static CURLcode wssl_handshake(struct Curl_cfilter *cf, if(ret == WOLFSSL_SUCCESS && conn_config->verifyhost && !connssl->peer.sni) { - /* we have an IP address as host name. */ + /* we have an IP address as hostname. */ WOLFSSL_X509* cert = wolfSSL_get_peer_certificate(wssl->ssl); if(!cert) { failf(data, "unable to get peer certificate"); diff --git a/lib/ws.c b/lib/ws.c index 96a0d61378..140bdece47 100644 --- a/lib/ws.c +++ b/lib/ws.c @@ -1037,7 +1037,7 @@ static CURLcode ws_enc_send(struct Curl_easy *data, * that needs to be encoded into the buffer */ if(buflen < ws->sendbuf_payload) { /* We have been called with LESS buffer data than before. This - * is not how it's supposed too work. */ + * is not how it is supposed too work. */ failf(data, "[WS] curl_ws_send() called with smaller 'buflen' than " "bytes already buffered in previous call, %zu vs %zu", buflen, ws->sendbuf_payload); @@ -2016,4 +2016,4 @@ CURL_EXTERN CURLcode curl_ws_start_frame(CURL *curl, return CURLE_NOT_BUILT_IN; } -#endif /* !CURL_DISABLE_WEBSOCKETS */ +#endif /* !CURL_DISABLE_WEBSOCKETS && !CURL_DISABLE_HTTP */ diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4 index 0e4c4e2655..9aab2736a7 100644 --- a/m4/curl-compilers.m4 +++ b/m4/curl-compilers.m4 @@ -937,11 +937,11 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [cast-function-type-strict]) # with Apple clang it requires 16.0 or above fi dnl clang 20 or later - if test "$compiler_num" -ge "2000"; then + if test "$compiler_num" -ge "2001"; then CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [array-compare]) fi dnl clang 21 or later - if test "$compiler_num" -ge "2100"; then + if test "$compiler_num" -ge "2101"; then CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [c++-hidden-decl]) tmp_CFLAGS="$tmp_CFLAGS -Wno-implicit-void-ptr-cast" CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [tentative-definition-compat]) diff --git a/m4/curl-openssl.m4 b/m4/curl-openssl.m4 index 18c929e2b2..c34268ca94 100644 --- a/m4/curl-openssl.m4 +++ b/m4/curl-openssl.m4 @@ -282,23 +282,22 @@ if test "x$OPT_OPENSSL" != xno; then AC_MSG_RESULT([no]) ]) - AC_MSG_CHECKING([for OpenSSL >= v3]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - #include - ]],[[ - #if (OPENSSL_VERSION_NUMBER >= 0x30000000L) - return 0; - #else - #error older than 3 - #endif - ]]) - ],[ - AC_MSG_RESULT([yes]) - ssl_msg="OpenSSL v3+" - ],[ - AC_MSG_RESULT([no]) - ]) + if test "$ssl_msg" = 'OpenSSL'; then + AC_MSG_CHECKING([for OpenSSL >= v3]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + #include + ]],[[ + #if (OPENSSL_VERSION_NUMBER >= 0x30000000L) + return 0; + #else + #error older than 3 + #endif + ]]) + ],[],[ + AC_MSG_ERROR([OpenSSL 3.0.0 or upper required.]) + ]) + fi fi dnl is this OpenSSL (fork) providing the original QUIC API? diff --git a/m4/xc-lt-iface.m4 b/m4/xc-lt-iface.m4 index a408800353..22eecd349f 100644 --- a/m4/xc-lt-iface.m4 +++ b/m4/xc-lt-iface.m4 @@ -74,7 +74,7 @@ fi if test "x$xc_lt_want_enable_shared" = 'xyes' && test "x$xc_lt_want_enable_static" = 'xyes'; then case $host_os in @%:@ ( - cegcc* | os2* | aix*) + os2* | aix*) xc_lt_want_enable_static='no' ;; esac @@ -265,7 +265,7 @@ elif test "x$allow_undefined_flag" = 'xunsupported'; then xc_lt_shlib_use_no_undefined='yes' fi case $host_os in @%:@ ( - cygwin* | mingw* | cegcc* | os2* | aix*) + cygwin* | mingw* | os2* | aix*) xc_lt_shlib_use_no_undefined='yes' ;; esac diff --git a/projects/README.md b/projects/README.md index 1777074c6d..bf373accde 100644 --- a/projects/README.md +++ b/projects/README.md @@ -105,7 +105,7 @@ that: 3. Navigate to 'Configuration Properties > Debugging > Environment' 4. Add `PATH='Path to DLL';C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem` -... where 'Path to DLL` is the configuration specific path. For example the +... where `Path to DLL` is the configuration specific path. For example the following configurations in Visual Studio 2010 might be: DLL Debug - DLL OpenSSL (Win32): @@ -119,7 +119,7 @@ DLL Debug - DLL OpenSSL (x64): C:\Windows;C:\Windows\System32\Wbem If you are using a configuration that uses multiple third-party library DLLs -(such as DLL Debug - DLL OpenSSL - DLL libssh2) then 'Path to DLL' need to +(such as `DLL Debug - DLL OpenSSL - DLL libssh2`) then 'Path to DLL' need to contain the path to both of these. ## Notes diff --git a/scripts/mk-ca-bundle.pl b/scripts/mk-ca-bundle.pl index af31ccd10e..71880653b2 100755 --- a/scripts/mk-ca-bundle.pl +++ b/scripts/mk-ca-bundle.pl @@ -60,7 +60,7 @@ $opt_d = 'release'; # If the OpenSSL commandline is not in search path you can configure it here! my $openssl = 'openssl'; -my $version = '1.29'; +my $version = '1.30'; $opt_w = 76; # default base64 encoded lines length @@ -100,7 +100,7 @@ my @valid_mozilla_trust_levels = ( # for delegates (i.e. it is not a CA). ); -my $default_signature_algorithms = $opt_s = "MD5"; +my $default_signature_algorithms = $opt_s = "SHA256"; my @valid_signature_algorithms = ( "MD5", @@ -357,7 +357,7 @@ if(!$opt_n) { report "LWP is not available (LWP::UserAgent not found)"; exit 1; } - my $ua = new LWP::UserAgent(agent => "$0/$version"); + my $ua = new LWP::UserAgent(agent => "$0/$version"); $ua->env_proxy(); $resp = $ua->mirror($url, $txt); if($resp && $resp->code eq '304') { diff --git a/scripts/perlcheck.sh b/scripts/perlcheck.sh index 7ec23983d5..9e3c87f695 100755 --- a/scripts/perlcheck.sh +++ b/scripts/perlcheck.sh @@ -42,7 +42,7 @@ echo "parallel: ${procs}" elif git rev-parse --is-inside-work-tree >/dev/null 2>&1; then { git ls-files | grep -E '\.(pl|pm)$' - git grep -l -E '^#!/usr/bin/env perl' + git grep -l '^#!/usr/bin/env perl' } | sort -u else # strip off the leading ./ to make the grep regexes work properly diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a70c96b765..9e2bbed8f0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -121,7 +121,7 @@ if(CURL_HAS_LTO) set_target_properties(${EXE_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE) endif() -if(ENABLE_UNICODE AND MINGW AND NOT MINGW32CE) +if(ENABLE_UNICODE AND MINGW) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) set_property(TARGET ${EXE_NAME} APPEND PROPERTY LINK_OPTIONS "-municode") else() diff --git a/src/config2setopts.c b/src/config2setopts.c index 57e7a73376..154319231f 100644 --- a/src/config2setopts.c +++ b/src/config2setopts.c @@ -141,8 +141,9 @@ static CURLcode url_proto_and_rewrite(char **url, curl_url_set(uh, CURLUPART_URL, *url, CURLU_GUESS_SCHEME | CURLU_NON_SUPPORT_SCHEME); if(!uc) { - if(!curl_url_get(uh, CURLUPART_SCHEME, &schemep, - CURLU_DEFAULT_SCHEME)) { + uc = curl_url_get(uh, CURLUPART_SCHEME, &schemep, + CURLU_DEFAULT_SCHEME); + if(!uc) { #ifdef CURL_DISABLE_IPFS (void)config; #else @@ -162,6 +163,8 @@ static CURLcode url_proto_and_rewrite(char **url, proto = proto_token(schemep); curl_free(schemep); } + else if(uc == CURLUE_OUT_OF_MEMORY) + result = CURLE_OUT_OF_MEMORY; } else if(uc == CURLUE_OUT_OF_MEMORY) result = CURLE_OUT_OF_MEMORY; @@ -209,11 +212,11 @@ static CURLcode ssh_setopts(struct OperationConfig *config, CURL *curl) config->knownhosts = known; } else if(!config->hostpubmd5 && !config->hostpubsha256) { - errorf("Couldn't find a known_hosts file"); + errorf("Could not find a known_hosts file"); return CURLE_FAILED_INIT; } else - warnf("Couldn't find a known_hosts file"); + warnf("Could not find a known_hosts file"); } return CURLE_OK; /* ignore if SHA256 did not work */ } diff --git a/src/terminal.c b/src/terminal.c index 014e2df8c0..867ca6edcf 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -64,7 +64,7 @@ unsigned int get_terminal_columns(void) struct winsize ts; if(!ioctl(STDIN_FILENO, TIOCGWINSZ, &ts)) cols = (int)ts.ws_col; -#elif defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#elif defined(_WIN32) && !defined(CURL_WINDOWS_UWP) { HANDLE stderr_hnd = GetStdHandle(STD_ERROR_HANDLE); CONSOLE_SCREEN_BUFFER_INFO console_info; diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c index 2ea8801705..d4431a74b9 100644 --- a/src/tool_cb_hdr.c +++ b/src/tool_cb_hdr.c @@ -156,7 +156,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata) /* * Truncate the etag save stream, it can have an existing etag value. */ -#if defined(HAVE_FTRUNCATE) && !defined(__MINGW32CE__) +#ifdef HAVE_FTRUNCATE if(ftruncate(fileno(etag_save->stream), 0)) { return CURL_WRITEFUNC_ERROR; } diff --git a/src/tool_cb_rea.c b/src/tool_cb_rea.c index a4c475be8e..cc7ef5a550 100644 --- a/src/tool_cb_rea.c +++ b/src/tool_cb_rea.c @@ -60,7 +60,7 @@ static bool waitfd(int waitms, int fd) struct timeval timeout; if(fd >= FD_SETSIZE) - /* can't wait! */ + /* cannot wait! */ return FALSE; /* wait this long at the most */ @@ -122,11 +122,11 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) On Linux per->infd should be stdin (0) and the block below should not execute */ if(per->uploadfile && !strcmp(per->uploadfile, ".") && per->infd > 0) { -#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) rc = CURL_RECV(per->infd, buffer, curlx_uztosi(sz * nmemb), 0); if(rc < 0) { if(SOCKERRNO == SOCKEWOULDBLOCK) { - CURL_SETERRNO(0); + errno = 0; config->readbusy = TRUE; return CURL_READFUNC_PAUSE; } @@ -142,7 +142,7 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) rc = read(per->infd, buffer, sz*nmemb); if(rc < 0) { if(errno == EAGAIN) { - CURL_SETERRNO(0); + errno = 0; config->readbusy = TRUE; return CURL_READFUNC_PAUSE; } diff --git a/src/tool_cb_see.c b/src/tool_cb_see.c index 68899c5829..fd1b4c563c 100644 --- a/src/tool_cb_see.c +++ b/src/tool_cb_see.c @@ -55,8 +55,8 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence) if(offset > OUR_MAX_SEEK_O) { /* Some precaution code to work around problems with different data sizes - to allow seeking >32-bit even if off_t is 32-bit. Should be very rare - and is really valid on weirdo-systems. */ + to allow seeking >32-bit even if off_t is 32-bit. Should be rare and + is really valid on weirdo-systems. */ curl_off_t left = offset; if(whence != SEEK_SET) @@ -78,7 +78,7 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence) } #endif -#if defined(__AMIGA__) || defined(__MINGW32CE__) +#ifdef __AMIGA__ if(LSEEK_ERROR == lseek(per->infd, (off_t)offset, whence)) #else if(LSEEK_ERROR == lseek(per->infd, offset, whence)) diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index 724706b7a1..48f5fea3c9 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -109,7 +109,7 @@ bool tool_create_output_file(struct OutStruct *outs, return TRUE; } -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 static size_t win_console(intptr_t fhnd, struct OutStruct *outs, char *buffer, size_t bytes, size_t *retp) @@ -247,7 +247,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) struct OperationConfig *config = per->config; size_t bytes = sz * nmemb; bool is_tty = global->isatty; -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 CONSOLE_SCREEN_BUFFER_INFO console_info; intptr_t fhnd; #endif @@ -321,7 +321,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata) } } -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 fhnd = _get_osfhandle(fileno(outs->stream)); /* if Windows console then UTF-8 must be converted to UTF-16 */ if(isatty(fileno(outs->stream)) && diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index 29d5ecc782..2ddb0ad2fc 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -261,7 +261,7 @@ static void free_globalconfig(void) global->trace_stream = NULL; tool_safefree(global->libcurl); -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 free(global->term.buf); #endif } diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index 630f23fd96..dc78f2db44 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -248,7 +248,7 @@ struct OperationConfig { BIT(autoreferer); /* automatically set referer */ BIT(show_headers); /* show headers to data output */ BIT(no_body); /* do not get the body */ - BIT(dirlistonly); /* only get the FTP dir list */ + BIT(dirlistonly); /* only get the FTP directory list */ BIT(unrestricted_auth); /* Continue to send authentication (user+password) when following redirects, even when hostname changed */ @@ -326,7 +326,7 @@ struct OperationConfig { BIT(skip_existing); }; -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 struct termout { wchar_t *buf; DWORD len; @@ -343,7 +343,7 @@ struct GlobalConfig { struct OperationConfig *first; struct OperationConfig *current; struct OperationConfig *last; -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 struct termout term; #endif timediff_t ms_per_transfer; /* start next transfer after (at least) this diff --git a/src/tool_dirhie.c b/src/tool_dirhie.c index 91cc1b60cb..17b2d01e9b 100644 --- a/src/tool_dirhie.c +++ b/src/tool_dirhie.c @@ -23,8 +23,8 @@ ***************************************************************************/ #include "tool_setup.h" -#if defined(_WIN32) && !defined(UNDER_CE) -# include +#ifdef _WIN32 +#include #endif #include "tool_dirhie.h" diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 8e9e5f023d..6204296a8b 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -561,7 +561,7 @@ char **__crt0_glob_function(char *arg) #ifdef _WIN32 -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) && \ +#if !defined(CURL_WINDOWS_UWP) && \ !defined(CURL_DISABLE_CA_SEARCH) && !defined(CURL_CA_SEARCH_SAFE) /* Search and set the CA cert file for Windows. * @@ -613,7 +613,7 @@ CURLcode FindWin32CACert(struct OperationConfig *config, struct curl_slist *GetLoadedModulePaths(void) { struct curl_slist *slist = NULL; -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP HANDLE hnd = INVALID_HANDLE_VALUE; MODULEENTRY32 mod = {0}; @@ -664,7 +664,7 @@ cleanup: bool tool_term_has_bold; -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP /* The terminal settings to restore on exit */ static struct TerminalSettings { HANDLE hStdOut; @@ -735,14 +735,14 @@ static void init_terminal(void) CURLcode win32_init(void) { curlx_now_init(); -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP init_terminal(); #endif return CURLE_OK; } -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP /* The following STDIN non - blocking read techniques are heavily inspired by nmap and ncat (https://nmap.org/ncat/) */ struct win_thread_data { @@ -874,7 +874,7 @@ curl_socket_t win32_stdin_read_thread(void) break; } - /* Start up the thread. We don't bother keeping a reference to it + /* Start up the thread. We do not bother keeping a reference to it because it runs until program termination. From here on out all reads from the stdin handle or file descriptor 0 will be reading from the socket that is fed by the thread. */ @@ -949,7 +949,7 @@ curl_socket_t win32_stdin_read_thread(void) return socket_r; } -#endif /* !CURL_WINDOWS_UWP && !UNDER_CE */ +#endif /* !CURL_WINDOWS_UWP */ #endif /* _WIN32 */ diff --git a/src/tool_doswin.h b/src/tool_doswin.h index 7fe5260476..01500bdbf7 100644 --- a/src/tool_doswin.h +++ b/src/tool_doswin.h @@ -47,7 +47,7 @@ char **__crt0_glob_function(char *arg); #ifdef _WIN32 -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) && \ +#if !defined(CURL_WINDOWS_UWP) && \ !defined(CURL_DISABLE_CA_SEARCH) && !defined(CURL_CA_SEARCH_SAFE) CURLcode FindWin32CACert(struct OperationConfig *config, const TCHAR *bundle_file); @@ -55,9 +55,9 @@ CURLcode FindWin32CACert(struct OperationConfig *config, struct curl_slist *GetLoadedModulePaths(void); CURLcode win32_init(void); -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP curl_socket_t win32_stdin_read_thread(void); -#endif /* !CURL_WINDOWS_UWP && !UNDER_CE */ +#endif #endif /* _WIN32 */ diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 1d127a5842..c1e9abe9d0 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -121,11 +121,7 @@ static struct tool_mime *tool_mime_new_filedata(struct tool_mime *parent, } } else { /* Standard input. */ -#ifdef UNDER_CE - int fd = STDIN_FILENO; -#else int fd = fileno(stdin); -#endif char *data = NULL; curl_off_t size; curl_off_t origin; diff --git a/src/tool_getparam.c b/src/tool_getparam.c index b74b73806d..bd90da1ec7 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -1213,7 +1213,7 @@ static ParameterError parse_ech(struct OperationConfig *config, file = curlx_fopen(nextarg, FOPEN_READTEXT); } if(!file) { - warnf("Couldn't read file \"%s\" " + warnf("Could not read file \"%s\" " "specified for \"--ech ecl:\" option", nextarg); return PARAM_BAD_USE; /* */ @@ -2084,7 +2084,7 @@ static ParameterError opt_bool(struct OperationConfig *config, config->doh_insecure_ok = toggle; break; case C_LIST_ONLY: /* --list-only */ - config->dirlistonly = toggle; /* only list the names of the FTP dir */ + config->dirlistonly = toggle; /* only list names of the FTP directory */ break; case C_MANUAL: /* --manual */ if(toggle) /* --no-manual shows no manual... */ @@ -2876,7 +2876,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ /* is there an '=' ? */ if(!curlx_str_until(&p, &out, MAX_OPTION_LEN, '=') && !curlx_str_single(&p, '=') ) { - /* there's an equal sign */ + /* there is an equal sign */ char tempword[MAX_OPTION_LEN + 1]; memcpy(tempword, curlx_str(&out), curlx_strlen(&out)); tempword[curlx_strlen(&out)] = 0; diff --git a/src/tool_getparam.h b/src/tool_getparam.h index 6b37cc50eb..d5ef54a81d 100644 --- a/src/tool_getparam.h +++ b/src/tool_getparam.h @@ -379,7 +379,7 @@ void parse_cert_parameter(const char *cert_parameter, ParameterError parse_args(int argc, argv_item_t argv[]); -#if defined(UNICODE) && defined(_WIN32) && !defined(UNDER_CE) +#if defined(UNICODE) && defined(_WIN32) #define convert_UTF8_to_tchar(ptr) curlx_convert_UTF8_to_wchar((ptr)) #define convert_tchar_to_UTF8(ptr) curlx_convert_wchar_to_UTF8((ptr)) diff --git a/src/tool_getpass.c b/src/tool_getpass.c index a4dea347ef..014c22813a 100644 --- a/src/tool_getpass.c +++ b/src/tool_getpass.c @@ -42,7 +42,7 @@ # include iodef #endif -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 # include #endif @@ -115,7 +115,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen) return buffer; /* we always return success */ } #define DONE -#endif /* _WIN32 && !UNDER_CE */ +#endif /* _WIN32 */ #ifndef DONE /* not previously provided */ diff --git a/src/tool_ipfs.c b/src/tool_ipfs.c index 89d12fc1c6..0214a2004f 100644 --- a/src/tool_ipfs.c +++ b/src/tool_ipfs.c @@ -176,7 +176,7 @@ CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url, goto clean; /* inputpath might be NULL or a valid pointer now */ - /* set gateway parts in input url */ + /* set gateway parts in input URL */ if(curl_url_set(uh, CURLUPART_SCHEME, gwscheme, CURLU_URLENCODE) || curl_url_set(uh, CURLUPART_HOST, gwhost, CURLU_URLENCODE) || curl_url_set(uh, CURLUPART_PORT, gwport, CURLU_URLENCODE)) diff --git a/src/tool_main.c b/src/tool_main.c index 4e70c1081c..8df63ef05a 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -27,9 +27,7 @@ #include #endif -#ifndef UNDER_CE #include -#endif #ifdef HAVE_FCNTL_H #include @@ -143,7 +141,7 @@ static void memory_tracking_init(void) /* ** curl tool main function. */ -#if defined(_UNICODE) && !defined(UNDER_CE) +#ifdef _UNICODE #if defined(__GNUC__) || defined(__clang__) /* GCC does not know about wmain() */ #pragma GCC diagnostic push @@ -159,7 +157,7 @@ int main(int argc, char *argv[]) tool_init_stderr(); -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 /* Undocumented diagnostic option to list the full paths of all loaded modules. This is purposely pre-init. */ if(argc == 2 && !_tcscmp(argv[1], _T("--dump-module-paths"))) { @@ -169,8 +167,7 @@ int main(int argc, char *argv[]) curl_slist_free_all(head); return head ? 0 : 1; } -#endif -#ifdef _WIN32 + /* win32_init must be called before other init routines. */ result = win32_init(); if(result) { @@ -214,7 +211,7 @@ int main(int argc, char *argv[]) #endif } -#if defined(_UNICODE) && !defined(UNDER_CE) +#ifdef _UNICODE #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif diff --git a/src/tool_operate.c b/src/tool_operate.c index 9aee520f06..8949ce2a52 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -555,25 +555,19 @@ static CURLcode retrycheck(struct OperationConfig *config, } if(truncate && outs->bytes && outs->filename && outs->stream) { -#ifndef __MINGW32CE__ struct_stat fileinfo; /* The output can be a named pipe or a character device etc that cannot be truncated. Only truncate regular files. */ if(!fstat(fileno(outs->stream), &fileinfo) && - S_ISREG(fileinfo.st_mode)) -#else - /* Windows CE's fileno() is bad so just skip the check */ -#endif - { + S_ISREG(fileinfo.st_mode)) { int rc; /* We have written data to an output file, we truncate file */ fflush(outs->stream); notef("Throwing away %" CURL_FORMAT_CURL_OFF_T " bytes", outs->bytes); /* truncate file at the position where we started appending */ -#if defined(HAVE_FTRUNCATE) && !defined(__DJGPP__) && !defined(__AMIGA__) && \ - !defined(__MINGW32CE__) +#if defined(HAVE_FTRUNCATE) && !defined(__DJGPP__) && !defined(__AMIGA__) if(ftruncate(fileno(outs->stream), outs->init)) { /* when truncate fails, we cannot just append as then we will create something strange, bail out */ @@ -625,7 +619,7 @@ static CURLcode post_per_transfer(struct per_transfer *per, if(per->uploadfile) { if(!strcmp(per->uploadfile, ".") && per->infd > 0) { -#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) sclose(per->infd); #else warnf("Closing per->infd != 0: FD == " @@ -1122,7 +1116,7 @@ static void check_stdin_upload(struct OperationConfig *config, CURLX_SET_BINMODE(stdin); if(!strcmp(per->uploadfile, ".")) { -#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) /* non-blocking stdin behavior on Windows is challenging Spawn a new thread that will read from stdin and write out to a socket */ @@ -2100,8 +2094,7 @@ static CURLcode cacertpaths(struct OperationConfig *config) goto fail; } } -#elif !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) && \ - !defined(CURL_DISABLE_CA_SEARCH) +#elif !defined(CURL_WINDOWS_UWP) && !defined(CURL_DISABLE_CA_SEARCH) result = FindWin32CACert(config, TEXT("curl-ca-bundle.crt")); if(result) goto fail; @@ -2123,7 +2116,7 @@ static CURLcode transfer_per_config(struct OperationConfig *config, CURLcode result; *added = FALSE; - /* Check we have a url */ + /* Check we have a URL */ if(!config->url_list || !config->url_list->url) { helpf("(%d) no URL specified", CURLE_FAILED_INIT); result = CURLE_FAILED_INIT; @@ -2234,11 +2227,8 @@ CURLcode operate(int argc, argv_item_t argv[]) { CURLcode result = CURLE_OK; const char *first_arg; -#ifdef UNDER_CE - first_arg = argc > 1 ? strdup(argv[1]) : NULL; -#else + first_arg = argc > 1 ? convert_tchar_to_UTF8(argv[1]) : NULL; -#endif #ifdef HAVE_SETLOCALE /* Override locale for number parsing (only) */ @@ -2252,7 +2242,7 @@ CURLcode operate(int argc, argv_item_t argv[]) strcmp(first_arg, "--disable"))) { parseconfig(NULL, CONFIG_MAX_LEVELS); /* ignore possible failure */ - /* If we had no arguments then make sure a url was specified in .curlrc */ + /* If we had no arguments then make sure a URL was specified in .curlrc */ if((argc < 2) && (!global->first->url_list)) { helpf(NULL); result = CURLE_FAILED_INIT; diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index a832390540..e17955bec3 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -80,7 +80,7 @@ CURLcode urlerr_cvt(CURLUcode ucode) /* * Adds the filename to the URL if it does not already have one. - * url will be freed before return if the returned pointer is different + * URL will be freed before return if the returned pointer is different */ CURLcode add_file_name_to_url(CURL *curl, char **inurlp, const char *filename) { @@ -211,7 +211,7 @@ CURLcode get_url_file_name(char **filename, const char *url) else { /* no slash => empty string, use default */ *filename = strdup("curl_response"); - warnf("No remote file name, uses \"%s\"", *filename); + warnf("No remote filename, uses \"%s\"", *filename); } curl_free(path); diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 008f0fc388..2e7b98f26e 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -135,7 +135,7 @@ ParameterError file2memory_range(char **bufp, size_t *size, FILE *file, offset = starto; } else - /* we can't seek stdin, read 'starto' bytes and throw them away */ + /* we cannot seek stdin, read 'starto' bytes and throw them away */ throwaway = starto; } diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c index 03f9930c5d..5fce4e24d1 100644 --- a/src/tool_parsecfg.c +++ b/src/tool_parsecfg.c @@ -100,10 +100,10 @@ ParameterError parseconfig(const char *filename, int max_recursive) } filename = pathalloc = curlrc; } -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 else { char *fullp; - /* check for .curlrc then _curlrc in the dir of the executable */ + /* check for .curlrc then _curlrc in the directory of the executable */ file = tool_execpath(".curlrc", &fullp); if(!file) file = tool_execpath("_curlrc", &fullp); diff --git a/src/tool_setup.h b/src/tool_setup.h index a661040737..17c2f420b5 100644 --- a/src/tool_setup.h +++ b/src/tool_setup.h @@ -93,15 +93,6 @@ extern FILE *tool_stderr; /* set in init_terminal() */ extern bool tool_term_has_bold; -#ifdef UNDER_CE -# undef isatty -# define isatty(fd) 0 /* fd is void*, expects int */ -# undef _get_osfhandle -# define _get_osfhandle(fd) (fd) -# undef _getch -# define _getch() 0 -#endif - #ifndef HAVE_FTRUNCATE int tool_ftruncate64(int fd, curl_off_t where); diff --git a/src/tool_util.c b/src/tool_util.c index f8415d2a17..a2798876ea 100644 --- a/src/tool_util.c +++ b/src/tool_util.c @@ -80,17 +80,9 @@ int struplocompare4sort(const void *p1, const void *p2) } #ifdef USE_TOOL_FTRUNCATE - -#ifdef UNDER_CE -/* 64-bit lseek-like function unavailable */ -# undef _lseeki64 -# define _lseeki64(hnd,ofs,whence) lseek(hnd,ofs,whence) -#endif - /* * Truncate a file handle at a 64-bit position 'where'. */ - int tool_ftruncate64(int fd, curl_off_t where) { intptr_t handle = _get_osfhandle(fd); @@ -103,10 +95,9 @@ int tool_ftruncate64(int fd, curl_off_t where) return 0; } - #endif /* USE_TOOL_FTRUNCATE */ -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 FILE *tool_execpath(const char *filename, char **pathp) { static char filebuffer[512]; diff --git a/src/tool_util.h b/src/tool_util.h index c97c1c03c2..12206ce980 100644 --- a/src/tool_util.h +++ b/src/tool_util.h @@ -34,7 +34,7 @@ struct timeval tvrealnow(void); int struplocompare(const char *p1, const char *p2); int struplocompare4sort(const void *p1, const void *p2); -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 FILE *tool_execpath(const char *filename, char **pathp); #endif diff --git a/src/tool_writeout.h b/src/tool_writeout.h index eebfde03b2..70b3cd148b 100644 --- a/src/tool_writeout.h +++ b/src/tool_writeout.h @@ -56,7 +56,7 @@ typedef enum { VAR_INPUT_URLQUERY, VAR_INPUT_URLFRAGMENT, VAR_INPUT_URLZONEID, - /* the same ones again for url *effective* */ + /* the same ones again for URL *effective* */ VAR_INPUT_URLESCHEME, /* keep this the first URLE* variable */ VAR_INPUT_URLEUSER, VAR_INPUT_URLEPASSWORD, diff --git a/tests/Makefile.am b/tests/Makefile.am index 12fdc29cda..677a17cd99 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -84,7 +84,7 @@ EXTRA_DIST = \ valgrind.supp \ $(TESTSCRIPTS) -# we have two variables here to make sure DIST_SUBDIRS won't get 'unit' +# we have two variables here to make sure DIST_SUBDIRS does not get 'unit' # added twice as then targets such as 'distclean' misbehave and try to # do things twice in that subdir at times (and thus fails). if BUILD_UNITTESTS @@ -108,7 +108,7 @@ curl: TEST_COMMON = if CROSSCOMPILING -TEST = @echo "NOTICE: we can't run the tests when cross-compiling!" +TEST = @echo "NOTICE: we cannot run the tests when cross-compiling!" PYTEST = $(TEST) else # if not cross-compiling: @@ -124,8 +124,8 @@ TEST_F = -a -w -p -r TEST_T = -a -w -t -j20 TEST_E = -a -w -e -# ~ means that it will run all tests matching the keyword, but will -# ignore their results (since these ones are likely to fail for no good reason) +# ~ means that it runs all tests matching the keyword, but ignores +# their results (since these ones are likely to fail for no good reason) TEST_NF = -a -w -p ~flaky ~timing-dependent # special target for CI use diff --git a/tests/allversions.pm b/tests/allversions.pm index 7673a5fcca..8ae47fc599 100644 --- a/tests/allversions.pm +++ b/tests/allversions.pm @@ -33,7 +33,7 @@ our %pastversion; sub allversions { my ($file) = @_; open(A, "<$file") || - die "can't open the versions file $file\n"; + die "cannot open the versions file $file\n"; my $before = 1; my $relcount; while() { diff --git a/tests/certs/genserv.pl b/tests/certs/genserv.pl index 42aba5370e..2e61ecece6 100755 --- a/tests/certs/genserv.pl +++ b/tests/certs/genserv.pl @@ -55,7 +55,7 @@ if(!$CAPREFIX) { } elsif(! -f "$CAPREFIX-ca.cacert" || ! -f "$CAPREFIX-ca.key") { - if($OPENSSL eq basename($OPENSSL)) { # has no dir component + if($OPENSSL eq basename($OPENSSL)) { # has no directory component # find openssl in PATH my $found = 0; foreach(File::Spec->path()) { diff --git a/tests/certs/test-ca.prm b/tests/certs/test-ca.prm index 5b91802981..c86c4e40cc 100644 --- a/tests/certs/test-ca.prm +++ b/tests/certs/test-ca.prm @@ -27,6 +27,6 @@ string_mask = utf8only countryName = "Country Name" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = Northern Nowhere Trust Anchor diff --git a/tests/certs/test-client-cert.prm b/tests/certs/test-client-cert.prm index e78225c674..99962e21c1 100644 --- a/tests/certs/test-client-cert.prm +++ b/tests/certs/test-client-cert.prm @@ -29,6 +29,6 @@ string_mask = utf8only countryName = "Country Name is Northern Nowhere" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = localhost diff --git a/tests/certs/test-client-eku-only.prm b/tests/certs/test-client-eku-only.prm index c4e61eec46..2ada8f9e7e 100644 --- a/tests/certs/test-client-eku-only.prm +++ b/tests/certs/test-client-eku-only.prm @@ -29,6 +29,6 @@ string_mask = utf8only countryName = "Country Name is Northern Nowhere" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = localhost diff --git a/tests/certs/test-localhost-san-first.prm b/tests/certs/test-localhost-san-first.prm index 40ac460445..d354eda819 100644 --- a/tests/certs/test-localhost-san-first.prm +++ b/tests/certs/test-localhost-san-first.prm @@ -29,6 +29,6 @@ string_mask = utf8only countryName = "Country Name is Northern Nowhere" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = localhost.nn diff --git a/tests/certs/test-localhost-san-last.prm b/tests/certs/test-localhost-san-last.prm index 2de9dd8bab..e8c87a19b0 100644 --- a/tests/certs/test-localhost-san-last.prm +++ b/tests/certs/test-localhost-san-last.prm @@ -29,6 +29,6 @@ string_mask = utf8only countryName = "Country Name is Northern Nowhere" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = localhost.nn diff --git a/tests/certs/test-localhost.nn.prm b/tests/certs/test-localhost.nn.prm index 16411614ca..aa3f3650bd 100644 --- a/tests/certs/test-localhost.nn.prm +++ b/tests/certs/test-localhost.nn.prm @@ -29,6 +29,6 @@ string_mask = utf8only countryName = "Country Name is Northern Nowhere" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = localhost.nn diff --git a/tests/certs/test-localhost.prm b/tests/certs/test-localhost.prm index ca7eced96d..1d574a6b6c 100644 --- a/tests/certs/test-localhost.prm +++ b/tests/certs/test-localhost.prm @@ -29,6 +29,6 @@ string_mask = utf8only countryName = "Country Name is Northern Nowhere" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = localhost diff --git a/tests/certs/test-localhost0h.prm b/tests/certs/test-localhost0h.prm index 03bd2f12cf..2b6b059377 100644 --- a/tests/certs/test-localhost0h.prm +++ b/tests/certs/test-localhost0h.prm @@ -30,6 +30,6 @@ string_mask = utf8only countryName = "Country Name is Northern Nowhere" countryName_value = NN organizationName = "Organization Name" -organizationName_value = Edel Curl Arctic Illudium Research Cloud +organizationName_value = Edel curl Arctic Illudium Research Cloud commonName = "Common Name" commonName_value = localhost diff --git a/tests/data/test1034 b/tests/data/test1034 index b99368fb9f..f503d97700 100644 --- a/tests/data/test1034 +++ b/tests/data/test1034 @@ -29,10 +29,10 @@ codeset-utf8 LC_ALL=C.UTF-8 -HTTP over proxy with malformatted IDN host name +HTTP over proxy with malformatted IDN hostname -# This host name contains an invalid UTF-8 byte sequence that can't be +# This hostname contains an invalid UTF-8 byte sequence that cannot be # converted into an IDN name url = "http://invalid-utf8-%hex[%e2%90]hex%.local/page/%TESTNUMBER" diff --git a/tests/data/test1035 b/tests/data/test1035 index 50a762d726..b36872fd3e 100644 --- a/tests/data/test1035 +++ b/tests/data/test1035 @@ -27,7 +27,7 @@ codeset-utf8 LC_ALL=C.UTF-8 -HTTP over proxy with too long IDN host name +HTTP over proxy with too long IDN hostname http://too-long-IDN-name-c%hex[%c3%bc]hex%rl-r%hex[%c3%bc]hex%le%hex[%c3%9f]hex%-la-la-la-dee-da-flooby-nooby.local/page/%TESTNUMBER -x %HOSTIP:%NOLISTENPORT diff --git a/tests/data/test1038 b/tests/data/test1038 index 294c7b94c1..f384a1d236 100644 --- a/tests/data/test1038 +++ b/tests/data/test1038 @@ -26,7 +26,7 @@ FTP PASV upload resume from end of file ftp://%HOSTIP:%FTPPORT/%TESTNUMBER -T %LOGDIR/upload%TESTNUMBER -C - -this is the *****cr@p******** that we're gonna upload +this is the *****cr@p******** that we are gonna upload worx? @@ -45,7 +45,7 @@ APPE %TESTNUMBER QUIT -cr@p******** that we're gonna upload +cr@p******** that we are gonna upload worx? diff --git a/tests/data/test1039 b/tests/data/test1039 index 6637c5721b..39709ddb5a 100644 --- a/tests/data/test1039 +++ b/tests/data/test1039 @@ -26,7 +26,7 @@ FTP PASV upload resume from end of empty file ftp://%HOSTIP:%FTPPORT/%TESTNUMBER -T %LOGDIR/upload%TESTNUMBER -C - -this is the *****cr@p******** that we're gonna upload +this is the *****cr@p******** that we are gonna upload worx? @@ -45,7 +45,7 @@ STOR %TESTNUMBER QUIT -this is the *****cr@p******** that we're gonna upload +this is the *****cr@p******** that we are gonna upload worx? diff --git a/tests/data/test1041 b/tests/data/test1041 index 68ec259d6f..ebc62d3006 100644 --- a/tests/data/test1041 +++ b/tests/data/test1041 @@ -50,7 +50,7 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER -T%LOGDIR/test%TESTNUMBER.txt -C - # Verify data after the test has been "shot" -# curl doesn't do a HEAD request on the remote file so it has no idea whether +# curl does not do a HEAD request on the remote file so it has no idea whether # it can skip part of the file or not. Instead, it sends the entire file. PUT /%TESTNUMBER HTTP/1.1 diff --git a/tests/data/test1059 b/tests/data/test1059 index 688b92850a..66b6dcf6d1 100644 --- a/tests/data/test1059 +++ b/tests/data/test1059 @@ -42,7 +42,7 @@ ftp://test-number:%TESTNUMBER/wanted/page -p -x %HOSTIP:%HTTPPORT # # Verify data after the test has been "shot" -# The server doesn't implement CONNECT for ftp, so this must be a failure test +# The server does not implement CONNECT for ftp, so this must be a failure test 56 diff --git a/tests/data/test1069 b/tests/data/test1069 index 5156941833..2976ff1d6d 100644 --- a/tests/data/test1069 +++ b/tests/data/test1069 @@ -23,7 +23,7 @@ HTTP 1.0 PUT from stdin with no content length http://%HOSTIP:%HTTPPORT/bzz/%TESTNUMBER -T - -0 -this data can't be sent +this data cannot be sent diff --git a/tests/data/test1101 b/tests/data/test1101 index a6471a4a64..9f2678ec46 100644 --- a/tests/data/test1101 +++ b/tests/data/test1101 @@ -28,7 +28,7 @@ boo http -NO_PROXY test, with user name in URL +NO_PROXY test, with username in URL diff --git a/tests/data/test1108 b/tests/data/test1108 index 107ef8d55c..1318e0a1b9 100644 --- a/tests/data/test1108 +++ b/tests/data/test1108 @@ -37,7 +37,7 @@ PASS ftp@example.com PWD PRET RETR %TESTNUMBER -# we expect that the server doesn't understand PRET +# we expect that the server does not understand PRET 84 diff --git a/tests/data/test112 b/tests/data/test112 index 9a73da35a5..d680d05e90 100644 --- a/tests/data/test112 +++ b/tests/data/test112 @@ -20,10 +20,10 @@ ftp FTP PASV upload resume -ftp://%HOSTIP:%FTPPORT/%TESTNUMBER -T %LOGDIR/upload%TESTNUMBER -C 40 +ftp://%HOSTIP:%FTPPORT/%TESTNUMBER -T %LOGDIR/upload%TESTNUMBER -C 41 -this is the *****crap******** that we're gonna upload +this is the *****crap******** that we are gonna upload worx? diff --git a/tests/data/test1173 b/tests/data/test1173 index e49ed9336f..bc666872d7 100644 --- a/tests/data/test1173 +++ b/tests/data/test1173 @@ -11,7 +11,7 @@ documentation # Client-side -Manpage syntax checks +Man page syntax checks diff --git a/tests/data/test1185 b/tests/data/test1185 index 5571888aae..e5efc45e2e 100644 --- a/tests/data/test1185 +++ b/tests/data/test1185 @@ -81,7 +81,7 @@ void startfunc(int a, int b) { // CPP comment ? - /* comment doesn't end + /* comment does not end diff --git a/tests/data/test1187 b/tests/data/test1187 index 3cae202eb1..82debafd04 100644 --- a/tests/data/test1187 +++ b/tests/data/test1187 @@ -21,7 +21,7 @@ Mime smtp -SMTP multipart with file name escaping +SMTP multipart with filename escaping From: different diff --git a/tests/data/test1208 b/tests/data/test1208 index 8acf3c1cd7..4c0e6aafda 100644 --- a/tests/data/test1208 +++ b/tests/data/test1208 @@ -41,7 +41,7 @@ FTP PORT download, no data conn and no transient negative reply s/^EPRT \|1\|(\S*)/EPRT \|1\|/ -# This test doesn't send a QUIT because the main state machine in multi.c +# This test does not send a QUIT because the main state machine in multi.c # triggers the timeout and sets the CURLE_OPERATION_TIMEDOUT error (28) for # which the FTP disconnect code generically has to assume could mean the # control the connection and thus it cannot send any command. diff --git a/tests/data/test1216 b/tests/data/test1216 index bb8e043b81..87718fd8d9 100644 --- a/tests/data/test1216 +++ b/tests/data/test1216 @@ -28,7 +28,7 @@ This server says moo http -HTTP cookie domains tailmatching the host name +HTTP cookie domains tailmatching the hostname http://example.fake/c/%TESTNUMBER http://bexample.fake/c/%TESTNUMBER -b %LOGDIR/injar%TESTNUMBER -x %HOSTIP:%HTTPPORT diff --git a/tests/data/test1218 b/tests/data/test1218 index e66d84e1eb..28f4fb0649 100644 --- a/tests/data/test1218 +++ b/tests/data/test1218 @@ -8,7 +8,7 @@ cookies -# This test is very similar to 1216, only that it sets the cookies from the +# This test is similar to 1216, only that it sets the cookies from the # first site instead of reading from a file diff --git a/tests/data/test1229 b/tests/data/test1229 index 781fa61b7a..eddce04f25 100644 --- a/tests/data/test1229 +++ b/tests/data/test1229 @@ -57,7 +57,7 @@ crypto digest -HTTP with Digest authorization with user name needing escape +HTTP with Digest authorization with username needing escape http://%5cuser%22:password@%HOSTIP:%HTTPPORT/%TESTNUMBER --digest diff --git a/tests/data/test1233 b/tests/data/test1233 index e8b45cd040..4a0b7023a4 100644 --- a/tests/data/test1233 +++ b/tests/data/test1233 @@ -9,7 +9,7 @@ connect to non-listen # Server-side -# Assuming there's nothing listening on port 1 +# Assuming there is nothing listening on port 1 REPLY EPSV 229 Entering Passive Mode (|||1|) diff --git a/tests/data/test1237 b/tests/data/test1237 index 2c572ace27..285e467929 100644 --- a/tests/data/test1237 +++ b/tests/data/test1237 @@ -24,7 +24,7 @@ Content-Type: text/html http -URL with 1000+ letter user name + password +URL with 1000+ letter username + password "%repeat[1000 x A]%:%repeat[1002 x B]%@%HOSTIP:%HTTPPORT/%TESTNUMBER" diff --git a/tests/data/test1238 b/tests/data/test1238 index 49b9e65e57..66d0dde84c 100644 --- a/tests/data/test1238 +++ b/tests/data/test1238 @@ -15,7 +15,7 @@ DELAY writedelay: 2000 -# ~1200 bytes (so that they don't fit in two 512 byte chunks) +# ~1200 bytes (so that they do not fit in two 512 byte chunks) 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 diff --git a/tests/data/test1246 b/tests/data/test1246 index e1f11cef5b..02054a3199 100644 --- a/tests/data/test1246 +++ b/tests/data/test1246 @@ -35,7 +35,7 @@ Connection: close http -URL with '#' at end of host name instead of '/' +URL with '#' at end of hostname instead of '/' --proxy http://%HOSTIP:%HTTPPORT http://test.remote.haxx.se.%TESTNUMBER:%HTTPPORT#@127.0.0.1/tricked.html no-scheme-url.com.%TESTNUMBER:%HTTPPORT#@127.127.127.127/again.html diff --git a/tests/data/test1264 b/tests/data/test1264 index 9eebd58f94..dbe4152d40 100644 --- a/tests/data/test1264 +++ b/tests/data/test1264 @@ -16,7 +16,7 @@ HTTP GET http -HTTP URL with space in host name +HTTP URL with space in hostname -g "http://127.0.0.1 www.example.com/we/want/%TESTNUMBER" diff --git a/tests/data/test1318 b/tests/data/test1318 index 27e0d80c13..0ccd123eb8 100644 --- a/tests/data/test1318 +++ b/tests/data/test1318 @@ -33,7 +33,7 @@ Content-Length: 0 http -HTTP with --resolve and same host name using different cases +HTTP with --resolve and same hostname using different cases --resolve MiXeDcAsE.cOm:%HTTPPORT:%HOSTIP http://MiXeDcAsE.cOm:%HTTPPORT/%TESTNUMBER http://mixedcase.com:%HTTPPORT/%TESTNUMBER0001 diff --git a/tests/data/test1411 b/tests/data/test1411 index ae58242f22..6eaa65d328 100644 --- a/tests/data/test1411 +++ b/tests/data/test1411 @@ -31,7 +31,7 @@ Funny-head: yesyes http -# make sure there's no Expect: 100-continue when there's no file to send! +# make sure there is no Expect: 100-continue when there is no file to send! HTTP with zero size file PUT diff --git a/tests/data/test1421 b/tests/data/test1421 index 3cab703b4a..82a8061a1f 100644 --- a/tests/data/test1421 +++ b/tests/data/test1421 @@ -30,7 +30,7 @@ connection-monitor http -Reusing HTTP proxy connection for two different host names +Reusing HTTP proxy connection for two different hostnames --proxy http://%HOSTIP:%HTTPPORT http://test.remote.haxx.se.%TESTNUMBER:8990/ http://different.remote.haxx.se.%TESTNUMBER:8990 diff --git a/tests/data/test1447 b/tests/data/test1447 index 517c22b04d..f28c250226 100644 --- a/tests/data/test1447 +++ b/tests/data/test1447 @@ -28,7 +28,7 @@ Provide illegal proxy name # # Verify data after the test has been "shot" -# Couldn't resolve proxy name +# Could not resolve proxy name 5 diff --git a/tests/data/test1448 b/tests/data/test1448 index aed178fc58..d35d5b5e6f 100644 --- a/tests/data/test1448 +++ b/tests/data/test1448 @@ -46,7 +46,7 @@ codeset-utf8 LC_ALL=C.UTF-8 -Redirect following to UTF-8 IDN host name +Redirect following to UTF-8 IDN hostname diff --git a/tests/data/test1453 b/tests/data/test1453 index 28f6ed732f..bfbe692032 100644 --- a/tests/data/test1453 +++ b/tests/data/test1453 @@ -27,7 +27,7 @@ tftp://%HOSTIP:%NOLISTENPORT/%repeat[503 x a]%z # # Verify data after the test has been "shot" -# TFTP file name too long +# TFTP filename too long 71 diff --git a/tests/data/test1456 b/tests/data/test1456 index 6f1b0260d5..c80df3b7c6 100644 --- a/tests/data/test1456 +++ b/tests/data/test1456 @@ -23,7 +23,7 @@ Connection: close Content-Type: text/html Funny-head: yesyes -These data aren't actually sent to the client +These data are not actually sent to the client diff --git a/tests/data/test1459 b/tests/data/test1459 index e4901d74f0..6f3105e8ed 100644 --- a/tests/data/test1459 +++ b/tests/data/test1459 @@ -14,7 +14,7 @@ sftp sftp -!oldlibssh +!badlibssh SFTP with corrupted known_hosts @@ -30,7 +30,8 @@ R93Ey5VtBeBblYTRlFXBWJgKFcTKBRJ/O4qBZwbUgt10AHj31i6h8NehfT19tR8wG/YCmj3KtYLHmwdz # Verify data after the test has been "shot" -# old libssh installs return the wrong thing +# badlibssh configurations return the wrong thing: 67 CURLE_LOGIN_DENIED, +# instead of 60 CURLE_PEER_FAILED_VERIFICATION. 60 diff --git a/tests/data/test1468 b/tests/data/test1468 index ec004b368b..7cb9b13456 100644 --- a/tests/data/test1468 +++ b/tests/data/test1468 @@ -40,7 +40,7 @@ http socks5unix -HTTP GET with host name using SOCKS5h via Unix sockets +HTTP GET with hostname using SOCKS5h via Unix sockets http://this.is.a.host.name:%HTTPPORT/%TESTNUMBER --proxy socks5h://localhost%SOCKSUNIXPATH diff --git a/tests/data/test1470 b/tests/data/test1470 index 2a8e0ea295..c93af27f7d 100644 --- a/tests/data/test1470 +++ b/tests/data/test1470 @@ -41,7 +41,7 @@ https socks5unix -HTTPS GET with host name using SOCKS5h via Unix sockets +HTTPS GET with hostname using SOCKS5h via Unix sockets https://this.is.a.host.name:%HTTPSPORT/%TESTNUMBER --insecure --proxy socks5h://localhost%SOCKSUNIXPATH diff --git a/tests/data/test1471 b/tests/data/test1471 index 27343fd2fc..b07af3a9ae 100644 --- a/tests/data/test1471 +++ b/tests/data/test1471 @@ -28,7 +28,7 @@ red.onion # # Verify data after the test has been "shot" -# Couldn't resolve host name +# Could not resolve hostname 6 diff --git a/tests/data/test1472 b/tests/data/test1472 index 2266e3ec9b..ed15302a04 100644 --- a/tests/data/test1472 +++ b/tests/data/test1472 @@ -28,7 +28,7 @@ tasty.onion. # # Verify data after the test has been "shot" -# Couldn't resolve host name +# Could not resolve hostname 6 diff --git a/tests/data/test1491 b/tests/data/test1491 index 84d4e94e0f..fc856671e4 100644 --- a/tests/data/test1491 +++ b/tests/data/test1491 @@ -14,7 +14,7 @@ FILE file -file:// don't overwrite self with --skip-existing +file:// do not overwrite self with --skip-existing file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt -o %LOGDIR/test%TESTNUMBER.txt --skip-existing diff --git a/tests/data/test151 b/tests/data/test151 index 727a7e9100..92a513986e 100644 --- a/tests/data/test151 +++ b/tests/data/test151 @@ -13,8 +13,8 @@ HTTP/1.0 401 BAD BOY Server: swsclose Content-Type: text/html -This contains a response code >= 400, so curl shouldn't display this. Even -though it's a response code that triggers authentication, we're not using +This contains a response code >= 400, so curl should not display this. Even +though it is a response code that triggers authentication, we are not using authentication so we should still fail. diff --git a/tests/data/test1513 b/tests/data/test1513 index ff8c03f279..d4e741c534 100644 --- a/tests/data/test1513 +++ b/tests/data/test1513 @@ -29,7 +29,7 @@ lib%TESTNUMBER return failure immediately from progress callback -# this server/host won't be used for real +# this server/host will not be used for real http://%HOSTIP:%HTTPPORT/%TESTNUMBER diff --git a/tests/data/test1516 b/tests/data/test1516 index 5c30305bf1..226b8d3c9d 100644 --- a/tests/data/test1516 +++ b/tests/data/test1516 @@ -10,7 +10,7 @@ resolve -# Close the connection after the first request but don't tell the client to do +# Close the connection after the first request but do not tell the client to do # so! When starting the second request it'll detect a dead connection and must # not clean the DNS entries added manually. diff --git a/tests/data/test152 b/tests/data/test152 index 2f4ee6938d..0a9a12d334 100644 --- a/tests/data/test152 +++ b/tests/data/test152 @@ -14,8 +14,8 @@ HTTP/1.0 401 BAD BOY Server: swsclose Content-Type: text/html -This contains a response code >= 400, so curl shouldn't display this. Even -though it's a response code that triggers authentication, we're not using +This contains a response code >= 400, so curl should not display this. Even +though it is a response code that triggers authentication, we are not using authentication so we should still fail. diff --git a/tests/data/test1553 b/tests/data/test1553 index 5b4f11e554..7deea6869b 100644 --- a/tests/data/test1553 +++ b/tests/data/test1553 @@ -42,7 +42,7 @@ IMAP cleanup before a connection was created lib%TESTNUMBER -# this MUST use a host name that doesn't resolve +# this MUST use a hostname that does not resolve imap://non-existing-host.haxx.se:%IMAPPORT/%TESTNUMBER diff --git a/tests/data/test1555 b/tests/data/test1555 index 75e1e5c258..5332aca6eb 100644 --- a/tests/data/test1555 +++ b/tests/data/test1555 @@ -29,7 +29,7 @@ lib%TESTNUMBER verify api is protected against calls from callbacks -# this server/host won't be used for real +# this server/host will not be used for real http://%HOSTIP:%HTTPPORT/%TESTNUMBER diff --git a/tests/data/test1557 b/tests/data/test1557 index 0c308f0335..0e0a3515a3 100644 --- a/tests/data/test1557 +++ b/tests/data/test1557 @@ -15,7 +15,7 @@ lib%TESTNUMBER -Remove easy handle in pending connections doesn't leave dangling entry +Remove easy handle in pending connections does not leave dangling entry hostname.invalid diff --git a/tests/data/test1561 b/tests/data/test1561 index 5af47edce0..df9477dd47 100644 --- a/tests/data/test1561 +++ b/tests/data/test1561 @@ -69,7 +69,7 @@ https https -Cookies set over HTTP can't override secure ones +Cookies set over HTTP cannot override secure ones --insecure https://%HOSTIP:%HTTPSPORT/%TESTNUMBER0001 -L -c %LOGDIR/jar%TESTNUMBER.txt -H "Host: www.example.com" http://%HOSTIP:%HTTPPORT/%TESTNUMBER0002 -L -c %LOGDIR/jar%TESTNUMBER.txt -H "Host: www.example.com" diff --git a/tests/data/test1590 b/tests/data/test1590 index 8d459601be..309ec3801a 100644 --- a/tests/data/test1590 +++ b/tests/data/test1590 @@ -42,7 +42,7 @@ IMAP cleanup before a connection was created lib1553 -# it is important this uses a host name that resolves successfully +# it is important this uses a hostname that resolves successfully imap://localhost:%IMAPPORT/%TESTNUMBER diff --git a/tests/data/test1592 b/tests/data/test1592 index aacdb9eadb..9a3aa800c3 100644 --- a/tests/data/test1592 +++ b/tests/data/test1592 @@ -16,7 +16,7 @@ timing-dependent lib%TESTNUMBER -HTTP request, remove handle while resolving, don't block +HTTP request, remove handle while resolving, do not block diff --git a/tests/data/test161 b/tests/data/test161 index 201fe52bfa..7908c41d2a 100644 --- a/tests/data/test161 +++ b/tests/data/test161 @@ -32,7 +32,7 @@ ftp://%HOSTIP:%FTPPORT/%TESTNUMBER # Verify data after the test has been "shot" -# This doesn't send QUIT because of known bug: +# This does not send QUIT because of known bug: # "7.8 Premature transfer end but healthy control channel" USER anonymous diff --git a/tests/data/test162 b/tests/data/test162 index 02809e8127..196475ac86 100644 --- a/tests/data/test162 +++ b/tests/data/test162 @@ -17,9 +17,9 @@ Proxy-Authenticate: Basic realm="Squid proxy-caching web server" Server: swsclose Content-Type: text/html -Even though it's the response code that triggers authentication, we're -using NTLM and the server isn't, so we should fail. We know the server -isn't because there's no Proxy-Authorization: NTLM header +Even though it is the response code that triggers authentication, we are +using NTLM and the server is not, so we should fail. We know the server +is not because there is no Proxy-Authorization: NTLM header diff --git a/tests/data/test1631 b/tests/data/test1631 index 6e28263b3d..af6a95bb8b 100644 --- a/tests/data/test1631 +++ b/tests/data/test1631 @@ -56,7 +56,7 @@ proxy # The second CONNECT will be made to the dynamic port number the FTP server -# opens for us, so we can't compare with a known pre-existing number! +# opens for us, so we cannot compare with a known pre-existing number! s/((https.proxy):(\d+))/$2:12345/ diff --git a/tests/data/test1632 b/tests/data/test1632 index ebf91098d5..bfb446fd33 100644 --- a/tests/data/test1632 +++ b/tests/data/test1632 @@ -65,7 +65,7 @@ proxy # The second and third CONNECT will be made to the dynamic port number the FTP -# server opens for us, so we can't compare with known pre-existing numbers! +# server opens for us, so we cannot compare with known pre-existing numbers! s/((https.proxy):(\d+))/$2:12345/ diff --git a/tests/data/test165 b/tests/data/test165 index 0d1c2ebdd0..cd193b5532 100644 --- a/tests/data/test165 +++ b/tests/data/test165 @@ -36,7 +36,7 @@ codeset-utf8 LC_ALL=C.UTF-8 -HTTP over proxy with IDN host name +HTTP over proxy with IDN hostname http://www.%hex[%c3%a5%c3%a4%c3%b6]hex%.se/page/%TESTNUMBER -x %HOSTIP:%HTTPPORT http://www.gro%hex[%c3%9f]hex%e.de/page/%TESTNUMBER diff --git a/tests/data/test187 b/tests/data/test187 index c3d1199a23..2a405281bc 100644 --- a/tests/data/test187 +++ b/tests/data/test187 @@ -51,7 +51,7 @@ If this is received, the location following worked http -HTTP redirect with bad host name separation and slash in parameters +HTTP redirect with bad hostname separation and slash in parameters http://%HOSTIP:%HTTPPORT?oh=what-weird=test/%TESTNUMBER -L diff --git a/tests/data/test189 b/tests/data/test189 index e8e8044049..173293b9c4 100644 --- a/tests/data/test189 +++ b/tests/data/test189 @@ -42,7 +42,7 @@ Content-Length: 15 http -HTTP GET with resume and redirect (to a page that doesn't resume) +HTTP GET with resume and redirect (to a page that does not resume) http://%HOSTIP:%HTTPPORT/%TESTNUMBER -C 50 -L diff --git a/tests/data/test1915 b/tests/data/test1915 index 3043259317..0c7c770547 100644 --- a/tests/data/test1915 +++ b/tests/data/test1915 @@ -32,7 +32,7 @@ http://%HOSTIP:%NOLISTENPORT/not-there/%TESTNUMBER # Verify data after the test has been "shot" -# 7 CURLE_COULDNT_CONNECT (expected since there's nothing listening there) +# 7 CURLE_COULDNT_CONNECT (expected since there is nothing listening there) # 42 CURLE_ABORTED_BY_CALLBACK 42 diff --git a/tests/data/test1917 b/tests/data/test1917 index 622623dc55..2d1850d7ab 100644 --- a/tests/data/test1917 +++ b/tests/data/test1917 @@ -21,7 +21,7 @@ hello # Client-side -# require HTTP too as otherwise CURLOPT_POST doesn't exist +# require HTTP too as otherwise CURLOPT_POST does not exist mqtt http diff --git a/tests/data/test20 b/tests/data/test20 index a84928a2dc..072df696e7 100644 --- a/tests/data/test20 +++ b/tests/data/test20 @@ -17,7 +17,7 @@ non-existing host http -attempt connect to non-existing host name +attempt connect to non-existing hostname --ipv4 non-existing-host.haxx.se. diff --git a/tests/data/test2024 b/tests/data/test2024 index 7838aeb2eb..45fe1a8359 100644 --- a/tests/data/test2024 +++ b/tests/data/test2024 @@ -11,7 +11,7 @@ HTTP Digest auth +ensure that the order does not matter. --> diff --git a/tests/data/test2025 b/tests/data/test2025 index 2b2c6f33f8..3bda645570 100644 --- a/tests/data/test2025 +++ b/tests/data/test2025 @@ -12,7 +12,7 @@ NTLM +ensure that the order does not matter. --> diff --git a/tests/data/test2026 b/tests/data/test2026 index d576725c4c..8db0142a9c 100644 --- a/tests/data/test2026 +++ b/tests/data/test2026 @@ -11,7 +11,7 @@ HTTP Digest auth +ensure that the order does not matter. --> diff --git a/tests/data/test2027 b/tests/data/test2027 index bff987e1cc..24d26eb760 100644 --- a/tests/data/test2027 +++ b/tests/data/test2027 @@ -13,7 +13,7 @@ HTTP Digest auth Explanation for the duplicate 400 requests: - libcurl doesn't detect that a given Digest password is wrong already on the + libcurl does not detect that a given Digest password is wrong already on the first 401 response (as the data400 gives). libcurl will instead consider the new response just as a duplicate and it sends another and detects the auth problem on the second 401 response! diff --git a/tests/data/test2028 b/tests/data/test2028 index 7f71f0549c..0e1dfcd41d 100644 --- a/tests/data/test2028 +++ b/tests/data/test2028 @@ -12,7 +12,7 @@ NTLM +ensure that the order does not matter. --> diff --git a/tests/data/test2029 b/tests/data/test2029 index 08a955fed7..f056952159 100644 --- a/tests/data/test2029 +++ b/tests/data/test2029 @@ -12,7 +12,7 @@ NTLM +ensure that the order does not matter. --> diff --git a/tests/data/test2030 b/tests/data/test2030 index b02d219201..47f01a14ed 100644 --- a/tests/data/test2030 +++ b/tests/data/test2030 @@ -12,13 +12,13 @@ NTLM +ensure that the order does not matter. --> + !win32 diff --git a/tests/data/test3202 b/tests/data/test3202 index d4ea6a33c3..44414c03aa 100644 --- a/tests/data/test3202 +++ b/tests/data/test3202 @@ -23,7 +23,7 @@ Connection: close Content-Type: text/html Funny-head: yesyes -These data aren't actually sent to the client +These data are not actually sent to the client diff --git a/tests/data/test3203 b/tests/data/test3203 index 527e870a49..0c5507d1db 100644 --- a/tests/data/test3203 +++ b/tests/data/test3203 @@ -16,7 +16,7 @@ file GET a directory using file:// - + !win32 diff --git a/tests/data/test328 b/tests/data/test328 index 602b6efa19..92f3133565 100644 --- a/tests/data/test328 +++ b/tests/data/test328 @@ -26,7 +26,7 @@ Q- What did 0 say to 8? A- Nice Belt! http -# we're actually more interested in any compression support but this is the +# we are actually more interested in any compression support but this is the # best we can do right now libz diff --git a/tests/data/test331 b/tests/data/test331 index 4b613c5e13..bbc77a0997 100644 --- a/tests/data/test331 +++ b/tests/data/test331 @@ -37,7 +37,7 @@ Funny-head: yesyes swsclose http -HTTP with cookie using host name 'moo' +HTTP with cookie using hostname 'moo' -x http://%HOSTIP:%HTTPPORT http://moo/we/want/%TESTNUMBER -b none http://moo/we/want/%TESTNUMBER0002 diff --git a/tests/data/test336 b/tests/data/test336 index ddf4266b46..66552f8f71 100644 --- a/tests/data/test336 +++ b/tests/data/test336 @@ -32,7 +32,7 @@ REPLY SIZE 500 no such command ftp -FTP range download when SIZE doesn't work +FTP range download when SIZE does not work ftp://%HOSTIP:%FTPPORT/%TESTNUMBER --range 3-6 diff --git a/tests/data/test349 b/tests/data/test349 index 07d9d07a00..42e2882cb9 100644 --- a/tests/data/test349 +++ b/tests/data/test349 @@ -12,7 +12,7 @@ HTTP GET HTTP/1.0 404 BAD BOY swsclose Content-Type: text/html -This silly page doesn't reaaaaaly exist so you should not get it. +This silly page does not reaaaaaly exist so you should not get it. diff --git a/tests/data/test357 b/tests/data/test357 index d0b7b7325f..5bed285069 100644 --- a/tests/data/test357 +++ b/tests/data/test357 @@ -8,7 +8,7 @@ Expect: 100-continue # Server-side -# 417 means the server didn't like the Expect header +# 417 means the server did not like the Expect header HTTP/1.1 417 BAD swsbounce Date: Tue, 09 Nov 2010 14:49:00 GMT diff --git a/tests/data/test361 b/tests/data/test361 index c333a8ce08..b574b4aa39 100644 --- a/tests/data/test361 +++ b/tests/data/test361 @@ -12,7 +12,7 @@ HTTP GET HTTP/1.0 404 BAD BOY swsclose Content-Type: text/html -This silly page doesn't reaaaaaly exist so you should not get it. +This silly page does not reaaaaaly exist so you should not get it. diff --git a/tests/data/test367 b/tests/data/test367 index 335d59e662..42a7ec2c32 100644 --- a/tests/data/test367 +++ b/tests/data/test367 @@ -26,7 +26,7 @@ Connection: close http -Empty user name provided in URL +Empty username provided in URL http://:example@%HOSTIP:%HTTPPORT/%TESTNUMBER diff --git a/tests/data/test380 b/tests/data/test380 index 6fe29288b6..a418dae4ae 100644 --- a/tests/data/test380 +++ b/tests/data/test380 @@ -32,7 +32,7 @@ dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr ftp -pick netrc password based on user name in URL +pick netrc password based on username in URL diff --git a/tests/data/test389 b/tests/data/test389 index 65bf1e9ad9..dcae640ecf 100644 --- a/tests/data/test389 +++ b/tests/data/test389 @@ -40,7 +40,7 @@ local-http -4 http://curlmachine.localhost:%HTTPPORT/%TESTNUMBER -# Ensure that we're running on localhost +# Ensure that we are running on localhost # diff --git a/tests/data/test399 b/tests/data/test399 index da4b3f7cf7..bd73155253 100644 --- a/tests/data/test399 +++ b/tests/data/test399 @@ -13,7 +13,7 @@ URL http -65536 bytes long host name in URL +65536 bytes long hostname in URL url = http://%repeat[65536 x a]%/399 diff --git a/tests/data/test410 b/tests/data/test410 index 3eb4eb4c8b..aab2fd7259 100644 --- a/tests/data/test410 +++ b/tests/data/test410 @@ -29,7 +29,7 @@ SSL https -HTTPS GET with very long request header +HTTPS GET with 49 KB long request header # 14 characters repeated 3500 times makes 49000 bytes diff --git a/tests/data/test412 b/tests/data/test412 index 7a8e83e685..0f38d17ff6 100644 --- a/tests/data/test412 +++ b/tests/data/test412 @@ -34,7 +34,7 @@ Debug http -alt-svc using host name with trailing dot in URL +alt-svc using hostname with trailing dot in URL # make Debug-curl accept Alt-Svc over plain HTTP diff --git a/tests/data/test413 b/tests/data/test413 index e365b1dfea..89877f5370 100644 --- a/tests/data/test413 +++ b/tests/data/test413 @@ -34,7 +34,7 @@ Debug http -alt-svc using host name with trailing dot on host from file +alt-svc using hostname with trailing dot on host from file # make Debug-curl accept Alt-Svc over plain HTTP diff --git a/tests/data/test440 b/tests/data/test440 index 161e6e3d9a..127fb16270 100644 --- a/tests/data/test440 +++ b/tests/data/test440 @@ -39,7 +39,7 @@ this.hsts.example "99991001 04:47:41" -HSTS with trailing-dot host name in URL but none in hsts file +HSTS with trailing-dot hostname in URL but none in hsts file -x http://%HOSTIP:%HTTPPORT http://this.hsts.example./%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -w '%{url_effective}\n' diff --git a/tests/data/test441 b/tests/data/test441 index 033c534304..eba5281291 100644 --- a/tests/data/test441 +++ b/tests/data/test441 @@ -39,7 +39,7 @@ this.hsts.example. "99991001 04:47:41" -HSTS with no t-dot host name in URL but t-dot in file +HSTS with no t-dot hostname in URL but t-dot in file -x http://%HOSTIP:%HTTPPORT http://this.hsts.example/%TESTNUMBER --hsts %LOGDIR/input%TESTNUMBER -w '%{url_effective}\n' diff --git a/tests/data/test458 b/tests/data/test458 index 66027b087e..c2e0501fed 100644 --- a/tests/data/test458 +++ b/tests/data/test458 @@ -36,7 +36,7 @@ FUNVALUE=contents%TESTNUMBER VALUE2=curl -variable expand the file name with --expand-output +variable expand the filename with --expand-output --variable %FUNVALUE diff --git a/tests/data/test506 b/tests/data/test506 index 5b4d16d9bc..d7618272dd 100644 --- a/tests/data/test506 +++ b/tests/data/test506 @@ -55,7 +55,7 @@ run 3: overwrite cookie 1 and 4, set cookie 6 with and without tailmatch http -# don't run this with the threaded-resolver or c-ares since the events might +# do not run this with the threaded-resolver or c-ares since the events might # trigger in a different order! !threaded-resolver diff --git a/tests/data/test507 b/tests/data/test507 index 49d7517608..aa4ec61ef6 100644 --- a/tests/data/test507 +++ b/tests/data/test507 @@ -18,7 +18,7 @@ non-existing host http -multi interface get with non-existing host name +multi interface get with non-existing hostname lib%TESTNUMBER diff --git a/tests/data/test517 b/tests/data/test517 index 859e54f319..a60a46dfda 100644 --- a/tests/data/test517 +++ b/tests/data/test517 @@ -30,9 +30,9 @@ curl_getdate() testing # This test case previously tested an overflow case ("2094 Nov 6 => # 2147483647") for 32-bit time_t, but since some systems have 64-bit time_t and -# handles this (returning 3939840000), and some 64-bit time_t systems don't -# handle this and return -1 for this, it turned very tricky to write a fine -# test case and thus it is now removed until we have a way to write test cases +# handles this (returning 3939840000), and some 64-bit time_t systems do not +# handle this and return -1 for this, it turned tricky to write a fine test +# case and thus it is now removed until we have a way to write test cases # for this kind of things. diff --git a/tests/data/test531 b/tests/data/test531 index e018d7d60c..4e22a64840 100644 --- a/tests/data/test531 +++ b/tests/data/test531 @@ -33,7 +33,7 @@ ftp://%HOSTIP:%FTPPORT/path/%TESTNUMBER %LOGDIR/upload%TESTNUMBER Moooooooooooo -don't upload this +do not upload this diff --git a/tests/data/test542 b/tests/data/test542 index 8f6bdf8945..14aeeae9e9 100644 --- a/tests/data/test542 +++ b/tests/data/test542 @@ -41,7 +41,7 @@ ftp://%HOSTIP:%FTPPORT/%TESTNUMBER # Verify data after the test has been "shot" # -# There's no MTDM in the protocol here since this code doesn't ask for the +# There is no MTDM in the protocol here since this code does not ask for the # time/date of the file diff --git a/tests/data/test543 b/tests/data/test543 index c9a5a21398..917e957260 100644 --- a/tests/data/test543 +++ b/tests/data/test543 @@ -18,7 +18,7 @@ curl_easy_escape # Verify data after the test has been "shot" # -# There's no MTDM in the protocol here since this code doesn't ask for the +# There is no MTDM in the protocol here since this code does not ask for the # time/date of the file diff --git a/tests/data/test554 b/tests/data/test554 index 9336930f92..1db9fa9b67 100644 --- a/tests/data/test554 +++ b/tests/data/test554 @@ -107,7 +107,7 @@ Content-Length: 794%CR Content-Type: multipart/form-data; boundary=----------------------------%CR %CR ------------------------------%CR -Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2"%CR +Content-Disposition: form-data; name="sendfile alternative"; filename="filename 2 "%CR %CR this is what we post to the silly web server %CR diff --git a/tests/data/test562 b/tests/data/test562 index d7871f18ec..9c7d01be52 100644 --- a/tests/data/test562 +++ b/tests/data/test562 @@ -26,7 +26,7 @@ lib%TESTNUMBER FTP a type=A URL and CURLOPT_PORT set -# note that we need quotes around the URL below to make sure the shell doesn't +# note that we need quotes around the URL below to make sure the shell does not # treat the semicolon as a separator! 'ftp://%HOSTIP:23456/%TESTNUMBER;type=A' %FTPPORT @@ -36,7 +36,7 @@ FTP a type=A URL and CURLOPT_PORT set # Verify data after the test has been "shot" # -# There's no MTDM in the protocol here since this code doesn't ask for the +# There is no MTDM in the protocol here since this code does not ask for the # time/date of the file diff --git a/tests/data/test563 b/tests/data/test563 index 12f0368d58..30730fd792 100644 --- a/tests/data/test563 +++ b/tests/data/test563 @@ -38,7 +38,7 @@ proxy ftp_proxy=http://%HOSTIP:%HTTPPORT/ -# note that we need quotes around the URL below to make sure the shell doesn't +# note that we need quotes around the URL below to make sure the shell does not # treat the semicolon as a separator! "ftp://%HOSTIP:23456/%TESTNUMBER;type=A" %FTPPORT diff --git a/tests/data/test579 b/tests/data/test579 index a4e63b612d..be3c910998 100644 --- a/tests/data/test579 +++ b/tests/data/test579 @@ -66,7 +66,7 @@ lib%TESTNUMBER -small chunked HTTP POSTs with digest auth. and progress callback +small chunked HTTP POSTs with digest auth and progress callback http://%HOSTIP:%HTTPPORT/%TESTNUMBER %LOGDIR/ip%TESTNUMBER diff --git a/tests/data/test583 b/tests/data/test583 index 8f87bcef9d..46a937631c 100644 --- a/tests/data/test583 +++ b/tests/data/test583 @@ -25,9 +25,9 @@ SFTP with multi interface, remove handle early # The command here uses 'localhost' just to make sure that curl_multi_perform -# won't reach too far in the first invoke. When using c-ares at least, the -# name resolve will cause it to return rather quickly and thus we could trigger -# the problem we're looking to verify. +# does not reach too far in the first invoke. When using c-ares at least, the +# name resolve causes it to return rather quickly and thus we could trigger +# the problem we are looking to verify. sftp://localhost:%SSHPORT%SFTP_PWD/%LOGDIR/upload%TESTNUMBER.txt %USER: %LOGDIR/server/curl_client_key.pub %LOGDIR/server/curl_client_key diff --git a/tests/data/test588 b/tests/data/test588 index 5c53e04554..24d05ef747 100644 --- a/tests/data/test588 +++ b/tests/data/test588 @@ -1,7 +1,7 @@ # # This test is exactly like 525 but the server rejects the EPRT command. -# Written up to make sure that there's nothing in the multi interface +# Written up to make sure that there is nothing in the multi interface # active connection case that differs between PORT and EPRT use # @@ -32,7 +32,7 @@ ftp lib525 -FTP PORT upload using multi interface, EPRT doesn't work +FTP PORT upload using multi interface, EPRT does not work ftp://%HOSTIP:%FTPPORT/path/%TESTNUMBER %LOGDIR/upload%TESTNUMBER diff --git a/tests/data/test643 b/tests/data/test643 index 14bbd4aa39..b0ecd42cd8 100644 --- a/tests/data/test643 +++ b/tests/data/test643 @@ -106,7 +106,7 @@ Content-Length: 690%CR Content-Type: multipart/form-data; boundary=----------------------------%CR %CR ------------------------------%CR -Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2"%CR +Content-Disposition: form-data; name="sendfile alternative"; filename="filename 2 "%CR %CR dummy %CR diff --git a/tests/data/test645 b/tests/data/test645 index 6370a5a478..9b59eb8f69 100644 --- a/tests/data/test645 +++ b/tests/data/test645 @@ -139,7 +139,7 @@ Expect: 100-continue%CR %CR 8a%CR ------------------------------%CR -Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2"%CR +Content-Disposition: form-data; name="sendfile alternative"; filename="filename 2 "%CR %CR d%CR 1%CR diff --git a/tests/data/test678 b/tests/data/test678 index 48b65076b0..cac12ca071 100644 --- a/tests/data/test678 +++ b/tests/data/test678 @@ -39,7 +39,7 @@ lib%TESTNUMBER https://localhost:%HTTPSPORT/%TESTNUMBER %CERTDIR/certs/test-ca.crt -# Ensure that we're running on localhost because we're checking the host name +# Ensure that we are running on localhost because we are checking the hostname %LIBTESTS lib%TESTNUMBER check diff --git a/tests/data/test716 b/tests/data/test716 index d6910718b3..fb03233eac 100644 --- a/tests/data/test716 +++ b/tests/data/test716 @@ -26,7 +26,7 @@ http proxy -SOCKS5 proxy with too long user name +SOCKS5 proxy with too long username # it should never connect to the target server diff --git a/tests/data/test717 b/tests/data/test717 index ca377a4bce..afd9b63966 100644 --- a/tests/data/test717 +++ b/tests/data/test717 @@ -43,7 +43,7 @@ http SOCKS5 proxy auth -# target a port that won't work without the SOCKS magic +# target a port that does not work without the SOCKS magic http://%HOSTIP:1/%TESTNUMBER -x socks5://uz3r:p4ssworm@%HOSTIP:%SOCKSPORT diff --git a/tests/data/test721 b/tests/data/test721 index 23878f5b2f..46ee2674a1 100644 --- a/tests/data/test721 +++ b/tests/data/test721 @@ -38,7 +38,7 @@ http socks5 -HTTP GET with host name using SOCKS5h +HTTP GET with hostname using SOCKS5h http://this.is.a.host.name:%HTTPPORT/%TESTNUMBER --proxy socks5h://%HOSTIP:%SOCKSPORT diff --git a/tests/data/test726 b/tests/data/test726 index 54a07de70c..048b1ff4cb 100644 --- a/tests/data/test726 +++ b/tests/data/test726 @@ -21,7 +21,7 @@ http # -# Set a home that doesn't have a ".ipfs" folder. %PWD should be good. +# Set a home that does not have a ".ipfs" folder. %PWD should be good. # This is to prevent the automatic gateway detection from finding a gateway file in your home folder. HOME=%PWD @@ -34,7 +34,7 @@ ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u # -# Verify with no gateway url and no auto detection +# Verify with no gateway URL and no auto detection 37 diff --git a/tests/data/test729 b/tests/data/test729 index fca56ade55..172b06ffe9 100644 --- a/tests/data/test729 +++ b/tests/data/test729 @@ -23,7 +23,7 @@ http socks4 -SOCKS4 with very long proxy user name +SOCKS4 with long proxy username http://fake --limit-rate 1 -x socks4a://%repeat[1015 x a]%@%HOSTIP:%SOCKSPORT diff --git a/tests/data/test739 b/tests/data/test739 index 41fa8e1dbe..41f3599e4d 100644 --- a/tests/data/test739 +++ b/tests/data/test739 @@ -20,7 +20,7 @@ ipfs http -IPNS path and query args for gateway and IPFS url (malformed gateway url) +IPNS path and query args for gateway and IPFS URL (malformed gateway URL) --ipfs-gateway "http://%HOSTIP:%HTTPPORT/some/path?biz=baz" "ipns://fancy.tld/a/b?foo=bar&aaa=bbb" diff --git a/tests/data/test742 b/tests/data/test742 index 4cffe4d33d..d94d8b0da1 100644 --- a/tests/data/test742 +++ b/tests/data/test742 @@ -40,10 +40,10 @@ socks5 http -SOCKS5-hostname with max length credentials and max host name length +SOCKS5-hostname with max length credentials and max hostname length -# target a port that won't work without the SOCKS magic +# target a port that does not work without the SOCKS magic http://%repeat[254 x c]%:%HTTPPORT -x socks5h://%repeat[255 x a]%:%repeat[255 x b]%@%HOSTIP:%SOCKSPORT diff --git a/tests/data/test752 b/tests/data/test752 index 28866bc312..76f792a003 100644 --- a/tests/data/test752 +++ b/tests/data/test752 @@ -48,7 +48,7 @@ Funny-head: yesyes http ---retry and -f on a HTTP 404 response +--retry and -f on an HTTP 404 response http://%HOSTIP:%HTTPPORT/%TESTNUMBER -f --retry 1 diff --git a/tests/data/test775 b/tests/data/test775 index aa016a0955..9ca0223ba4 100644 --- a/tests/data/test775 +++ b/tests/data/test775 @@ -43,7 +43,7 @@ SSL http -HTTP with NTLM with too long user name +HTTP with NTLM with too long username http://%HOSTIP:%HTTPPORT/%TESTNUMBER -u testuser%repeat[1100 x A]%:testpass --ntlm diff --git a/tests/data/test804 b/tests/data/test804 index 9df5decafe..9912f018a4 100644 --- a/tests/data/test804 +++ b/tests/data/test804 @@ -25,7 +25,7 @@ body imap -IMAP doesn't perform SELECT if reusing the same mailbox +IMAP does not perform SELECT if reusing the same mailbox 'imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=123/;SECTION=1' 'imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=456/;SECTION=2.3' -u user:secret diff --git a/tests/data/test841 b/tests/data/test841 index 321512431c..18bf7ae859 100644 --- a/tests/data/test841 +++ b/tests/data/test841 @@ -35,7 +35,7 @@ body imap -IMAP custom request doesn't check continuation data +IMAP custom request does not check continuation data imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/ -u user:secret -X 'FETCH 123 BODY[1]' diff --git a/tests/data/test842 b/tests/data/test842 index cc0dcd9c00..63c4a9d393 100644 --- a/tests/data/test842 +++ b/tests/data/test842 @@ -40,7 +40,7 @@ IMAP OAuth 2.0 (OAUTHBEARER) authentication 'imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM -# The protocol section doesn't support ways of specifying the raw data in the +# The protocol section does not support ways of specifying the raw data in the # base64 encoded message so we must assert this diff --git a/tests/data/test87 b/tests/data/test87 index b22578f82f..c1909df972 100644 --- a/tests/data/test87 +++ b/tests/data/test87 @@ -46,8 +46,7 @@ urlglob with out of range -o #[num] usage # # Verify data after the test has been "shot". Note that the command line -# will write both responses into the same file name so only the second -# survives +# writes both responses into the same filename so only the second survives # diff --git a/tests/devtest.pl b/tests/devtest.pl index 30124a9f91..a2a9cde875 100755 --- a/tests/devtest.pl +++ b/tests/devtest.pl @@ -24,13 +24,13 @@ ########################################################################### # This script is intended for developers to test some internals of the -# runtests.pl harness. Don't try to use this unless you know what you're +# runtests.pl harness. Do not try to use this unless you know what you are # doing! # An example command-line that starts a test http server for test 11 and waits # for the user before stopping it: # ./devtest.pl --verbose serverfortest https echo "Started https" protoport https preprocess 11 pause echo Stopping stopservers echo Done -# curl can connect to the server while it's running like this: +# curl can connect to the server while it is running like this: # curl -vkL https://localhost:/11 use strict; @@ -94,7 +94,7 @@ sub parseprotocols { # Generate a "proto-ipv6" version of each protocol to match the # IPv6 name and a "proto-unix" to match the variant which - # uses Unix domain sockets. This works even if support isn't + # uses Unix domain sockets. This works even if support is not # compiled in because the test will fail. push @protocols, map(("$_-ipv6", "$_-unix"), @protocols); diff --git a/tests/dictserver.py b/tests/dictserver.py index ad65e55957..3ecb86785d 100755 --- a/tests/dictserver.py +++ b/tests/dictserver.py @@ -115,9 +115,9 @@ def get_options(): parser.add_argument("--verbose", action="store", type=int, default=0, help="verbose output") parser.add_argument("--pidfile", action="store", - help="file name for the PID") + help="filename for the PID") parser.add_argument("--logfile", action="store", - help="file name for the log") + help="filename for the log") parser.add_argument("--srcdir", action="store", help="test directory") parser.add_argument("--id", action="store", help="server ID") parser.add_argument("--ipv4", action="store_true", default=0, diff --git a/tests/ech_combos.py b/tests/ech_combos.py index 66daaa373d..4eba4de1c2 100755 --- a/tests/ech_combos.py +++ b/tests/ech_combos.py @@ -31,7 +31,7 @@ # ECH command line args def CombinationRepetitionUtil(chosen, arr, badarr, index, - r, start, end): + r, start, end): # Current combination is ready, # print it @@ -68,9 +68,9 @@ def CombinationRepetitionUtil(chosen, arr, badarr, index, # with next (Note that i+1 is passed, # but index is not changed) CombinationRepetitionUtil(chosen, arr, badarr, index + 1, - r, start, end) + r, start, end) CombinationRepetitionUtil(chosen, arr, badarr, index, - r, start + 1, end) + r, start + 1, end) # The main function that prints all # combinations of size r in arr[] of @@ -94,5 +94,3 @@ r = 8 n = len(arr) - 1 CombinationRepetition(arr, badarr, n, r) - -# This code is contributed by Vaibhav Kumar 12. diff --git a/tests/ech_tests.sh b/tests/ech_tests.sh index f55a0f12ec..3944793b70 100755 --- a/tests/ech_tests.sh +++ b/tests/ech_tests.sh @@ -25,7 +25,7 @@ # # Run some tests against servers we know to support ECH (CF, defo.ie, etc.). -# as well as some we know don't do ECH but have an HTTPS RR, and finally some +# as well as some we know do not do ECH but have an HTTPS RR, and finally some # for which neither is the case. # TODO: Translate this into something that approximates a valid curl test:-) @@ -36,9 +36,9 @@ # set -x -# Exit with an error if there's an active ech stanza in ~/.curlrc -# as that'd likely skew some results (e.g. turning a fail into a -# success or vice versa) +# Exit with an error if there is an active ech stanza in ~/.curlrc +# as that would likely skew some results (e.g. turning a fail into +# a success or vice versa) : "${CURL_CFG_FILE=$HOME/.curlrc}" active_ech=$(grep ech "$CURL_CFG_FILE" | grep -v "#.*ech") if [[ "$active_ech" != "" ]]; then @@ -88,7 +88,7 @@ declare -A neither_targets=( # Variables that can be over-ridden from environment # -# Top of curl test tree, assume we're there +# Top of curl test tree, assume we are there : "${CTOP:=.}" # Place to put test log output @@ -214,7 +214,7 @@ if [ ! -d "$LTOP" ]; then mkdir -p "$LTOP" fi if [ ! -d "$LTOP" ]; then - echo "Can't see $LTOP for logs - exiting" + echo "Cannot see $LTOP for logs - exiting" exit 1 fi logfile=$LTOP/${BINNAME}_$NOW.log @@ -223,7 +223,7 @@ echo "-----" > "$logfile" echo "Running $0 at $NOW" >> "$logfile" echo "Running $0 at $NOW" -# check we have the binaries needed and which TLS library we'll be using +# check we have the binaries needed and which TLS library we will be using if [ -f "$OSSL"/libssl.so ]; then have_ossl="yes" fi @@ -254,8 +254,8 @@ wolf_cnt=$($CURL "${CURL_PARAMS[@]}" -V 2> /dev/null | grep -c wolfSSL) if ((wolf_cnt == 1)); then using_wolf="yes" # for some reason curl+wolfSSL dislikes certs that are ok - # for browsers, so we'll test using "insecure" mode (-k) - # but that's ok here as we're only interested in ECH testing + # for browsers, so we will test using "insecure" mode (-k) + # but that is ok here as we are only interested in ECH testing CURL_PARAMS+=(-k) fi # check if we have dig and it knows https or not @@ -274,7 +274,7 @@ digout=$($digcmd https defo.ie) if [[ $digout != "1 . "* ]]; then digout=$($digcmd -t TYPE65 defo.ie) if [[ $digout == "1 . "* ]]; then - # we're good + # we are good have_presout="yes" fi else @@ -282,7 +282,7 @@ else fi # Check if ports other than 443 are blocked from this -# vantage point (I run tests in a n/w where that's +# vantage point (I run tests in a n/w where that is # sadly true sometimes;-) # echo "Checking if ports other than 443 are maybe blocked" not443testurl="https://draft-13.esni.defo.ie:9413/" @@ -317,7 +317,7 @@ echo "dig command: |$digcmd|" echo "ports != 443 blocked: $have_portsblocked" if [[ "$have_curl" == "no" ]]; then - echo "Can't proceed without curl - exiting" + echo "Cannot proceed without curl - exiting" exit 32 fi @@ -379,7 +379,7 @@ if [[ "$using_ossl" == "yes" ]]; then continue fi if [[ "$host" == "cloudflare-ech.com" ]]; then - echo "Skipping $host as they've blocked PN override" + echo "Skipping $host as they have blocked PN override" continue fi path=${ech_targets[$targ]} @@ -472,9 +472,9 @@ for targ in "${!neither_targets[@]}"; do echo "" >> "$logfile" done -# Check various command line options, if we're good so far +# Check various command line options, if we are good so far if [[ "$using_ossl" == "yes" && "$allgood" == "yes" ]]; then - # use this test URL as it'll tell us if things worked + # use this test URL as it will tell us if things worked turl="https://defo.ie/ech-check.php" echo "cli_test with $turl" echo "cli_test with $turl" >> "$logfile" @@ -490,8 +490,8 @@ fi fi # skip -# Check combinations of command line options, if we're good so far -# Most of this only works for OpenSSL, which is ok, as we're checking +# Check combinations of command line options, if we are good so far +# Most of this only works for OpenSSL, which is ok, as we are checking # the argument handling here, not the ECH protocol if [[ "$using_ossl" == "yes" && "$allgood" == "yes" ]]; then # ech can be hard, true, grease or false @@ -786,11 +786,11 @@ if [[ "$using_ossl" == "yes" && "$allgood" == "yes" ]]; then cli_test "$turl" 1 1 --ech true --ech pn:"$goodpn" [ "$allgood" != "yes" ] && echo "$LINENO" - # a target URL that doesn't support ECH + # a target URL that does not support ECH turl="https://tcd.ie" echo "cli_test with $turl" echo "cli_test with $turl" >> "$logfile" - # the params below don't matter much here as we'll fail anyway + # the params below do not matter much here as we will fail anyway echconfiglist=$(get_ech_configlist defo.ie) goodecl=$echconfiglist badecl="$goodecl" @@ -1083,13 +1083,13 @@ else echo "NOT all good, log in $logfile" fi -# send a mail to root (will be fwd'd) but just once every 24 hours +# send a mail to root (will be forwarded) but just once every 24 hours # 'cause we only really need "new" news itsnews="yes" age_of_news=0 if [ -f "$LTOP"/bad_runs ]; then age_of_news=$(fileage "$LTOP"/bad_runs) - # only consider news "new" if we haven't mailed today + # only consider news "new" if we have not mailed today if ((age_of_news < 24*3600)); then itsnews="no" fi diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index cd725fccfd..0ca3ac5281 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -32,7 +32,7 @@ # protocols simultaneously. # # It is meant to exercise curl, it is not meant to be a fully working -# or even very standard compliant server. +# or even overly standard compliant server. # # You may optionally specify port on the command line, otherwise it'll # default to port 8921. @@ -104,11 +104,11 @@ my $port = 8921; # default primary listener port my $listenaddr = '127.0.0.1'; # default address for listener port #********************************************************************** -# global vars used for file names +# global vars used for filenames # -my $PORTFILE="ftpserver.port"; # server port file name +my $PORTFILE="ftpserver.port"; # server port filename my $portfile; # server port file path -my $pidfile; # server pid file name +my $pidfile; # server pid filename my $mainsockf_pidfile; # pid file for primary connection sockfilt process my $mainsockf_logfile; # log file for primary connection sockfilt process my $datasockf_pidfile; # pid file for secondary connection sockfilt process @@ -147,15 +147,15 @@ my %displaytext; # text returned to client before callback runs # my $ctrldelay; # set if server should throttle ctrl stream my $datadelay; # set if server should throttle data stream -my $retrweirdo; # set if ftp server should use RETRWEIRDO -my $retrnosize; # set if ftp server should use RETRNOSIZE -my $retrsize; # set if ftp server should use RETRSIZE -my $pasvbadip; # set if ftp server should use PASVBADIP -my $nosave; # set if ftp server should not save uploaded data -my $nodataconn; # set if ftp srvr doesn't establish or accepts data channel -my $nodataconn425; # set if ftp srvr doesn't establish data ch and replies 425 -my $nodataconn421; # set if ftp srvr doesn't establish data ch and replies 421 -my $nodataconn150; # set if ftp srvr doesn't establish data ch and replies 150 +my $retrweirdo; # set if FTP server should use RETRWEIRDO +my $retrnosize; # set if FTP server should use RETRNOSIZE +my $retrsize; # set if FTP server should use RETRSIZE +my $pasvbadip; # set if FTP server should use PASVBADIP +my $nosave; # set if FTP server should not save uploaded data +my $nodataconn; # set if FTP srvr does not establish or accepts data channel +my $nodataconn425; # set if FTP srvr does not establish data ch and replies 425 +my $nodataconn421; # set if FTP srvr does not establish data ch and replies 421 +my $nodataconn150; # set if FTP srvr does not establish data ch and replies 150 my $storeresp; my $postfetch; my @capabilities; # set if server supports capability commands @@ -166,7 +166,7 @@ my %customcount; # my %delayreply; # #********************************************************************** -# global variables for to test ftp wildcardmatching or other test that +# global variables for to test FTP wildcardmatching or other test that # need flexible LIST responses.. and corresponding files. # $ftptargetdir is keeping the fake "name" of LIST directory. # @@ -174,7 +174,7 @@ my $ftplistparserstate; my $ftptargetdir=""; #********************************************************************** -# global variables used when running a ftp server to keep state info +# global variables used when running an FTP server to keep state info # relative to the secondary or data sockfilt process. Values of these # variables should only be modified using datasockf_state() sub, given # that they are closely related and relationship is a bit awkward. @@ -768,7 +768,7 @@ sub EHLO_smtp { my @data; # TODO: Get the IP address of the client connection to use in the - # EHLO response when the client doesn't specify one but for now use + # EHLO response when the client does not specify one but for now use # 127.0.0.1 if(!$client) { $client = "[127.0.0.1]"; @@ -823,7 +823,7 @@ sub HELO_smtp { my ($client) = @_; # TODO: Get the IP address of the client connection to use in the HELO - # response when the client doesn't specify one but for now use 127.0.0.1 + # response when the client does not specify one but for now use 127.0.0.1 if(!$client) { $client = "[127.0.0.1]"; } @@ -864,7 +864,7 @@ sub MAIL_smtp { } } - # this server doesn't "validate" MAIL FROM addresses + # this server does not "validate" MAIL FROM addresses if(length($from)) { my @found; my $valid = 1; @@ -2765,7 +2765,7 @@ sub datasockf_state { } elsif($state eq 'PASSIVE_NODATACONN') { # Data sockfilter bound port without listening, - # client won't be able to establish data connection. + # client will not be able to establish data connection. $datasockf_state = $state; $datasockf_mode = 'passive'; $datasockf_runs = 'yes'; @@ -2930,7 +2930,7 @@ sub customize { @auth_mechs = split(/ /, $1); } elsif($_ =~ /NOSAVE/) { - # don't actually store the file we upload - to be used when + # do not actually store the file we upload - to be used when # uploading insanely huge amounts $nosave = 1; logmsg "FTPD: NOSAVE prevents saving of uploaded data\n"; @@ -3044,7 +3044,7 @@ while(@ARGV) { } } else { - print STDERR "\nWarning: ftpserver.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: ftpserver.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } @@ -3332,7 +3332,7 @@ while(1) { $check = 0; } - # only perform this if we're not faking a reply + # only perform this if we are not faking a reply my $func = $commandfunc{uc($FTPCMD)}; if($func) { &$func($FTPARG, $FTPCMD); diff --git a/tests/getpart.pm b/tests/getpart.pm index 75eb8dfe5d..ba611d761f 100644 --- a/tests/getpart.pm +++ b/tests/getpart.pm @@ -47,13 +47,13 @@ BEGIN { use Memoize; my @xml; # test data file contents -my $xmlfile; # test data file name +my $xmlfile; # test data filename my $warning=0; my $trace=0; # Normalize the part function arguments for proper caching. This includes the -# file name in the arguments since that is an implied parameter that affects the +# filename in the arguments since that is an implied parameter that affects the # return value. Any error messages will only be displayed the first time, but # those are disabled by default anyway, so should never been seen outside # development. @@ -398,7 +398,7 @@ sub writearray { my ($filename, $arrayref)=@_; open(my $temp, ">", "$filename") || die "Failure writing file"; - binmode($temp,":raw"); # Cygwin fix by Kevin Roth + binmode($temp,":raw"); # Cygwin fix for(@$arrayref) { print $temp $_; } diff --git a/tests/http-server.pl b/tests/http-server.pl index d100caef68..006b6f3817 100755 --- a/tests/http-server.pl +++ b/tests/http-server.pl @@ -140,7 +140,7 @@ while(@ARGV) { $verbose = 1; } else { - print STDERR "\nWarning: http-server.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: http-server.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } diff --git a/tests/http/scorecard.py b/tests/http/scorecard.py index 6afb9c7401..c3ad9bbc41 100644 --- a/tests/http/scorecard.py +++ b/tests/http/scorecard.py @@ -845,7 +845,7 @@ def print_file(filename): def main(): parser = argparse.ArgumentParser(prog='scorecard', description=""" - Run a range of tests to give a scorecard for a HTTP protocol + Run a range of tests to give a scorecard for an HTTP protocol 'h3' or 'h2' implementation in curl. """) parser.add_argument("-v", "--verbose", action='count', default=1, diff --git a/tests/http/test_01_basic.py b/tests/http/test_01_basic.py index c786488c2e..aa94238c3f 100644 --- a/tests/http/test_01_basic.py +++ b/tests/http/test_01_basic.py @@ -25,6 +25,7 @@ ########################################################################### # import logging +import re import pytest from testenv import Env @@ -55,9 +56,8 @@ class TestBasic: # simple https: GET, h2 wanted and got @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_03_h2_get(self, env: Env, httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'https://{env.domain1}:{env.https_port}/data.json' r = curl.http_get(url=url, extra_args=['--http2']) @@ -66,9 +66,8 @@ class TestBasic: # simple https: GET, h2 unsupported, fallback to h1 @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_04_h2_unsupported(self, env: Env, httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'https://{env.domain2}:{env.https_port}/data.json' r = curl.http_get(url=url, extra_args=['--http2']) @@ -86,12 +85,8 @@ class TestBasic: # simple download, check connect/handshake timings @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_01_06_timings(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/data.json' r = curl.http_download(urls=[url], alpn_proto=proto, with_stats=True) @@ -103,13 +98,9 @@ class TestBasic: assert r.stats[0]['time_appconnect'] > 0, f'{r.stats[0]}' # simple https: HEAD - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") def test_01_07_head(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/data.json' r = curl.http_download(urls=[url], with_stats=True, with_headers=True, @@ -122,9 +113,8 @@ class TestBasic: assert r.stats[0]['size_download'] == 0, f'{r.stats[0]}' # http: GET for HTTP/2, see Upgrade:, 101 switch + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_08_h2_upgrade(self, env: Env, httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'http://{env.domain1}:{env.http_port}/data.json' r = curl.http_get(url=url, extra_args=['--http2']) @@ -136,9 +126,8 @@ class TestBasic: assert r.json['server'] == env.domain1 # http: GET for HTTP/2 with prior knowledge + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_09_h2_prior_knowledge(self, env: Env, httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'http://{env.domain1}:{env.http_port}/data.json' r = curl.http_get(url=url, extra_args=['--http2-prior-knowledge']) @@ -149,9 +138,8 @@ class TestBasic: assert r.json['server'] == env.domain1 # http: strip TE header in HTTP/2 requests + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_10_te_strip(self, env: Env, httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, "h2")}/data.json' r = curl.http_get(url=url, extra_args=['--http2', '-H', 'TE: gzip']) @@ -164,12 +152,8 @@ class TestBasic: # send 48KB+ sized response headers to check we handle that correctly # larger than 64KB headers expose a bug in Apache HTTP/2 that is not # RSTing the stream correctly when its internal limits are exceeded. - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_01_11_large_resp_headers(self, env: Env, httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}' \ f'/curltest/tweak?x-hd={48 * 1024}' @@ -181,10 +165,8 @@ class TestBasic: # http: response headers larger than what curl buffers for @pytest.mark.skipif(condition=not Env.httpd_is_at_least('2.4.64'), reason='httpd must be at least 2.4.64') - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_01_12_xlarge_resp_headers(self, env: Env, httpd, configures_httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") httpd.set_extra_config('base', [ f'H2MaxHeaderBlockLen {130 * 1024}', ]) @@ -200,10 +182,8 @@ class TestBasic: # http: 1 response header larger than what curl buffers for @pytest.mark.skipif(condition=not Env.httpd_is_at_least('2.4.64'), reason='httpd must be at least 2.4.64') - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_01_13_megalarge_resp_headers(self, env: Env, httpd, configures_httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") httpd.set_extra_config('base', [ 'LogLevel http2:trace2', f'H2MaxHeaderBlockLen {130 * 1024}', @@ -222,10 +202,8 @@ class TestBasic: # nghttp2 error -905: Too many CONTINUATION frames following a HEADER frame @pytest.mark.skipif(condition=not Env.httpd_is_at_least('2.4.64'), reason='httpd must be at least 2.4.64') - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_01_14_gigalarge_resp_headers(self, env: Env, httpd, configures_httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") httpd.set_extra_config('base', [ 'LogLevel http2:trace2', f'H2MaxHeaderBlockLen {1024 * 1024}', @@ -243,10 +221,8 @@ class TestBasic: # http: one response header > 256 KB @pytest.mark.skipif(condition=not Env.httpd_is_at_least('2.4.64'), reason='httpd must be at least 2.4.64') - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_01_15_gigalarge_resp_headers(self, env: Env, httpd, configures_httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") httpd.set_extra_config('base', [ 'LogLevel http2:trace2', f'H2MaxHeaderBlockLen {1024 * 1024}', @@ -262,12 +238,8 @@ class TestBasic: r.check_exit_code(100) # CURLE_TOO_LARGE # http: invalid request headers, GET, issue #16998 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_01_16_inv_req_get(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo' r = curl.http_get(url=url, alpn_proto=proto, extra_args=[ @@ -287,10 +259,9 @@ class TestBasic: pytest.param('gzip ;q=0.2;x="y,x", trailers', 'trailers', id='gzip+q+x+trailers'), pytest.param('gzip ;x="trailers", chunks', None, id='gzip+x+chunks'), ]) + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_17_TE(self, env: Env, httpd, te_in, te_out): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo' r = curl.http_download(urls=[url], alpn_proto=proto, with_stats=True, @@ -303,10 +274,9 @@ class TestBasic: assert 'request-te' not in r.responses[0]['header'], f'{r.responses[0]}' # check that an existing https: connection is not reused for http: + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_18_tls_reuse(self, env: Env, httpd): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url1 = f'https://{env.authority_for(env.domain1, proto)}/data.json' url2 = f'http://{env.authority_for(env.domain1, proto)}/data.json' @@ -315,13 +285,33 @@ class TestBasic: assert r.total_connects == 2, f'{r.dump_logs()}' # check that an existing http: connection is not reused for https: + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_01_19_plain_reuse(self, env: Env, httpd): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url1 = f'http://{env.domain1}:{env.http_port}/data.json' url2 = f'https://{env.domain1}:{env.http_port}/data.json' r = curl.http_download(urls=[url1, url2], alpn_proto=proto, with_stats=True) assert len(r.stats) == 2 assert r.total_connects == 2, f'{r.dump_logs()}' + + # use a custom method containing a space + # check that h2/h3 did send that in the :method pseudo header. #19543 + @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs verbosecurl") + @pytest.mark.parametrize("proto", Env.http_protos()) + def test_01_20_method_space(self, env: Env, proto, httpd): + curl = CurlClient(env=env) + method = 'IN SANE' + url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo' + r = curl.http_download(urls=[url], alpn_proto=proto, with_stats=True, + extra_args=['-X', method]) + assert len(r.stats) == 1 + if proto == 'h2' or proto == 'h3': + r.check_response(http_status=0) + re_m = re.compile(r'.*\[:method: ([^\]]+)\].*') + lines = [line for line in r.trace_lines if re_m.match(line)] + assert len(lines) == 1, f'{r.dump_logs()}' + m = re_m.match(lines[0]) + assert m.group(1) == method, f'{r.dump_logs()}' + else: + r.check_response(http_status=400) diff --git a/tests/http/test_02_download.py b/tests/http/test_02_download.py index 13d5d2a0f0..9abe497539 100644 --- a/tests/http/test_02_download.py +++ b/tests/http/test_02_download.py @@ -53,36 +53,24 @@ class TestDownload: env.make_data_gzipbomb(indir=indir, fname="bomb-100m.txt", fsize=100*1024*1024) # download 1 file - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_01_download_1(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/data.json' r = curl.http_download(urls=[url], alpn_proto=proto) r.check_response(http_status=200) # download 2 files - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_02_download_2(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-1]' r = curl.http_download(urls=[url], alpn_proto=proto) r.check_response(http_status=200, count=2) # download 100 files sequentially - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_03_download_sequential(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if (proto == 'http/1.1' or proto == 'h2') and env.curl_uses_lib('mbedtls') and \ sys.platform.startswith('darwin') and env.ci_run: pytest.skip('mbedtls 3.6.3 fails this test on macOS CI runners') @@ -93,12 +81,8 @@ class TestDownload: r.check_response(http_status=200, count=count, connect_count=1) # download 100 files parallel - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_04_download_parallel(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h2' and env.curl_uses_lib('mbedtls') and \ sys.platform.startswith('darwin') and env.ci_run: pytest.skip('mbedtls 3.6.3 fails this test on macOS CI runners') @@ -118,12 +102,8 @@ class TestDownload: assert r.total_connects == 1, r.dump_logs() # download 500 files sequential - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_05_download_many_sequential(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h2' and env.curl_uses_lib('mbedtls') and \ sys.platform.startswith('darwin') and env.ci_run: pytest.skip('mbedtls 3.6.3 fails this test on macOS CI runners') @@ -140,12 +120,8 @@ class TestDownload: assert r.total_connects == 1, r.dump_logs() # download 500 files parallel - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_02_06_download_many_parallel(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h2' and env.curl_uses_lib('mbedtls') and \ sys.platform.startswith('darwin') and env.ci_run: pytest.skip('mbedtls 3.6.3 fails this test on macOS CI runners') @@ -159,12 +135,8 @@ class TestDownload: r.check_response(http_status=200, count=count, connect_count=1) # download files parallel, check connection reuse/multiplex - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_02_07_download_reuse(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 200 curl = CurlClient(env=env) urln = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-{count-1}]' @@ -192,24 +164,16 @@ class TestDownload: # http/1.1 should have used count connections assert r.total_connects == count, "http/1.1 should use this many connections" - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_08_1MB_serial(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 5 urln = f'https://{env.authority_for(env.domain1, proto)}/data-1m?[0-{count-1}]' curl = CurlClient(env=env) r = curl.http_download(urls=[urln], alpn_proto=proto) r.check_response(count=count, http_status=200) - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_02_09_1MB_parallel(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 5 urln = f'https://{env.authority_for(env.domain1, proto)}/data-1m?[0-{count-1}]' curl = CurlClient(env=env) @@ -220,12 +184,8 @@ class TestDownload: @pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests") @pytest.mark.skipif(condition=Env().ci_run, reason="not suitable for CI runs") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_10_10MB_serial(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 3 urln = f'https://{env.authority_for(env.domain1, proto)}/data-10m?[0-{count-1}]' curl = CurlClient(env=env) @@ -234,12 +194,8 @@ class TestDownload: @pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests") @pytest.mark.skipif(condition=Env().ci_run, reason="not suitable for CI runs") - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_02_11_10MB_parallel(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 3 urln = f'https://{env.authority_for(env.domain1, proto)}/data-10m?[0-{count-1}]' curl = CurlClient(env=env) @@ -248,12 +204,8 @@ class TestDownload: ]) r.check_response(count=count, http_status=200) - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_02_12_head_serial_https(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 5 urln = f'https://{env.authority_for(env.domain1, proto)}/data-10m?[0-{count-1}]' curl = CurlClient(env=env) @@ -263,11 +215,8 @@ class TestDownload: r.check_response(count=count, http_status=200) @pytest.mark.parametrize("proto", ['h2']) + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_02_13_head_serial_h2c(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 5 urln = f'http://{env.domain1}:{env.http_port}/data-10m?[0-{count-1}]' curl = CurlClient(env=env) @@ -276,12 +225,8 @@ class TestDownload: ]) r.check_response(count=count, http_status=200) - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_02_14_not_found(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 5 urln = f'https://{env.authority_for(env.domain1, proto)}/not-found?[0-{count-1}]' curl = CurlClient(env=env) @@ -292,12 +237,8 @@ class TestDownload: remote_port=env.port_for(alpn_proto=proto), remote_ip='127.0.0.1') - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_02_15_fail_not_found(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 5 urln = f'https://{env.authority_for(env.domain1, proto)}/not-found?[0-{count-1}]' curl = CurlClient(env=env) @@ -309,9 +250,8 @@ class TestDownload: remote_ip='127.0.0.1') @pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests") + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_02_20_h2_small_frames(self, env: Env, httpd, configures_httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") # Test case to reproduce content corruption as observed in # https://github.com/curl/curl/issues/10525 # To reliably reproduce, we need an Apache httpd that supports @@ -358,10 +298,9 @@ class TestDownload: # debug-override stream window size to reproduce #16955 @pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000]) @pytest.mark.parametrize("swin_max", [0, 10*1024]) + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_02_21_h2_lib_serial(self, env: Env, httpd, pause_offset, swin_max): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") count = 2 docname = 'data-10m' url = f'https://localhost:{env.https_port}/{docname}' @@ -381,12 +320,8 @@ class TestDownload: # download via lib client, several at a time, pause/resume @pytest.mark.parametrize("pause_offset", [100*1023]) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_22_lib_parallel_resume(self, env: Env, httpd, nghttpx, proto, pause_offset): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 max_parallel = 5 docname = 'data-10m' @@ -403,19 +338,15 @@ class TestDownload: self.check_downloads(client, srcfile, count) # download, several at a time, pause and abort paused - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_23a_lib_abort_paused(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip('OpenSSL QUIC fails here') if proto == 'h3' and env.ci_run and env.curl_uses_lib('quiche'): pytest.skip("fails in CI, but works locally for unknown reasons") count = 10 max_parallel = 5 - if proto in ['h2', 'h3']: + if proto in Env.http_mplx_protos(): pause_offset = 64 * 1024 else: pause_offset = 12 * 1024 @@ -434,19 +365,15 @@ class TestDownload: self.check_downloads(client, srcfile, count, complete=False) # download, several at a time, abort after n bytes - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_23b_lib_abort_offset(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip('OpenSSL QUIC fails here') if proto == 'h3' and env.ci_run and env.curl_uses_lib('quiche'): pytest.skip("fails in CI, but works locally for unknown reasons") count = 10 max_parallel = 5 - if proto in ['h2', 'h3']: + if proto in Env.http_mplx_protos(): abort_offset = 64 * 1024 else: abort_offset = 12 * 1024 @@ -465,19 +392,15 @@ class TestDownload: self.check_downloads(client, srcfile, count, complete=False) # download, several at a time, abort after n bytes - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_23c_lib_fail_offset(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip('OpenSSL QUIC fails here') if proto == 'h3' and env.ci_run and env.curl_uses_lib('quiche'): pytest.skip("fails in CI, but works locally for unknown reasons") count = 10 max_parallel = 5 - if proto in ['h2', 'h3']: + if proto in Env.http_mplx_protos(): fail_offset = 64 * 1024 else: fail_offset = 12 * 1024 @@ -496,12 +419,8 @@ class TestDownload: self.check_downloads(client, srcfile, count, complete=False) # speed limited download - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_24_speed_limit(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 url = f'https://{env.authority_for(env.domain1, proto)}/data-1m' curl = CurlClient(env=env) @@ -527,12 +446,8 @@ class TestDownload: # Special client that tests TLS session reuse in parallel transfers # TODO: just uses a single connection for h2/h3. Not sure how to prevent that - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_26_session_shared_reuse(self, env: Env, proto, httpd, nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") url = f'https://{env.authority_for(env.domain1, proto)}/data-100k' client = LocalClient(name='cli_tls_session_reuse', env=env) if not client.exists(): @@ -541,12 +456,8 @@ class TestDownload: r.check_exit_code(0) # test on paused transfers, based on issue #11982 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_27a_paused_no_cl(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") url = f'https://{env.authority_for(env.domain1, proto)}' \ '/curltest/tweak/?&chunks=6&chunk_size=8000' client = LocalClient(env=env, name='cli_h2_pausing') @@ -554,12 +465,8 @@ class TestDownload: r.check_exit_code(0) # test on paused transfers, based on issue #11982 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_27b_paused_no_cl(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") url = f'https://{env.authority_for(env.domain1, proto)}' \ '/curltest/tweak/?error=502' client = LocalClient(env=env, name='cli_h2_pausing') @@ -567,26 +474,18 @@ class TestDownload: r.check_exit_code(0) # test on paused transfers, based on issue #11982 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_27c_paused_no_cl(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") url = f'https://{env.authority_for(env.domain1, proto)}' \ '/curltest/tweak/?status=200&chunks=1&chunk_size=100' client = LocalClient(env=env, name='cli_h2_pausing') r = client.run(args=['-V', proto, url]) r.check_exit_code(0) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_28_get_compressed(self, env: Env, httpd, nghttpx, proto): if not env.have_compressed_curl(): pytest.skip("--compressed not supported") - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 urln = f'https://{env.authority_for(env.domain1brotli, proto)}/data-100k?[0-{count-1}]' curl = CurlClient(env=env) @@ -611,12 +510,8 @@ class TestDownload: # download via lib client, 1 at a time, pause/resume at different offsets @pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000]) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_29_h2_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 docname = 'data-10m' url = f'https://localhost:{env.https_port}/{docname}' @@ -631,9 +526,8 @@ class TestDownload: self.check_downloads(client, srcfile, count) # download parallel with prior knowledge + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_02_30_parallel_prior_knowledge(self, env: Env, httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") count = 3 curl = CurlClient(env=env) urln = f'http://{env.domain1}:{env.http_port}/data.json?[0-{count-1}]' @@ -644,9 +538,8 @@ class TestDownload: assert r.total_connects == 1, r.dump_logs() # download parallel with h2 "Upgrade:" + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_02_31_parallel_upgrade(self, env: Env, httpd, nghttpx): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") count = 3 curl = CurlClient(env=env) urln = f'http://{env.domain1}:{env.http_port}/data.json?[0-{count-1}]' @@ -663,15 +556,12 @@ class TestDownload: @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_32_earlydata(self, env: Env, httpd, nghttpx, proto): if not env.curl_can_early_data(): pytest.skip('TLS earlydata not implemented') - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and \ - (not env.have_h3() or not env.curl_can_h3_early_data()): - pytest.skip("h3 not supported") + if proto == 'h3' and not env.curl_can_h3_early_data(): + pytest.skip("h3 early data not supported") if proto != 'h3' and sys.platform.startswith('darwin') and env.ci_run: pytest.skip('failing on macOS CI runners') if proto == 'h3' and sys.platform.startswith('darwin') and env.curl_uses_lib('wolfssl'): @@ -718,17 +608,13 @@ class TestDownload: elif proto == 'h3': assert earlydata[1] == 109, f'{earlydata}' - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) @pytest.mark.parametrize("max_host_conns", [0, 1, 5]) def test_02_33_max_host_conns(self, env: Env, httpd, nghttpx, proto, max_host_conns): if not env.curl_is_debug(): pytest.skip('only works for curl debug builds') if not env.curl_is_verbose(): pytest.skip('only works for curl with verbose strings') - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 50 max_parallel = 50 docname = 'data-10k' @@ -760,17 +646,13 @@ class TestDownload: assert n <= max_host_conns assert matched_lines > 0 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) @pytest.mark.parametrize("max_total_conns", [0, 1, 5]) def test_02_34_max_total_conns(self, env: Env, httpd, nghttpx, proto, max_total_conns): if not env.curl_is_debug(): pytest.skip('only works for curl debug builds') if not env.curl_is_verbose(): pytest.skip('only works for curl with verbose strings') - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 50 max_parallel = 50 docname = 'data-10k' @@ -812,12 +694,8 @@ class TestDownload: # * h2/h3: server continues sending what the stream window allows and # since the one connection involved unpaused transfers, data continues # to be received, requiring buffering. - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_35_pause_bomb(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 pause_offset = 1024 * 1024 docname = 'bomb-100m.txt.var' @@ -832,17 +710,13 @@ class TestDownload: r.check_exit_code(0) # download with looong urls - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) @pytest.mark.parametrize("url_junk", [1024, 16*1024, 32*1024, 64*1024, 80*1024, 96*1024]) def test_02_36_looong_urls(self, env: Env, httpd, nghttpx, proto, url_junk): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_lib('quiche'): pytest.skip("quiche fails from 16k onwards") curl = CurlClient(env=env) - # url is longer than 'url_len' + # 'url' is longer than 'url_len' url = f'https://{env.authority_for(env.domain1, proto)}/data.json?{"x"*(url_junk)}' r = curl.http_download(urls=[url], alpn_proto=proto) if url_junk <= 1024: diff --git a/tests/http/test_03_goaway.py b/tests/http/test_03_goaway.py index 8acaa9dc65..2e1d6a5802 100644 --- a/tests/http/test_03_goaway.py +++ b/tests/http/test_03_goaway.py @@ -39,10 +39,9 @@ log = logging.getLogger(__name__) class TestGoAway: # download files sequentially with delay, reload server for GOAWAY + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_03_01_h2_goaway(self, env: Env, httpd, nghttpx): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") count = 3 self.r = None diff --git a/tests/http/test_04_stuttered.py b/tests/http/test_04_stuttered.py index bd2c5e1f77..7fa2fe37a5 100644 --- a/tests/http/test_04_stuttered.py +++ b/tests/http/test_04_stuttered.py @@ -39,12 +39,8 @@ log = logging.getLogger(__name__) class TestStuttered: # download 1 file, check that delayed response works in general - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_04_01_download_1(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 curl = CurlClient(env=env) urln = f'https://{env.authority_for(env.domain1, proto)}' \ @@ -56,12 +52,8 @@ class TestStuttered: # download 50 files in 100 chunks a 100 bytes with 10ms delay between # prepend 100 file requests to warm up connection processing limits # (Apache2 increases # of parallel processed requests after successes) - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_04_02_100_100_10(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 50 warmups = 100 curl = CurlClient(env=env) @@ -80,12 +72,8 @@ class TestStuttered: # download 50 files in 1000 chunks a 10 bytes with 1ms delay between # prepend 100 file requests to warm up connection processing limits # (Apache2 increases # of parallel processed requests after successes) - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_04_03_1000_10_1(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 50 warmups = 100 curl = CurlClient(env=env) @@ -104,12 +92,8 @@ class TestStuttered: # download 50 files in 10000 chunks a 1 byte with 10us delay between # prepend 100 file requests to warm up connection processing limits # (Apache2 increases # of parallel processed requests after successes) - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_04_04_1000_10_1(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 50 warmups = 100 curl = CurlClient(env=env) diff --git a/tests/http/test_05_errors.py b/tests/http/test_05_errors.py index 8d8ea707bb..258b7f11d5 100644 --- a/tests/http/test_05_errors.py +++ b/tests/http/test_05_errors.py @@ -38,12 +38,8 @@ log = logging.getLogger(__name__) class TestErrors: # download 1 file, check that we get CURLE_PARTIAL_FILE - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_05_01_partial_1(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 curl = CurlClient(env=env) urln = f'https://{env.authority_for(env.domain1, proto)}' \ @@ -60,12 +56,8 @@ class TestErrors: assert len(invalid_stats) == 0, f'failed: {invalid_stats}' # download files, check that we get CURLE_PARTIAL_FILE for all - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_05_02_partial_20(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip("openssl-quic is flaky in yielding proper error codes") count = 20 @@ -85,9 +77,8 @@ class TestErrors: assert len(invalid_stats) == 0, f'failed: {invalid_stats}' # access a resource that, on h2, RST the stream with HTTP_1_1_REQUIRED + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_05_03_required(self, env: Env, httpd, nghttpx): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) proto = 'http/1.1' urln = f'https://{env.authority_for(env.domain1, proto)}/curltest/1_1' diff --git a/tests/http/test_07_upload.py b/tests/http/test_07_upload.py index ad2db48a8c..8d69018841 100644 --- a/tests/http/test_07_upload.py +++ b/tests/http/test_07_upload.py @@ -51,12 +51,8 @@ class TestUpload: env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) # upload small data, check that this is what was echoed - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_01_upload_1_small(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") data = '0123456789' curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo?id=[0-0]' @@ -66,12 +62,8 @@ class TestUpload: assert respdata == [data] # upload large data, check that this is what was echoed - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_02_upload_1_large(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-100k') curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo?id=[0-0]' @@ -82,12 +74,8 @@ class TestUpload: assert respdata == indata # upload data sequentially, check that they were echoed - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_10_upload_sequential(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 20 data = '0123456789' curl = CurlClient(env=env) @@ -99,12 +87,8 @@ class TestUpload: assert respdata == [data] # upload data parallel, check that they were echoed - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_07_11_upload_parallel(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") # limit since we use a separate connection in h1 count = 20 data = '0123456789' @@ -118,12 +102,8 @@ class TestUpload: assert respdata == [data] # upload large data sequentially, check that this is what was echoed - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_12_upload_seq_large(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-100k') count = 10 curl = CurlClient(env=env) @@ -137,12 +117,8 @@ class TestUpload: assert respdata == indata # upload very large data sequentially, check that this is what was echoed - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_13_upload_seq_large(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-10m') count = 2 curl = CurlClient(env=env) @@ -155,15 +131,11 @@ class TestUpload: assert respdata == indata # upload from stdin, issue #14870 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) @pytest.mark.parametrize("indata", [ '', '1', '123\n456andsomething\n\n' ]) def test_07_14_upload_stdin(self, env: Env, httpd, nghttpx, proto, indata): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/put?id=[0-{count-1}]' @@ -173,12 +145,8 @@ class TestUpload: respdata = open(curl.response_file(i)).readlines() assert respdata == [f'{len(indata)}'] - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_15_hx_put(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 upload_size = 128*1024 url = f'https://localhost:{env.https_port}/curltest/put' @@ -191,12 +159,8 @@ class TestUpload: r.check_exit_code(0) self.check_downloads(client, r, [f"{upload_size}"], count) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_16_hx_put_reuse(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 upload_size = 128*1024 url = f'https://localhost:{env.https_port}/curltest/put' @@ -209,12 +173,8 @@ class TestUpload: r.check_exit_code(0) self.check_downloads(client, r, [f"{upload_size}"], count) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_17_hx_post_reuse(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 upload_size = 128*1024 url = f'https://localhost:{env.https_port}/curltest/echo' @@ -228,12 +188,8 @@ class TestUpload: self.check_downloads(client, r, ["x" * upload_size], count) # upload data parallel, check that they were echoed - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_07_20_upload_parallel(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") # limit since we use a separate connection in h1 count = 10 data = '0123456789' @@ -247,12 +203,8 @@ class TestUpload: assert respdata == [data] # upload large data parallel, check that this is what was echoed - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_07_21_upload_parallel_large(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-100k') # limit since we use a separate connection in h1 count = 10 @@ -263,15 +215,14 @@ class TestUpload: r.check_response(count=count, http_status=200) self.check_download(r, count, fdata, curl) - # upload large data parallel to a URL that denies uploads - @pytest.mark.parametrize("proto", ['h2', 'h3']) - def test_07_22_upload_parallel_fail(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") + # upload single large data to a URL that fails uploads, causing RESETs + # (We used to do this for 20 parallel transfers, but the triggered + # stream resets make nghttpx drop the connection after several, which + # then gives a non-deterministic number of completely failed transfers) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) + def test_07_22_upload_fail(self, env: Env, httpd, nghttpx, proto): fdata = os.path.join(env.gen_dir, 'data-10m') - count = 20 + count = 1 curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}'\ f'/curltest/tweak?status=400&delay=5ms&chunks=1&body_error=reset&id=[0-{count-1}]' @@ -282,12 +233,8 @@ class TestUpload: r.check_stats(count=count, exitcode=[18, 55, 56, 92, 95]) # PUT 100k - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_30_put_100k(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-100k') count = 1 curl = CurlClient(env=env) @@ -302,12 +249,8 @@ class TestUpload: assert respdata == exp_data # PUT 10m - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_31_put_10m(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-10m') count = 1 curl = CurlClient(env=env) @@ -322,12 +265,8 @@ class TestUpload: assert respdata == exp_data # issue #10591 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_32_issue_10591(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-10m') count = 1 curl = CurlClient(env=env) @@ -337,10 +276,9 @@ class TestUpload: # issue #11157, upload that is 404'ed by server, needs to terminate # correctly and not time out on sending + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_07_33_issue_11157a(self, env: Env, httpd, nghttpx): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") fdata = os.path.join(env.gen_dir, 'data-10m') # send a POST to our PUT handler which will send immediately a 404 back url = f'https://{env.authority_for(env.domain1, proto)}/curltest/put' @@ -360,10 +298,9 @@ class TestUpload: r.check_stats(1, 404) # issue #11157, send upload that is slowly read in + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_07_33_issue_11157b(self, env: Env, httpd, nghttpx): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") fdata = os.path.join(env.gen_dir, 'data-10m') # tell our test PUT handler to read the upload more slowly, so # that the send buffering and transfer loop needs to wait @@ -384,10 +321,9 @@ class TestUpload: assert r.exit_code == 0, r.dump_logs() r.check_stats(1, 200) + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_07_34_issue_11194(self, env: Env, httpd, nghttpx): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") # tell our test PUT handler to read the upload more slowly, so # that the send buffering and transfer loop needs to wait fdata = os.path.join(env.gen_dir, 'data-100k') @@ -406,9 +342,8 @@ class TestUpload: r.check_stats(1, 200) # upload large data on a h1 to h2 upgrade + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_07_35_h1_h2_upgrade_upload(self, env: Env, httpd, nghttpx): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") fdata = os.path.join(env.gen_dir, 'data-100k') curl = CurlClient(env=env) url = f'http://{env.domain1}:{env.http_port}/curltest/echo?id=[0-0]' @@ -424,12 +359,8 @@ class TestUpload: # upload to a 301,302,303 response @pytest.mark.parametrize("redir", ['301', '302', '303']) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_36_upload_30x(self, env: Env, httpd, nghttpx, redir, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip("OpenSSL's own QUIC is flaky here") data = '0123456789' * 10 @@ -443,12 +374,8 @@ class TestUpload: assert respdata == [] # was transformed to a GET # upload to a 307 response - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_37_upload_307(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip("OpenSSL's own QUIC is flaky here") data = '0123456789' * 10 @@ -462,12 +389,8 @@ class TestUpload: assert respdata == [data] # was POST again # POST form data, yet another code path in transfer - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_38_form_small(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo?id=[0-0]' r = curl.http_form(urls=[url], alpn_proto=proto, form={ @@ -476,12 +399,8 @@ class TestUpload: r.check_stats(count=1, http_status=200, exitcode=0) # POST data urlencoded, small enough to be sent with request headers - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_39_post_urlenc_small(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-63k') curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo?id=[0-0]' @@ -494,12 +413,8 @@ class TestUpload: assert respdata == indata # POST data urlencoded, large enough to be sent separate from request headers - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_40_post_urlenc_large(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") fdata = os.path.join(env.gen_dir, 'data-64k') curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo?id=[0-0]' @@ -516,12 +431,8 @@ class TestUpload: # than our default upload buffer length (64KB). # Unfixed, this will fail when run with CURL_DBG_SOCK_WBLOCK=80 most # of the time - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_41_post_urlenc_small(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_lib('quiche'): pytest.skip("quiche has CWND issues with large requests") fdata = os.path.join(env.gen_dir, 'data-63k') @@ -551,12 +462,8 @@ class TestUpload: # upload data, pause, let connection die with an incomplete response # issues #11769 #13260 - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_42a_upload_disconnect(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") client = LocalClient(name='cli_upload_pausing', env=env, timeout=60) if not client.exists(): pytest.skip(f'example client not built: {client.name}') @@ -573,12 +480,8 @@ class TestUpload: r.check_exit_code(18) # will fail as it should # upload data, pause, let connection die without any response at all - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_42b_upload_disconnect(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") client = LocalClient(name='cli_upload_pausing', env=env, timeout=60) if not client.exists(): pytest.skip(f'example client not built: {client.name}') @@ -590,12 +493,8 @@ class TestUpload: r.check_exit_code(exp_code) # GOT_NOTHING # upload data, pause, let connection die after 100 continue - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_42c_upload_disconnect(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") client = LocalClient(name='cli_upload_pausing', env=env, timeout=60) if not client.exists(): pytest.skip(f'example client not built: {client.name}') @@ -606,12 +505,8 @@ class TestUpload: exp_code = 0 # we get a 500 from the server r.check_exit_code(exp_code) # GOT_NOTHING - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_43_upload_denied(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip("openssl-quic is flaky in filed PUTs") fdata = os.path.join(env.gen_dir, 'data-10m') @@ -624,13 +519,9 @@ class TestUpload: extra_args=['--trace-config', 'all']) r.check_stats(count=count, http_status=413, exitcode=0) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) @pytest.mark.parametrize("httpcode", [301, 302, 307, 308]) def test_07_44_put_redir(self, env: Env, httpd, nghttpx, proto, httpcode): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 upload_size = 128*1024 url = f'https://localhost:{env.https_port}/curltest/put-redir-{httpcode}' @@ -651,12 +542,8 @@ class TestUpload: assert httpcodes[0] == httpcode, f'{r}' # speed limited on put handler - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_50_put_speed_limit(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 fdata = os.path.join(env.gen_dir, 'data-100k') up_len = 100 * 1024 @@ -673,12 +560,8 @@ class TestUpload: assert (speed_limit * 0.5) <= up_speed <= (speed_limit * 1.5), f'{r.stats[0]}' # speed limited on echo handler - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_51_echo_speed_limit(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 fdata = os.path.join(env.gen_dir, 'data-100k') speed_limit = 50 * 1024 diff --git a/tests/http/test_08_caddy.py b/tests/http/test_08_caddy.py index afacee5917..9229ce1f22 100644 --- a/tests/http/test_08_caddy.py +++ b/tests/http/test_08_caddy.py @@ -68,24 +68,16 @@ class TestCaddy: env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) # download 1 file - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_08_01_download_1(self, env: Env, caddy: Caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3_curl(): - pytest.skip("h3 not supported in curl") curl = CurlClient(env=env) url = f'https://{env.domain1}:{caddy.port}/data.json' r = curl.http_download(urls=[url], alpn_proto=proto) r.check_response(count=1, http_status=200) # download 1MB files sequentially - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_08_02_download_1mb_sequential(self, env: Env, caddy: Caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3_curl(): - pytest.skip("h3 not supported in curl") count = 50 curl = CurlClient(env=env) urln = f'https://{env.domain1}:{caddy.port}/data1.data?[0-{count-1}]' @@ -93,12 +85,8 @@ class TestCaddy: r.check_response(count=count, http_status=200, connect_count=1) # download 1MB files parallel - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_08_03_download_1mb_parallel(self, env: Env, caddy: Caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3_curl(): - pytest.skip("h3 not supported in curl") count = 20 curl = CurlClient(env=env) urln = f'https://{env.domain1}:{caddy.port}/data1.data?[0-{count-1}]' @@ -114,12 +102,8 @@ class TestCaddy: # download 5MB files sequentially @pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests") - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_08_04a_download_10mb_sequential(self, env: Env, caddy: Caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3_curl(): - pytest.skip("h3 not supported in curl") count = 40 curl = CurlClient(env=env) urln = f'https://{env.domain1}:{caddy.port}/data5.data?[0-{count-1}]' @@ -128,12 +112,8 @@ class TestCaddy: # download 10MB files sequentially @pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests") - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_08_04b_download_10mb_sequential(self, env: Env, caddy: Caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3_curl(): - pytest.skip("h3 not supported in curl") count = 20 curl = CurlClient(env=env) urln = f'https://{env.domain1}:{caddy.port}/data10.data?[0-{count-1}]' @@ -142,12 +122,8 @@ class TestCaddy: # download 10MB files parallel @pytest.mark.skipif(condition=Env().slow_network, reason="not suitable for slow network tests") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_08_05_download_1mb_parallel(self, env: Env, caddy: Caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3_curl(): - pytest.skip("h3 not supported in curl") if proto == 'http/1.1' and env.curl_uses_lib('mbedtls'): pytest.skip("mbedtls 3.6.0 fails on 50 connections with: " "ssl_handshake returned: (-0x7F00) SSL - Memory allocation failed") @@ -165,12 +141,8 @@ class TestCaddy: assert r.total_connects == 1, r.dump_logs() # post data parallel, check that they were echoed - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_08_06_post_parallel(self, env: Env, httpd, caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") # limit since we use a separate connection in h1 count = 20 data = '0123456789' @@ -184,12 +156,8 @@ class TestCaddy: assert respdata == [data] # put large file, check that they length were echoed - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_08_07_put_large(self, env: Env, httpd, caddy, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") # limit since we use a separate connection in h1< count = 1 fdata = os.path.join(env.gen_dir, 'data-10m') @@ -202,15 +170,12 @@ class TestCaddy: respdata = open(curl.response_file(i)).readlines() assert respdata == exp_data - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_08_08_earlydata(self, env: Env, httpd, caddy, proto): if not env.curl_can_early_data(): pytest.skip('TLS earlydata not implemented') - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and \ - (not env.have_h3() or not env.curl_can_h3_early_data()): - pytest.skip("h3 not supported") + if proto == 'h3' and not env.curl_can_h3_early_data(): + pytest.skip("h3 early data not supported") count = 2 docname = 'data10k.data' url = f'https://{env.domain1}:{caddy.port}/{docname}' diff --git a/tests/http/test_09_push.py b/tests/http/test_09_push.py index ea73bbc7e5..35425d11b7 100644 --- a/tests/http/test_09_push.py +++ b/tests/http/test_09_push.py @@ -60,9 +60,8 @@ class TestPush: httpd.reload_if_config_changed() # download a file that triggers a "103 Early Hints" response + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_09_01_h2_early_hints(self, env: Env, httpd, configures_httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") self.httpd_configure(env, httpd) curl = CurlClient(env=env) url = f'https://{env.domain1}:{env.https_port}/push/data1' @@ -74,9 +73,8 @@ class TestPush: assert 'link' in r.responses[0]['header'], f'{r.responses[0]}' assert r.responses[0]['header']['link'] == '; rel=preload', f'{r.responses[0]}' + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_09_02_h2_push(self, env: Env, httpd, configures_httpd): - if not env.have_h2_curl(): - pytest.skip("h2 not supported") self.httpd_configure(env, httpd) # use localhost as we do not have resolve support in local client url = f'https://localhost:{env.https_port}/push/data1' diff --git a/tests/http/test_10_proxy.py b/tests/http/test_10_proxy.py index aa4e43a380..37797181f8 100644 --- a/tests/http/test_10_proxy.py +++ b/tests/http/test_10_proxy.py @@ -71,10 +71,8 @@ class TestProxy: # download via https: proxy (no tunnel) @pytest.mark.skipif(condition=not Env.curl_has_feature('HTTPS-proxy'), reason='curl lacks HTTPS-proxy support') - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_10_02_proxys_down(self, env: Env, httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if proto == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') curl = CurlClient(env=env) @@ -87,7 +85,7 @@ class TestProxy: # upload via https: with proto (no tunnel) @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) @pytest.mark.parametrize("fname, fcount", [ ['data.json', 5], ['data-100k', 5], @@ -97,8 +95,6 @@ class TestProxy: reason="no nghttpx available") def test_10_02_proxys_up(self, env: Env, httpd, nghttpx, proto, fname, fcount): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if proto == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') count = fcount @@ -137,11 +133,9 @@ class TestProxy: r.check_response(count=1, http_status=200) # download https: with proto via http: proxytunnel - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") def test_10_05_proxytunnel_http(self, env: Env, httpd, nghttpx_fwd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'https://localhost:{env.https_port}/data.json' xargs = curl.get_proxy_args(proxys=False, tunnel=True) @@ -153,14 +147,12 @@ class TestProxy: # download https: with proto via https: proxytunnel @pytest.mark.skipif(condition=not Env.curl_has_feature('HTTPS-proxy'), reason='curl lacks HTTPS-proxy support') - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") def test_10_06_proxytunnel_https(self, env: Env, httpd, nghttpx_fwd, proto, tunnel): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') curl = CurlClient(env=env) @@ -179,8 +171,8 @@ class TestProxy: @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.parametrize("fname, fcount", [ ['data.json', 100], ['data-100k', 20], @@ -189,8 +181,6 @@ class TestProxy: @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") def test_10_07_pts_down_small(self, env: Env, httpd, nghttpx_fwd, proto, tunnel, fname, fcount): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') if env.curl_uses_lib('mbedtls') and \ @@ -213,8 +203,8 @@ class TestProxy: # upload many https: with proto via https: proxytunnel @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.parametrize("fname, fcount", [ ['data.json', 50], ['data-100k', 20], @@ -225,8 +215,6 @@ class TestProxy: @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") def test_10_08_upload_seq_large(self, env: Env, httpd, nghttpx, proto, tunnel, fname, fcount): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') if env.curl_uses_lib('mbedtls') and \ @@ -248,13 +236,11 @@ class TestProxy: assert respdata == indata, f'response {i} differs' @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") def test_10_09_reuse_server(self, env: Env, httpd, nghttpx_fwd, tunnel): - if tunnel == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') curl = CurlClient(env=env) @@ -274,14 +260,12 @@ class TestProxy: assert r.total_connects == 2 @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") def test_10_10_reuse_proxy(self, env: Env, httpd, nghttpx_fwd, tunnel): - # url twice via https: proxy separated with '--next', will reuse - if tunnel == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") + # URL twice via https: proxy separated with '--next', will reuse if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') if env.curl_uses_lib('mbedtls') and \ @@ -304,15 +288,13 @@ class TestProxy: assert r2.total_connects == 1 @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") @pytest.mark.skipif(condition=not Env.curl_uses_lib('openssl'), reason="tls13-ciphers not supported") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") def test_10_11_noreuse_proxy_https(self, env: Env, httpd, nghttpx_fwd, tunnel): # different --proxy-tls13-ciphers, no reuse of connection for https: - if tunnel == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') @@ -333,15 +315,13 @@ class TestProxy: assert r2.total_connects == 2 @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") @pytest.mark.skipif(condition=not Env.curl_uses_lib('openssl'), reason="tls13-ciphers not supported") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") def test_10_12_noreuse_proxy_http(self, env: Env, httpd, nghttpx_fwd, tunnel): # different --proxy-tls13-ciphers, no reuse of connection for http: - if tunnel == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') curl = CurlClient(env=env) @@ -362,15 +342,13 @@ class TestProxy: assert r2.total_connects == 2 @pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL") - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx available") @pytest.mark.skipif(condition=not Env.curl_uses_lib('openssl'), reason="tls13-ciphers not supported") @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") def test_10_13_noreuse_https(self, env: Env, httpd, nghttpx_fwd, tunnel): # different --tls13-ciphers on https: same proxy config - if tunnel == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') curl = CurlClient(env=env) @@ -393,10 +371,8 @@ class TestProxy: # download via https: proxy (no tunnel) using IP address @pytest.mark.skipif(condition=not Env.curl_has_feature('HTTPS-proxy'), reason='curl lacks HTTPS-proxy support') - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_10_14_proxys_ip_addr(self, env: Env, httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if proto == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') curl = CurlClient(env=env) diff --git a/tests/http/test_13_proxy_auth.py b/tests/http/test_13_proxy_auth.py index 6576bdba1a..080adef187 100644 --- a/tests/http/test_13_proxy_auth.py +++ b/tests/http/test_13_proxy_auth.py @@ -121,11 +121,9 @@ class TestProxyAuth: reason='curl lacks HTTPS-proxy support') @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) def test_13_07_tunnels_no_auth(self, env: Env, httpd, configures_httpd, nghttpx_fwd, proto, tunnel): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") self.httpd_configure(env, httpd) if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') @@ -143,11 +141,9 @@ class TestProxyAuth: reason='curl lacks HTTPS-proxy support') @pytest.mark.skipif(condition=not Env.curl_is_debug(), reason="needs curl debug") @pytest.mark.skipif(condition=not Env.curl_is_verbose(), reason="needs curl verbose strings") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) - @pytest.mark.parametrize("tunnel", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) + @pytest.mark.parametrize("tunnel", Env.http_h1_h2_protos()) def test_13_08_tunnels_auth(self, env: Env, httpd, configures_httpd, nghttpx_fwd, proto, tunnel): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") self.httpd_configure(env, httpd) if tunnel == 'h2' and not env.curl_uses_lib('nghttp2'): pytest.skip('only supported with nghttp2') diff --git a/tests/http/test_14_auth.py b/tests/http/test_14_auth.py index 3e15b22447..0187c76a6a 100644 --- a/tests/http/test_14_auth.py +++ b/tests/http/test_14_auth.py @@ -41,26 +41,18 @@ class TestAuth: env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) # download 1 file, not authenticated - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_14_01_digest_get_noauth(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/restricted/digest/data.json' r = curl.http_download(urls=[url], alpn_proto=proto) r.check_response(http_status=401) # download 1 file, authenticated - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_14_02_digest_get_auth(self, env: Env, httpd, nghttpx, proto): if not env.curl_has_feature('digest'): pytest.skip("curl built without digest") - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/restricted/digest/data.json' r = curl.http_download(urls=[url], alpn_proto=proto, extra_args=[ @@ -69,14 +61,10 @@ class TestAuth: r.check_response(http_status=200) # PUT data, authenticated - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_14_03_digest_put_auth(self, env: Env, httpd, nghttpx, proto): if not env.curl_has_feature('digest'): pytest.skip("curl built without digest") - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_ossl_quic(): pytest.skip("openssl-quic is flaky in retrying POST") data='0123456789' @@ -88,14 +76,10 @@ class TestAuth: r.check_response(http_status=200) # PUT data, digest auth large pw - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_14_04_digest_large_pw(self, env: Env, httpd, nghttpx, proto): if not env.curl_has_feature('digest'): pytest.skip("curl built without digest") - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") data='0123456789' password = 'x' * 65535 curl = CurlClient(env=env) @@ -109,12 +93,8 @@ class TestAuth: r.check_response(http_status=401) # PUT data, basic auth large pw - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_14_05_basic_large_pw(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and not env.curl_uses_lib('ngtcp2'): # See pytest.skip("quiche/openssl-quic have problems with large requests") @@ -131,12 +111,8 @@ class TestAuth: r.check_response(http_status=431) # PUT data, basic auth with very large pw - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_14_06_basic_very_large_pw(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if proto == 'h3' and env.curl_uses_lib('quiche'): # See pytest.skip("quiche has problems with large requests") diff --git a/tests/http/test_16_info.py b/tests/http/test_16_info.py index 017f799881..4e0d1ed5b1 100644 --- a/tests/http/test_16_info.py +++ b/tests/http/test_16_info.py @@ -45,12 +45,8 @@ class TestInfo: env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100*1024) # download plain file - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_16_01_info_download(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/data.json?[0-{count-1}]' @@ -62,12 +58,8 @@ class TestInfo: self.check_stat(idx, s, r, dl_size=30, ul_size=0) # download plain file with a 302 redirect - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_16_02_info_302_download(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/data.json.302?[0-{count-1}]' @@ -80,12 +72,8 @@ class TestInfo: for idx, s in enumerate(r.stats): self.check_stat(idx, s, r, dl_size=30, ul_size=0) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_16_03_info_upload(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 2 fdata = os.path.join(env.gen_dir, 'data-100k') fsize = 100 * 1024 diff --git a/tests/http/test_17_ssl_use.py b/tests/http/test_17_ssl_use.py index 49a20c6994..58ad7fdf15 100644 --- a/tests/http/test_17_ssl_use.py +++ b/tests/http/test_17_ssl_use.py @@ -115,13 +115,9 @@ class TestSSLUse: else: assert djson['SSL_SESSION_RESUMED'] == exp_resumed, f'{i}: {djson}\n{r.dump_logs()}' - # use host name with trailing dot, verify handshake - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + # use hostname with trailing dot, verify handshake + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_03_trailing_dot(self, env: Env, proto, httpd, nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) domain = f'{env.domain1}.' url = f'https://{env.authority_for(domain, proto)}/curltest/sslinfo' @@ -132,13 +128,9 @@ class TestSSLUse: # the SNI the server received is without trailing dot assert r.json['SSL_TLS_SNI'] == env.domain1, f'{r.json}' - # use host name with double trailing dot, verify handshake - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + # use hostname with double trailing dot, verify handshake + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_04_double_dot(self, env: Env, proto, httpd, nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) domain = f'{env.domain1}..' url = f'https://{env.authority_for(domain, proto)}/curltest/sslinfo' @@ -157,14 +149,10 @@ class TestSSLUse: assert r.exit_code in [7, 35, 60], f'{r}' # use ip address for connect - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_05_good_ip_addr(self, env: Env, proto, httpd, nghttpx): if env.curl_uses_lib('mbedtls'): pytest.skip("mbedTLS does use IP addresses in SNI") - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) domain = '127.0.0.1' url = f'https://{env.authority_for(domain, proto)}/curltest/sslinfo' @@ -176,14 +164,10 @@ class TestSSLUse: assert 'SSL_TLS_SNI' not in r.json, f'{r.json}' # use IP address that is not in cert - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_05_bad_ip_addr(self, env: Env, proto, httpd, configures_httpd, nghttpx, configures_nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") httpd.set_domain1_cred_name('domain1-no-ip') httpd.reload_if_config_changed() if proto == 'h3': @@ -195,14 +179,10 @@ class TestSSLUse: assert r.exit_code == 60, f'{r}' # use IP address that is in cert as DNS name (not really legal) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_05_very_bad_ip_addr(self, env: Env, proto, httpd, configures_httpd, nghttpx, configures_nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if env.curl_uses_lib('mbedtls'): pytest.skip("mbedtls falsely verifies a DNS: altname as IP address") if env.curl_uses_lib('wolfssl') and \ @@ -219,12 +199,8 @@ class TestSSLUse: assert r.exit_code == 60, f'{r}' # use localhost for connect - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_06_localhost(self, env: Env, proto, httpd, nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) domain = 'localhost' url = f'https://{env.authority_for(domain, proto)}/curltest/sslinfo' @@ -310,12 +286,8 @@ class TestSSLUse: else: assert r.exit_code != 0, r.dump_logs() - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_08_cert_status(self, env: Env, proto, httpd, nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if not env.curl_uses_lib('openssl') and \ not env.curl_uses_lib('gnutls') and \ not env.curl_uses_lib('quictls'): @@ -432,26 +404,18 @@ class TestSSLUse: reused_session = True assert reused_session, f'{r}\n{r.dump_logs()}' - # use host name server has no certificate for - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + # use hostname server has no certificate for + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_11_wrong_host(self, env: Env, proto, httpd, nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) domain = f'insecure.{env.tld}' url = f'https://{domain}:{env.port_for(proto)}/curltest/sslinfo' r = curl.http_get(url=url, alpn_proto=proto) assert r.exit_code == 60, f'{r}' - # use host name server has no cert for with --insecure - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + # use hostname server has no cert for with --insecure + @pytest.mark.parametrize("proto", Env.http_protos()) def test_17_12_insecure(self, env: Env, proto, httpd, nghttpx): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env) domain = f'insecure.{env.tld}' url = f'https://{domain}:{env.port_for(proto)}/curltest/sslinfo' @@ -462,10 +426,8 @@ class TestSSLUse: assert r.json, f'{r}' # connect to an expired certificate - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_17_14_expired_cert(self, env: Env, proto, httpd): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") curl = CurlClient(env=env) url = f'https://{env.expired_domain}:{env.port_for(proto)}/' r = curl.http_get(url=url, alpn_proto=proto) @@ -588,12 +550,8 @@ class TestSSLUse: else: assert r.exit_code != 0, r.dump_logs() - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) - def test_17_19_wrong_pin(self, env: Env, proto, httpd): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") + @pytest.mark.parametrize("proto", Env.http_protos()) + def test_17_19_wrong_pin(self, env: Env, proto, httpd, nghttpx): if env.curl_uses_lib('rustls-ffi'): pytest.skip('TLS backend ignores --pinnedpubkey') curl = CurlClient(env=env) @@ -604,12 +562,8 @@ class TestSSLUse: # expect NOT_IMPLEMENTED or CURLE_SSL_PINNEDPUBKEYNOTMATCH assert r.exit_code in [2, 90], f'{r.dump_logs()}' - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) - def test_17_20_correct_pin(self, env: Env, proto, httpd): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") + @pytest.mark.parametrize("proto", Env.http_protos()) + def test_17_20_correct_pin(self, env: Env, proto, httpd, nghttpx): curl = CurlClient(env=env) creds = env.get_credentials(env.domain1) assert creds diff --git a/tests/http/test_18_methods.py b/tests/http/test_18_methods.py index 10f4867c15..d693b67e89 100644 --- a/tests/http/test_18_methods.py +++ b/tests/http/test_18_methods.py @@ -43,12 +43,8 @@ class TestMethods: env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024) # download 1 file - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_18_01_delete(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") count = 1 curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/tweak?id=[0-{count-1}]' @@ -59,10 +55,9 @@ class TestMethods: # - HEADER frame with 204 and eos=0 # - 10ms later DATA frame length=0 and eos=1 # should be accepted + @pytest.mark.skipif(condition=not Env.have_h2_curl(), reason="curl without h2") def test_18_02_delete_h2_special(self, env: Env, httpd, nghttpx): proto = 'h2' - if not env.have_h2_curl(): - pytest.skip("h2 not supported") count = 1 curl = CurlClient(env=env) url = f'https://{env.authority_for(env.domain1, proto)}/curltest/tweak?id=[0-{count-1}]'\ diff --git a/tests/http/test_19_shutdown.py b/tests/http/test_19_shutdown.py index 7bbc035f28..efa7657fe9 100644 --- a/tests/http/test_19_shutdown.py +++ b/tests/http/test_19_shutdown.py @@ -66,10 +66,8 @@ class TestShutdown: # check with `tcpdump` that we do NOT see TCP RST when CURL_GRACEFUL_SHUTDOWN set @pytest.mark.skipif(condition=not Env.tcpdump(), reason="tcpdump not available") - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_19_02_check_shutdown(self, env: Env, httpd, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") if not env.curl_is_debug(): pytest.skip('only works for curl debug builds') run_env = os.environ.copy() @@ -164,12 +162,8 @@ class TestShutdown: assert len(removes) == count, f'{removes}' # check graceful shutdown on multiplexed http - @pytest.mark.parametrize("proto", ['h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_mplx_protos()) def test_19_06_check_shutdown(self, env: Env, httpd, nghttpx, proto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") if not env.curl_is_debug(): pytest.skip('only works for curl debug builds') if not env.curl_is_verbose(): diff --git a/tests/http/test_40_socks.py b/tests/http/test_40_socks.py index 2dd61cc2ec..8c6a81f4f6 100644 --- a/tests/http/test_40_socks.py +++ b/tests/http/test_40_socks.py @@ -61,12 +61,8 @@ class TestSocks: r.check_response(http_status=200) @pytest.mark.parametrize("sproto", ['socks4', 'socks5']) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) + @pytest.mark.parametrize("proto", Env.http_protos()) def test_40_02_socks_https(self, env: Env, sproto, proto, danted: Dante, httpd): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") - if proto == 'h3' and not env.have_h3(): - pytest.skip("h3 not supported") curl = CurlClient(env=env, socks_args=[ f'--{sproto}', f'127.0.0.1:{danted.port}' ]) @@ -78,10 +74,8 @@ class TestSocks: r.check_response(http_status=200) @pytest.mark.parametrize("sproto", ['socks4', 'socks5']) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_40_03_dl_serial(self, env: Env, httpd, danted, proto, sproto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") count = 3 urln = f'https://{env.authority_for(env.domain1, proto)}/data-10m?[0-{count-1}]' curl = CurlClient(env=env, socks_args=[ @@ -91,10 +85,8 @@ class TestSocks: r.check_response(count=count, http_status=200) @pytest.mark.parametrize("sproto", ['socks4', 'socks5']) - @pytest.mark.parametrize("proto", ['http/1.1', 'h2']) + @pytest.mark.parametrize("proto", Env.http_h1_h2_protos()) def test_40_04_ul_serial(self, env: Env, httpd, danted, proto, sproto): - if proto == 'h2' and not env.have_h2_curl(): - pytest.skip("h2 not supported") fdata = os.path.join(env.gen_dir, 'data-10m') count = 2 curl = CurlClient(env=env, socks_args=[ diff --git a/tests/http/testenv/caddy.py b/tests/http/testenv/caddy.py index d7f6a0d729..d7386bc28a 100644 --- a/tests/http/testenv/caddy.py +++ b/tests/http/testenv/caddy.py @@ -165,10 +165,10 @@ class Caddy: def _write_config(self): domain1 = self.env.domain1 creds1 = self.env.get_credentials(domain1) - assert creds1 # convince pytype this isn't None + assert creds1 # convince pytype this is not None domain2 = self.env.domain2 creds2 = self.env.get_credentials(domain2) - assert creds2 # convince pytype this isn't None + assert creds2 # convince pytype this is not None self._mkpath(self._docs_dir) self._mkpath(self._tmp_dir) with open(os.path.join(self._docs_dir, 'data.json'), 'w') as fd: diff --git a/tests/http/testenv/env.py b/tests/http/testenv/env.py index 31db104994..5e6bcfc687 100644 --- a/tests/http/testenv/env.py +++ b/tests/http/testenv/env.py @@ -506,6 +506,36 @@ class Env: return Env.curl_can_early_data() and \ Env.curl_uses_lib('ngtcp2') + @staticmethod + def http_protos() -> List[str]: + # http protocols we can test + if Env.have_h2_curl(): + if Env.have_h3(): + return ['http/1.1', 'h2', 'h3'] + else: + return ['http/1.1', 'h2'] + else: + return ['http/1.1'] + + @staticmethod + def http_h1_h2_protos() -> List[str]: + # http 1+2 protocols we can test + if Env.have_h2_curl(): + return ['http/1.1', 'h2'] + else: + return ['http/1.1'] + + @staticmethod + def http_mplx_protos() -> List[str]: + # http multiplexing protocols we can test + if Env.have_h2_curl(): + if Env.have_h3(): + return ['h2', 'h3'] + else: + return ['h2'] + else: + return [] + @staticmethod def have_h3() -> bool: return Env.have_h3_curl() and Env.have_h3_server() @@ -560,7 +590,8 @@ class Env: def issue_certs(self): if self._ca is None: - ca_dir = os.path.join(self.CONFIG.gen_root, 'ca') + # ca_dir = os.path.join(self.CONFIG.gen_root, 'ca') + ca_dir = os.path.join(self.gen_dir, 'ca') os.makedirs(ca_dir, exist_ok=True) lock_file = os.path.join(ca_dir, 'ca.lock') with FileLock(lock_file): diff --git a/tests/http/testenv/httpd.py b/tests/http/testenv/httpd.py index 740237abc4..52578be7d6 100644 --- a/tests/http/testenv/httpd.py +++ b/tests/http/testenv/httpd.py @@ -100,9 +100,9 @@ class Httpd: raise Exception(f'{env.apxs} failed to query libexecdir: {p}') self._mods_dir = p.stdout.strip() if self._mods_dir is None: - raise Exception('apache modules dir cannot be found') + raise Exception('apache modules directory cannot be found') if not os.path.exists(self._mods_dir): - raise Exception(f'apache modules dir does not exist: {self._mods_dir}') + raise Exception(f'apache modules directory does not exist: {self._mods_dir}') self._maybe_running = False self.ports = {} self._rmf(self._error_log) @@ -260,17 +260,17 @@ class Httpd: domain1 = self.env.domain1 domain1brotli = self.env.domain1brotli creds1 = self.env.get_credentials(self._domain1_cred_name) - assert creds1 # convince pytype this isn't None + assert creds1 # convince pytype this is not None self._loaded_domain1_cred_name = self._domain1_cred_name domain2 = self.env.domain2 creds2 = self.env.get_credentials(domain2) - assert creds2 # convince pytype this isn't None + assert creds2 # convince pytype this is not None exp_domain = self.env.expired_domain exp_creds = self.env.get_credentials(exp_domain) - assert exp_creds # convince pytype this isn't None + assert exp_creds # convince pytype this is not None proxy_domain = self.env.proxy_domain proxy_creds = self.env.get_credentials(proxy_domain) - assert proxy_creds # convince pytype this isn't None + assert proxy_creds # convince pytype this is not None self._mkpath(self._conf_dir) self._mkpath(self._docs_dir) self._mkpath(self._logs_dir) diff --git a/tests/http/testenv/mod_curltest/mod_curltest.c b/tests/http/testenv/mod_curltest/mod_curltest.c index 17d0688ace..cb236557e0 100644 --- a/tests/http/testenv/mod_curltest/mod_curltest.c +++ b/tests/http/testenv/mod_curltest/mod_curltest.c @@ -45,10 +45,10 @@ static int curltest_sslinfo_handler(request_rec *r); AP_DECLARE_MODULE(curltest) = { STANDARD20_MODULE_STUFF, - NULL, /* func to create per dir config */ - NULL, /* func to merge per dir config */ - NULL, /* func to create per server config */ - NULL, /* func to merge per server config */ + NULL, /* func to create per-directory config */ + NULL, /* func to merge per-directory config */ + NULL, /* func to create per-server config */ + NULL, /* func to merge per-server config */ NULL, /* command handlers */ curltest_hooks, #ifdef AP_MODULE_FLAG_NONE @@ -398,7 +398,7 @@ static int curltest_tweak_handler(request_rec *r) } } else if(!strcmp("id", arg)) { - /* just an id for repeated requests with curl's url globbing */ + /* just an id for repeated requests with curl's URL globbing */ request_id = val; continue; } @@ -606,7 +606,7 @@ static int curltest_put_handler(request_rec *r) *s = '\0'; val = s + 1; if(!strcmp("id", arg)) { - /* just an id for repeated requests with curl's url globbing */ + /* just an id for repeated requests with curl's URL globbing */ request_id = val; continue; } @@ -804,7 +804,7 @@ static int curltest_sslinfo_handler(request_rec *r) *s = '\0'; val = s + 1; if(!strcmp("id", arg)) { - /* just an id for repeated requests with curl's url globbing */ + /* just an id for repeated requests with curl's URL globbing */ request_id = val; continue; } diff --git a/tests/http/testenv/nghttpx.py b/tests/http/testenv/nghttpx.py index dfb416334c..6db888b901 100644 --- a/tests/http/testenv/nghttpx.py +++ b/tests/http/testenv/nghttpx.py @@ -238,7 +238,7 @@ class NghttpxQuic(Nghttpx): if self._process: self.stop() creds = self.env.get_credentials(self._cred_name) - assert creds # convince pytype this isn't None + assert creds # convince pytype this is not None self._loaded_cred_name = self._cred_name args = [self._cmd, f'--frontend=*,{self._port};tls'] if self.supports_h3(): @@ -297,7 +297,7 @@ class NghttpxFwd(Nghttpx): if self._process: self.stop() creds = self.env.get_credentials(self._cred_name) - assert creds # convince pytype this isn't None + assert creds # convince pytype this is not None self._loaded_cred_name = self._cred_name args = [ self._cmd, diff --git a/tests/http/testenv/vsftpd.py b/tests/http/testenv/vsftpd.py index 0819861c62..acf86b989e 100644 --- a/tests/http/testenv/vsftpd.py +++ b/tests/http/testenv/vsftpd.py @@ -202,7 +202,7 @@ class VsFTPD: ] if self._with_ssl: creds = self.env.get_credentials(self.domain) - assert creds # convince pytype this isn't None + assert creds # convince pytype this is not None conf.extend([ 'ssl_enable=YES', 'debug_ssl=YES', diff --git a/tests/http2-server.pl b/tests/http2-server.pl index 73dbf62e40..3ab38803f1 100755 --- a/tests/http2-server.pl +++ b/tests/http2-server.pl @@ -102,7 +102,7 @@ while(@ARGV) { } } elsif($ARGV[0]) { - print STDERR "\nWarning: http2-server.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: http2-server.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } diff --git a/tests/http3-server.pl b/tests/http3-server.pl index b7f9dd3009..13cc49a9df 100755 --- a/tests/http3-server.pl +++ b/tests/http3-server.pl @@ -102,7 +102,7 @@ while(@ARGV) { } } else { - print STDERR "\nWarning: http3-server.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: http3-server.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } diff --git a/tests/libtest/cli_hx_download.c b/tests/libtest/cli_hx_download.c index f88a456a20..82e8c1b70d 100644 --- a/tests/libtest/cli_hx_download.c +++ b/tests/libtest/cli_hx_download.c @@ -256,7 +256,7 @@ static void usage_hx_download(const char *msg) curl_mfprintf(stderr, "%s\n", msg); curl_mfprintf(stderr, "usage: [options] url\n" - " download a url with following options:\n" + " download a URL with following options:\n" " -a abort paused transfer\n" " -m number max parallel downloads\n" " -e use TLS early data when possible\n" diff --git a/tests/libtest/cli_hx_upload.c b/tests/libtest/cli_hx_upload.c index 9ce955bba6..f0183f6df2 100644 --- a/tests/libtest/cli_hx_upload.c +++ b/tests/libtest/cli_hx_upload.c @@ -208,7 +208,7 @@ static void usage_hx_upload(const char *msg) curl_mfprintf(stderr, "%s\n", msg); curl_mfprintf(stderr, "usage: [options] url\n" - " upload to a url with following options:\n" + " upload to a URL with following options:\n" " -a abort paused transfer\n" " -e use TLS earlydata\n" " -m number max parallel uploads\n" diff --git a/tests/libtest/first.c b/tests/libtest/first.c index 7ab38a9fd8..a8e2e91cf0 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -131,7 +131,7 @@ static void memory_tracking_init(void) /* if CURL_MEMDEBUG is set, this starts memory tracking message logging */ env = getenv("CURL_MEMDEBUG"); if(env) { - /* use the value as file name */ + /* use the value as filename */ curl_dbg_memdebug(env); } /* if CURL_MEMLIMIT is set, this enables fail-on-alloc-number-N feature */ diff --git a/tests/libtest/first.h b/tests/libtest/first.h index 5557411754..f5cbc60237 100644 --- a/tests/libtest/first.h +++ b/tests/libtest/first.h @@ -27,9 +27,9 @@ #define CURL_DISABLE_DEPRECATION /* Now include the curl_setup.h file from libcurl's private libdir (the source - version, but that might include "curl_config.h" from the build dir so we - need both of them in the include path), so that we get good in-depth - knowledge about the system we're building this on */ + version, but that might include "curl_config.h" from the build directory so + we need both of them in the include path), so that we get good in-depth + knowledge about the system we are building this on */ #include "curl_setup.h" #include diff --git a/tests/libtest/lib1308.c b/tests/libtest/lib1308.c index 1455b0b0df..b859d4da5f 100644 --- a/tests/libtest/lib1308.c +++ b/tests/libtest/lib1308.c @@ -56,7 +56,7 @@ static CURLcode test_lib1308(const char *URL) CURLFORM_COPYCONTENTS, "content", CURLFORM_END); t1308_fail_unless(rc == 0, "curl_formadd returned error"); - /* after the first curl_formadd when there's a single entry, both pointers + /* after the first curl_formadd when there is a single entry, both pointers should point to the same struct */ t1308_fail_unless(post == last, "post and last weren't the same"); diff --git a/tests/libtest/lib1531.c b/tests/libtest/lib1531.c index 6e69c5baee..65b20c2993 100644 --- a/tests/libtest/lib1531.c +++ b/tests/libtest/lib1531.c @@ -50,7 +50,7 @@ static CURLcode test_lib1531(const char *URL) /* add the individual transfer */ curl_multi_add_handle(multi, curl); - /* set the options (I left out a few, you'll get the point anyway) */ + /* set the options (I left out a few, you get the point anyway) */ curl_easy_setopt(curl, CURLOPT_URL, URL); curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, testDataSize); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, testData); diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 0071bb0f8b..db85fe7382 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -399,7 +399,7 @@ static const struct testcase get_parts_list[] ={ CURLU_DEFAULT_SCHEME, 0, CURLUE_BAD_IPV6}, {"http://[ab.be]/x", "", CURLU_DEFAULT_SCHEME, 0, CURLUE_BAD_IPV6}, - /* URL without host name */ + /* URL without hostname */ {"http://a:b@/x", "", CURLU_DEFAULT_SCHEME, 0, CURLUE_NO_HOST}, {"boing:80", @@ -641,7 +641,7 @@ static const struct urltestcase get_url_list[] = { {"mailto:infobot@example.com?body=send%20current-issue", "", 0, 0, CURLUE_UNSUPPORTED_SCHEME}, {"about:80", "https://about:80/", CURLU_DEFAULT_SCHEME, 0, CURLUE_OK}, - /* percent encoded host names */ + /* percent encoded hostnames */ {"http://example.com%40127.0.0.1/", "", 0, 0, CURLUE_BAD_HOSTNAME}, {"http://example.com%21127.0.0.1/", "", 0, 0, CURLUE_BAD_HOSTNAME}, {"http://example.com%3f127.0.0.1/", "", 0, 0, CURLUE_BAD_HOSTNAME}, @@ -996,7 +996,7 @@ static const struct setcase set_parts_list[] = { 0, /* set */ CURLUE_OK, CURLUE_BAD_HOSTNAME}, {"https://example.com/", - "host=0xff,", /* '++' there's no automatic URL decode when setting this + "host=0xff,", /* '++' there is no automatic URL decode when setting this part */ "https://0xff/", 0, /* get */ @@ -1016,7 +1016,7 @@ static const struct setcase set_parts_list[] = { "https://example.com/", 0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_BAD_SCHEME}, {"https://example.com/", - /* Set a 41 bytes scheme. That's too long so the old scheme remains set. */ + /* Set a 41 bytes scheme. That is too long so the old scheme remains set. */ "scheme=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc,", "https://example.com/", 0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_BAD_SCHEME}, @@ -1069,7 +1069,7 @@ static const struct setcase set_parts_list[] = { "scheme=https,user= @:,host=foobar,", "https://%20%20%20%40%3A@foobar/", 0, CURLU_URLENCODE, CURLUE_OK, CURLUE_OK}, - /* Setting a host name with spaces is not OK: */ + /* Setting a hostname with spaces is not OK: */ {NULL, "scheme=https,host= ,path= ,user= ,password= ,query= ,fragment= ,", "[nothing]", diff --git a/tests/libtest/lib1565.c b/tests/libtest/lib1565.c index 893950b90d..7e983978e7 100644 --- a/tests/libtest/lib1565.c +++ b/tests/libtest/lib1565.c @@ -111,7 +111,7 @@ static CURLcode test_lib1565(const char *URL) if(!result) tid_valid = true; else { - curl_mfprintf(stderr, "%s:%d Couldn't create thread, errno %d\n", + curl_mfprintf(stderr, "%s:%d Could not create thread, errno %d\n", __FILE__, __LINE__, result); goto test_cleanup; } @@ -198,7 +198,7 @@ test_cleanup: return t1565_test_failure; } -#else /* without pthread, this test doesn't work */ +#else /* without pthread, this test does not work */ static CURLcode test_lib1565(const char *URL) { (void)URL; diff --git a/tests/libtest/lib1592.c b/tests/libtest/lib1592.c index 1a36c4a925..021a016351 100644 --- a/tests/libtest/lib1592.c +++ b/tests/libtest/lib1592.c @@ -29,9 +29,9 @@ * only tests whichever resolver curl is actually built with. */ -/* We're willing to wait a very generous two seconds for the removal. This is +/* We are willing to wait a generous two seconds for the removal. This is as low as we can go while still easily supporting SIGALRM timing for the - non-threaded blocking resolver. It doesn't matter that much because when + non-threaded blocking resolver. It does not matter that much because when the test passes, we never wait this long. We set it much higher via the default TEST_HANG_TIMEOUT to avoid issues when running on overloaded CI machines. */ @@ -66,14 +66,14 @@ static CURLcode test_lib1592(const char *URL) blocks. */ timeout = TEST_HANG_TIMEOUT * 2; else { - /* If we can't set the DNS server, presume that we are configured to use a - resolver that can't be cancelled (i.e. the threaded resolver or the + /* If we cannot set the DNS server, presume that we are configured to use + a resolver that cannot be cancelled (i.e. the threaded resolver or the non-threaded blocking resolver). So, we just test that the curl_multi_remove_handle() call does finish well within our test timeout. - But, it is very unlikely that the resolver request will take any time at - all because we haven't been able to configure the resolver to use an + But, it is unlikely that the resolver request will take any time at + all because we have not been able to configure the resolver to use an non-responsive DNS server. At least we exercise the flow. */ curl_mfprintf(stderr, @@ -83,7 +83,7 @@ static CURLcode test_lib1592(const char *URL) } /* Setting a timeout on the request should ensure that even if we have to - wait for the resolver during curl_multi_remove_handle(), it won't take + wait for the resolver during curl_multi_remove_handle(), it will not take longer than this, because the resolver request inherits its timeout from this. */ easy_setopt(curl, CURLOPT_TIMEOUT_MS, timeout); @@ -108,8 +108,8 @@ static CURLcode test_lib1592(const char *URL) curl_mfprintf(stderr, "curl_multi_remove_handle() succeeded\n"); /* Fail the test if it took too long to remove. This happens after the fact, - and says "it seems that it would have run forever", which isn't true, but - it's close enough, and simple to do. */ + and says "it seems that it would have run forever", which is not true, but + it is close enough, and simple to do. */ abort_on_test_timeout(); test_cleanup: diff --git a/tests/libtest/lib1593.c b/tests/libtest/lib1593.c index 22a07e2920..5b6e57d4f7 100644 --- a/tests/libtest/lib1593.c +++ b/tests/libtest/lib1593.c @@ -41,7 +41,7 @@ static CURLcode test_lib1593(const char *URL) easy_setopt(curl, CURLOPT_URL, URL); easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE); - /* Some TIMEVALUE; it doesn't matter. */ + /* Some TIMEVALUE; it does not matter. */ easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680L); header = curl_slist_append(NULL, "If-Modified-Since:"); diff --git a/tests/libtest/lib1906.c b/tests/libtest/lib1906.c index 72486d6227..da0f9f56b9 100644 --- a/tests/libtest/lib1906.c +++ b/tests/libtest/lib1906.c @@ -54,7 +54,7 @@ static CURLcode test_lib1906(const char *URL) } res = CURLE_OK; /* reset for next use */ - /* print the used url */ + /* print the used URL */ curl_url_get(curlu, CURLUPART_URL, &url_after, 0); curl_mfprintf(stderr, "curlu now: <%s>\n", url_after); curl_free(url_after); @@ -69,7 +69,7 @@ static CURLcode test_lib1906(const char *URL) "curl_easy_perform returned %d: <%s>, <%s>\n", res, curl_easy_strerror(res), error_buffer); - /* print url */ + /* print URL */ curl_url_get(curlu, CURLUPART_URL, &url_after, 0); curl_mfprintf(stderr, "curlu now: <%s>\n", url_after); diff --git a/tests/libtest/lib1907.c b/tests/libtest/lib1907.c index 2aed892407..0a3556719b 100644 --- a/tests/libtest/lib1907.c +++ b/tests/libtest/lib1907.c @@ -43,7 +43,7 @@ static CURLcode test_lib1907(const char *URL) "curl_easy_perform returned %d: <%s>, <%s>\n", res, curl_easy_strerror(res), error_buffer); - /* print the used url */ + /* print the used URL */ if(!curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url_after)) curl_mprintf("Effective URL: %s\n", url_after); diff --git a/tests/libtest/lib1908.c b/tests/libtest/lib1908.c index 1613d03e01..ac841ca1a1 100644 --- a/tests/libtest/lib1908.c +++ b/tests/libtest/lib1908.c @@ -53,7 +53,7 @@ static CURLcode test_lib1908(const char *URL) curl_easy_reset(curl); - /* using the same file name for the alt-svc cache, this clobbers the + /* using the same filename for the alt-svc cache, this clobbers the content just written from the 'curldupe' handle */ curl_easy_cleanup(curl); } diff --git a/tests/libtest/lib1918.c b/tests/libtest/lib1918.c index 86fa84c92f..de9252107b 100644 --- a/tests/libtest/lib1918.c +++ b/tests/libtest/lib1918.c @@ -41,11 +41,11 @@ static CURLcode test_lib1918(const char *URL) curl_easy_option_by_id(o->id); if(ename->id != o->id) { - curl_mprintf("name lookup id %d doesn't match %d\n", + curl_mprintf("name lookup id %d does not match %d\n", ename->id, o->id); } else if(eid->id != o->id) { - curl_mprintf("ID lookup %d doesn't match %d\n", + curl_mprintf("ID lookup %d does not match %d\n", ename->id, o->id); } } diff --git a/tests/libtest/lib1939.c b/tests/libtest/lib1939.c index 5a10db96b1..9985af5adc 100644 --- a/tests/libtest/lib1939.c +++ b/tests/libtest/lib1939.c @@ -48,7 +48,7 @@ static CURLcode test_lib1939(const char *URL) if(!c) { - /* We're going to drive the transfer using multi interface here, + /* We are going to drive the transfer using multi interface here, because we want to stop during the middle. */ m = curl_multi_add_handle(multi, curl); diff --git a/tests/libtest/lib1940.c b/tests/libtest/lib1940.c index 117afecf2f..283128dc31 100644 --- a/tests/libtest/lib1940.c +++ b/tests/libtest/lib1940.c @@ -98,7 +98,7 @@ static CURLcode test_lib1940(const char *URL) /* ignores any content */ easy_setopt(curl, CURLOPT_WRITEFUNCTION, t1940_write_cb); - /* if there's a proxy set, use it */ + /* if there is a proxy set, use it */ if(libtest_arg2 && *libtest_arg2) { easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L); diff --git a/tests/libtest/lib1945.c b/tests/libtest/lib1945.c index f0a92d6033..ee8e69f100 100644 --- a/tests/libtest/lib1945.c +++ b/tests/libtest/lib1945.c @@ -60,7 +60,7 @@ static CURLcode test_lib1945(const char *URL) /* ignores any content */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, t1945_write_cb); - /* if there's a proxy set, use it */ + /* if there is a proxy set, use it */ if(libtest_arg2 && *libtest_arg2) { curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L); diff --git a/tests/libtest/lib2032.c b/tests/libtest/lib2032.c index 81c949ab44..e0f9990f59 100644 --- a/tests/libtest/lib2032.c +++ b/tests/libtest/lib2032.c @@ -123,7 +123,7 @@ static CURLcode test_lib2032(const char *URL) /* libntlmconnect */ int maxfd = -99; bool found_new_socket = FALSE; - /* Start a new handle if we aren't at the max */ + /* Start a new handle if we are not at the max */ if(state == ReadyForNewHandle) { easy_init(ntlm_curls[num_handles]); @@ -204,7 +204,7 @@ static CURLcode test_lib2032(const char *URL) /* libntlmconnect */ interval.tv_sec = 0; interval.tv_usec = 5000; - /* if there's no timeout and we get here on the last handle, we may + /* if there is no timeout and we get here on the last handle, we may already have read the last part of the stream so waiting makes no sense */ if(!running && num_handles == MAX_EASY_HANDLES) { diff --git a/tests/libtest/lib2405.c b/tests/libtest/lib2405.c index 2945b45b6c..4f3c8015c6 100644 --- a/tests/libtest/lib2405.c +++ b/tests/libtest/lib2405.c @@ -223,7 +223,7 @@ static CURLcode test_run(const char *URL, long option, break; } - /* checking case when we don't have enough space for waitfds */ + /* checking case when we do not have enough space for waitfds */ mc = curl_multi_waitfds(multi, ufds1, fd_count - 1, &fd_count_chk); if(mc != CURLM_OUT_OF_MEMORY) { @@ -236,7 +236,7 @@ static CURLcode test_run(const char *URL, long option, if(fd_count_chk < fd_count) { curl_mfprintf(stderr, "curl_multi_waitfds() should return the amount of fds " - "needed if enough isn't passed in (%u vs. %u).\n", + "needed if enough is not passed in (%u vs. %u).\n", fd_count_chk, fd_count); res = TEST_ERR_FAILURE; break; @@ -264,7 +264,7 @@ static CURLcode test_run(const char *URL, long option, if(fd_count_chk < fd_count) { curl_mfprintf(stderr, "curl_multi_waitfds() should return the amount of fds " - "needed if enough isn't passed in (%u vs. %u).\n", + "needed if enough is not passed in (%u vs. %u).\n", fd_count_chk, fd_count); res = TEST_ERR_FAILURE; break; diff --git a/tests/libtest/lib3026.c b/tests/libtest/lib3026.c index 75d419cb58..55d933462f 100644 --- a/tests/libtest/lib3026.c +++ b/tests/libtest/lib3026.c @@ -59,7 +59,7 @@ static CURLcode test_lib3026(const char *URL) results[i] = CURL_LAST; /* initialize with invalid value */ th = CreateThread(NULL, 0, t3026_run_thread, &results[i], 0, NULL); if(!th) { - curl_mfprintf(stderr, "%s:%d Couldn't create thread, " + curl_mfprintf(stderr, "%s:%d Could not create thread, " "GetLastError 0x%08lx\n", __FILE__, __LINE__, GetLastError()); tid_count = i; @@ -120,7 +120,7 @@ static CURLcode test_lib3026(const char *URL) results[i] = CURL_LAST; /* initialize with invalid value */ res = pthread_create(&tids[i], NULL, t3026_run_thread, &results[i]); if(res) { - curl_mfprintf(stderr, "%s:%d Couldn't create thread, errno %d\n", + curl_mfprintf(stderr, "%s:%d Could not create thread, errno %d\n", __FILE__, __LINE__, res); tid_count = i; test_failure = TEST_ERR_MAJOR_BAD; @@ -142,7 +142,7 @@ cleanup: return test_failure; } -#else /* without pthread or Windows, this test doesn't work */ +#else /* without pthread or Windows, this test does not work */ static CURLcode test_lib3026(const char *URL) { curl_version_info_data *ver; diff --git a/tests/libtest/lib3102.c b/tests/libtest/lib3102.c index 136ec0a1b7..9cc87543dc 100644 --- a/tests/libtest/lib3102.c +++ b/tests/libtest/lib3102.c @@ -106,7 +106,7 @@ static CURLcode test_lib3102(const char *URL) return TEST_ERR_MAJOR_BAD; } - /* Set the HTTPS url to retrieve. */ + /* Set the HTTPS URL to retrieve. */ test_setopt(curl, CURLOPT_URL, URL); /* Capture certificate information */ diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c index b4f7702851..37cc1e0b3f 100644 --- a/tests/libtest/lib505.c +++ b/tests/libtest/lib505.c @@ -61,14 +61,9 @@ static CURLcode test_lib505(const char *URL) } /* get the file size of the local file */ -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - hd = stat(libtest_arg2, &file_info); -#else hd = fstat(fileno(hd_src), &file_info); -#endif if(hd == -1) { - /* can't open file, bail out */ + /* cannot open file, bail out */ curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n", errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2); @@ -137,7 +132,7 @@ static CURLcode test_lib505(const char *URL) test_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size); - /* Now run off and do what you've been told! */ + /* Now run off and do what you have been told! */ res = curl_easy_perform(curl); test_cleanup: diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 7971fbeb17..928c33b13c 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -150,7 +150,7 @@ static void *t506_test_fire(void *ptr) code = curl_easy_perform(curl); if(code) { int i = 0; - curl_mfprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", + curl_mfprintf(stderr, "perform URL '%s' repeat %d failed, curlcode %d\n", tdata->url, i, code); } diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c index a2cb3471bf..b8a9ec4a6a 100644 --- a/tests/libtest/lib518.c +++ b/tests/libtest/lib518.c @@ -142,7 +142,7 @@ static int t518_test_rlimit(int keep_open) curl_mfprintf(stderr, "raising soft limit up to OPEN_MAX\n"); rl.rlim_cur = OPEN_MAX; if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { - /* on failure don't abort just issue a warning */ + /* on failure do not abort just issue a warning */ t518_store_errmsg("setrlimit() failed", errno); curl_mfprintf(stderr, "%s\n", t518_msgbuff); t518_msgbuff[0] = '\0'; @@ -153,7 +153,7 @@ static int t518_test_rlimit(int keep_open) curl_mfprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { - /* on failure don't abort just issue a warning */ + /* on failure do not abort just issue a warning */ t518_store_errmsg("setrlimit() failed", errno); curl_mfprintf(stderr, "%s\n", t518_msgbuff); t518_msgbuff[0] = '\0'; @@ -248,7 +248,7 @@ static int t518_test_rlimit(int keep_open) t518_num_open.rlim_max = NUM_OPEN; - /* verify that we won't overflow size_t in malloc() */ + /* verify that we do not overflow size_t in malloc() */ if((size_t)(t518_num_open.rlim_max) > ((size_t)-1) / sizeof(*t518_testfd)) { tutil_rlim2str(strbuff1, sizeof(strbuff1), t518_num_open.rlim_max); diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c index 4c33973ec9..4ca7ab7d65 100644 --- a/tests/libtest/lib525.c +++ b/tests/libtest/lib525.c @@ -52,14 +52,9 @@ static CURLcode test_lib525(const char *URL) } /* get the file size of the local file */ -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - hd = stat(libtest_arg2, &file_info); -#else hd = fstat(fileno(hd_src), &file_info); -#endif if(hd == -1) { - /* can't open file, bail out */ + /* cannot open file, bail out */ curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n", errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2); diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index 5558487122..e7e86a32cc 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -257,7 +257,7 @@ static CURLMcode socket_action(CURLM *multi, curl_socket_t s, int evBitmask, CURLMcode result = curl_multi_socket_action(multi, s, evBitmask, &numhandles); if(result != CURLM_OK) { - curl_mfprintf(stderr, "%s Curl error on %s (%i) %s\n", + curl_mfprintf(stderr, "%s curl error on %s (%i) %s\n", t530_tag(), info, result, curl_multi_strerror(result)); } return result; @@ -365,7 +365,7 @@ static CURLcode testone(const char *URL, int timer_fail_at, int socket_fail_at) if(timeout.tv_sec != (time_t)-1 && t530_getMicroSecondTimeout(&timeout) == 0) { - /* Curl's timer has elapsed. */ + /* curl's timer has elapsed. */ if(socket_action(multi, CURL_SOCKET_TIMEOUT, 0, "timeout")) { res = TEST_ERR_BAD_TIMEOUT; goto test_cleanup; diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c index 05d50cba7f..02d4a89b26 100644 --- a/tests/libtest/lib537.c +++ b/tests/libtest/lib537.c @@ -143,7 +143,7 @@ static int t537_test_rlimit(int keep_open) curl_mfprintf(stderr, "raising soft limit up to OPEN_MAX\n"); rl.rlim_cur = OPEN_MAX; if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { - /* on failure don't abort just issue a warning */ + /* on failure do not abort just issue a warning */ t537_store_errmsg("setrlimit() failed", errno); curl_mfprintf(stderr, "%s\n", t537_msgbuff); t537_msgbuff[0] = '\0'; @@ -154,7 +154,7 @@ static int t537_test_rlimit(int keep_open) curl_mfprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { - /* on failure don't abort just issue a warning */ + /* on failure do not abort just issue a warning */ t537_store_errmsg("setrlimit() failed", errno); curl_mfprintf(stderr, "%s\n", t537_msgbuff); t537_msgbuff[0] = '\0'; @@ -182,7 +182,7 @@ static int t537_test_rlimit(int keep_open) * test 537 is all about testing libcurl functionality * when the system has nearly exhausted the number of * available file descriptors. Test 537 will try to run - * with a very small number of file descriptors available. + * with a small number of file descriptors available. * This implies that any file descriptor which is open * when the test runs will have a number in the high range * of whatever the system supports. @@ -243,7 +243,7 @@ static int t537_test_rlimit(int keep_open) t537_num_open.rlim_max = nitems; } - /* verify that we won't overflow size_t in malloc() */ + /* verify that we do not overflow size_t in malloc() */ if((size_t)(t537_num_open.rlim_max) > ((size_t)-1) / sizeof(*t537_testfd)) { tutil_rlim2str(strbuff1, sizeof(strbuff1), t537_num_open.rlim_max); @@ -343,7 +343,7 @@ static int t537_test_rlimit(int keep_open) curl_mfprintf(stderr, "shrinking array for %s file descriptors\n", strbuff); - /* we don't care if we can't shrink it */ + /* we do not care if we cannot shrink it */ tmpfd = realloc(t537_testfd, sizeof(*t537_testfd) * (size_t)(t537_num_open.rlim_max)); diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c index 9eb7e407c0..55d5adad07 100644 --- a/tests/libtest/lib540.c +++ b/tests/libtest/lib540.c @@ -27,7 +27,7 @@ * argv1 = URL * argv2 = proxy * argv3 = proxyuser:password - * argv4 = host name to use for the custom Host: header + * argv4 = hostname to use for the custom Host: header */ #include "first.h" diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c index dfe585d9da..ebab472456 100644 --- a/tests/libtest/lib541.c +++ b/tests/libtest/lib541.c @@ -52,14 +52,9 @@ static CURLcode test_lib541(const char *URL) } /* get the file size of the local file */ -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - hd = stat(libtest_arg2, &file_info); -#else hd = fstat(fileno(hd_src), &file_info); -#endif if(hd == -1) { - /* can't open file, bail out */ + /* cannot open file, bail out */ curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n", errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2); @@ -100,7 +95,7 @@ static CURLcode test_lib541(const char *URL) /* now specify which file to upload */ test_setopt(curl, CURLOPT_READDATA, hd_src); - /* Now run off and do what you've been told! */ + /* Now run off and do what you have been told! */ res = curl_easy_perform(curl); if(res) goto test_cleanup; diff --git a/tests/libtest/lib542.c b/tests/libtest/lib542.c index e6e73131fd..b29a2733ff 100644 --- a/tests/libtest/lib542.c +++ b/tests/libtest/lib542.c @@ -59,7 +59,7 @@ static CURLcode test_lib542(const char *URL) /* specify target */ test_setopt(curl, CURLOPT_URL, URL); - /* Now run off and do what you've been told! */ + /* Now run off and do what you have been told! */ res = curl_easy_perform(curl); test_cleanup: diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index 23cb5a7046..230da065a1 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -90,7 +90,7 @@ static CURLcode t554_test_once(const char *URL, bool oldstyle) CURLFORM_COPYNAME, "sendfile alternative", CURLFORM_STREAM, &pooh, CURLFORM_CONTENTLEN, (curl_off_t)pooh.sizeleft, - CURLFORM_FILENAME, "file name 2", + CURLFORM_FILENAME, "filename 2 ", CURLFORM_END); } diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c index 78b89975e8..daf92fe1e6 100644 --- a/tests/libtest/lib556.c +++ b/tests/libtest/lib556.c @@ -80,11 +80,7 @@ again: if(nread) { /* send received stuff to stdout */ -#ifdef UNDER_CE - if((size_t)fwrite(buf, sizeof(buf[0]), nread, stdout) != nread) { -#else if((size_t)write(STDOUT_FILENO, buf, nread) != nread) { -#endif char errbuf[STRERROR_LEN]; curl_mfprintf(stderr, "write() failed: errno %d (%s)\n", errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c index ba796f1ceb..42602eeeeb 100644 --- a/tests/libtest/lib557.c +++ b/tests/libtest/lib557.c @@ -1413,7 +1413,7 @@ static int test_float_formatting(void) curl_msnprintf(buf, sizeof(buf), "%.*f", 0, 9.2987654); errors += string_check(buf, "9"); - /* very large precisions easily turn into system specific outputs so we only + /* large precisions easily turn into system specific outputs so we only check the output buffer length here as we know the internal limit */ curl_msnprintf(buf, sizeof(buf), "%.*f", (1 << 30), 9.2987654); diff --git a/tests/libtest/lib562.c b/tests/libtest/lib562.c index e9716e5768..3f2c912c91 100644 --- a/tests/libtest/lib562.c +++ b/tests/libtest/lib562.c @@ -64,7 +64,7 @@ static CURLcode test_lib562(const char *URL) /* specify target */ test_setopt(curl, CURLOPT_URL, URL); - /* Now run off and do what you've been told! */ + /* Now run off and do what you have been told! */ res = curl_easy_perform(curl); test_cleanup: diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c index 6e53b79989..5465ca0c8b 100644 --- a/tests/libtest/lib568.c +++ b/tests/libtest/lib568.c @@ -68,7 +68,7 @@ static CURLcode test_lib568(const char *URL) sdp = curlx_open(libtest_arg2, O_RDONLY); if(sdp == -1) { - curl_mfprintf(stderr, "can't open %s\n", libtest_arg2); + curl_mfprintf(stderr, "cannot open %s\n", libtest_arg2); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -77,7 +77,7 @@ static CURLcode test_lib568(const char *URL) sdpf = curlx_fopen(libtest_arg2, "rb"); if(!sdpf) { - curl_mfprintf(stderr, "can't fopen %s\n", libtest_arg2); + curl_mfprintf(stderr, "cannot fopen %s\n", libtest_arg2); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c index b1a80a7b01..1c44153d00 100644 --- a/tests/libtest/lib569.c +++ b/tests/libtest/lib569.c @@ -40,7 +40,7 @@ static CURLcode test_lib569(const char *URL) FILE *idfile = curlx_fopen(libtest_arg2, "wb"); if(!idfile) { - curl_mfprintf(stderr, "couldn't open the Session ID File\n"); + curl_mfprintf(stderr, "Could not open the Session ID File\n"); return TEST_ERR_MAJOR_BAD; } diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c index 49afc2211d..509557f0f5 100644 --- a/tests/libtest/lib571.c +++ b/tests/libtest/lib571.c @@ -97,7 +97,7 @@ static CURLcode test_lib571(const char *URL) FILE *protofile = curlx_fopen(libtest_arg2, "wb"); if(!protofile) { - curl_mfprintf(stderr, "Couldn't open the protocol dump file\n"); + curl_mfprintf(stderr, "Could not open the protocol dump file\n"); return TEST_ERR_MAJOR_BAD; } diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c index c3951f8d1d..2865372f5f 100644 --- a/tests/libtest/lib572.c +++ b/tests/libtest/lib572.c @@ -86,7 +86,7 @@ static CURLcode test_lib572(const char *URL) /* PUT style GET_PARAMETERS */ params = curlx_open(libtest_arg2, O_RDONLY); if(params == -1) { - curl_mfprintf(stderr, "can't open %s\n", libtest_arg2); + curl_mfprintf(stderr, "cannot open %s\n", libtest_arg2); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -95,7 +95,7 @@ static CURLcode test_lib572(const char *URL) paramsf = curlx_fopen(libtest_arg2, "rb"); if(!paramsf) { - curl_mfprintf(stderr, "can't fopen %s\n", libtest_arg2); + curl_mfprintf(stderr, "cannot fopen %s\n", libtest_arg2); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c index 29396941cc..9e626c1300 100644 --- a/tests/libtest/lib579.c +++ b/tests/libtest/lib579.c @@ -41,7 +41,7 @@ static void progress_final_report(void) if(moo) curlx_fclose(moo); else - curl_mfprintf(stderr, "Progress: end UL, can't open %s\n", libtest_arg2); + curl_mfprintf(stderr, "Progress: end UL, cannot open %s\n", libtest_arg2); started = FALSE; } @@ -65,7 +65,7 @@ static int t579_progress_callback(void *clientp, double dltotal, double dlnow, if(moo) curlx_fclose(moo); else - curl_mfprintf(stderr, "Progress: start UL, can't open %s\n", + curl_mfprintf(stderr, "Progress: start UL, cannot open %s\n", libtest_arg2); started = TRUE; } diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c index e013daedff..4318096e1f 100644 --- a/tests/libtest/lib582.c +++ b/tests/libtest/lib582.c @@ -78,7 +78,7 @@ static void t582_addFd(struct t582_Sockets *sockets, curl_socket_t fd, sockets->max_count = 20; } else if(sockets->count >= sockets->max_count) { - /* this can't happen in normal cases */ + /* this cannot happen in normal cases */ curl_mfprintf(stderr, "too many file handles error\n"); exit(2); } @@ -203,7 +203,7 @@ static void notifyCurl(CURLM *multi, curl_socket_t s, int evBitmask, CURLMcode result = curl_multi_socket_action(multi, s, evBitmask, &numhandles); if(result != CURLM_OK) { - curl_mfprintf(stderr, "Curl error on %s (%i) %s\n", + curl_mfprintf(stderr, "curl error on %s (%i) %s\n", info, result, curl_multi_strerror(result)); } } @@ -254,14 +254,9 @@ static CURLcode test_lib582(const char *URL) } /* get the file size of the local file */ -#ifdef UNDER_CE - /* !checksrc! disable BANNEDFUNC 1 */ - hd = stat(libtest_arg2, &file_info); -#else hd = fstat(fileno(hd_src), &file_info); -#endif if(hd == -1) { - /* can't open file, bail out */ + /* cannot open file, bail out */ curl_mfprintf(stderr, "fstat() failed with error (%d) %s\n", errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); curl_mfprintf(stderr, "Error opening file '%s'\n", libtest_arg2); @@ -339,7 +334,7 @@ static CURLcode test_lib582(const char *URL) if(timeout.tv_sec != (time_t)-1 && t582_getMicroSecondTimeout(&timeout) == 0) { - /* Curl's timer has elapsed. */ + /* curl's timer has elapsed. */ notifyCurl(multi, CURL_SOCKET_TIMEOUT, 0, "timeout"); } diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index 5ee1582a8e..dac6751b35 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -119,7 +119,7 @@ static void *t586_test_fire(void *ptr) code = curl_easy_perform(curl); if(code != CURLE_OK) { int i = 0; - curl_mfprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", + curl_mfprintf(stderr, "perform URL '%s' repeat %d failed, curlcode %d\n", tdata->url, i, code); } diff --git a/tests/libtest/lib643.c b/tests/libtest/lib643.c index a0fef02dda..d74d7ea9ee 100644 --- a/tests/libtest/lib643.c +++ b/tests/libtest/lib643.c @@ -114,7 +114,7 @@ static CURLcode t643_test_once(const char *URL, bool oldstyle) res = curl_mime_data_cb(part, datasize, t643_read_cb, NULL, NULL, &pooh); if(!res) - res = curl_mime_filename(part, "file name 2"); + res = curl_mime_filename(part, "filename 2 "); } if(res) diff --git a/tests/libtest/lib659.c b/tests/libtest/lib659.c index 44fe7b0c49..84c3ecc8cd 100644 --- a/tests/libtest/lib659.c +++ b/tests/libtest/lib659.c @@ -45,7 +45,7 @@ static CURLcode test_lib659(const char *URL) goto test_cleanup; } - /* this doesn't set the PATH part */ + /* this does not set the PATH part */ if(curl_url_set(urlp, CURLUPART_HOST, "www.example.com", 0) || curl_url_set(urlp, CURLUPART_SCHEME, "http", 0) || curl_url_set(urlp, CURLUPART_PORT, "80", 0)) { diff --git a/tests/libtest/lib694.c b/tests/libtest/lib694.c index eb760fbee2..5b477ecebd 100644 --- a/tests/libtest/lib694.c +++ b/tests/libtest/lib694.c @@ -64,7 +64,7 @@ static CURLcode test_lib694(const char *URL) curl_mprintf("CURLINFO_HTTPAUTH_USED did not say NTLM\n"); } - /* set a new URL for the second, so that we don't restart NTLM */ + /* set a new URL for the second, so that we do not restart NTLM */ test_setopt(curl, CURLOPT_URL, libtest_arg2); } while(!res && ++count < 2); diff --git a/tests/libtest/lib758.c b/tests/libtest/lib758.c index 35e60cc04f..ab6ce481b7 100644 --- a/tests/libtest/lib758.c +++ b/tests/libtest/lib758.c @@ -303,7 +303,7 @@ static CURLMcode t758_saction(CURLM *multi, curl_socket_t s, CURLMcode result = curl_multi_socket_action(multi, s, evBitmask, &numhandles); if(result != CURLM_OK) { - curl_mfprintf(stderr, "%s Curl error on %s (%i) %s\n", + curl_mfprintf(stderr, "%s curl error on %s (%i) %s\n", t758_tag(), info, result, curl_multi_strerror(result)); } return result; @@ -457,7 +457,7 @@ static CURLcode t758_one(const char *URL, int timer_fail_at, if(timeout.tv_sec != (time_t)-1 && t758_getMicroSecondTimeout(&timeout) == 0) { - /* Curl's timer has elapsed. */ + /* curl's timer has elapsed. */ if(t758_saction(multi, CURL_SOCKET_TIMEOUT, 0, "timeout")) { res = TEST_ERR_BAD_TIMEOUT; goto test_cleanup; diff --git a/tests/libtest/mk-lib1521.pl b/tests/libtest/mk-lib1521.pl index 95a600c3d0..156422eccc 100755 --- a/tests/libtest/mk-lib1521.pl +++ b/tests/libtest/mk-lib1521.pl @@ -174,7 +174,7 @@ MOO ; if(!$ARGV[0]) { - die "missing target file name"; + die "missing target filename"; } use File::Temp qw/ :mktemp /; diff --git a/tests/libtest/test1013.pl b/tests/libtest/test1013.pl index b97341d0cb..98ea642044 100755 --- a/tests/libtest/test1013.pl +++ b/tests/libtest/test1013.pl @@ -36,7 +36,7 @@ my $what=$ARGV[2]; # Read the output of curl --version my $curl_protocols=""; -open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n"; +open(CURL, "$ARGV[1]") || die "Cannot get curl $what list\n"; while() { $curl_protocols = $_ if(/$what:/i); } @@ -48,7 +48,7 @@ my @curl = split / /,$1; # Read the output of curl-config my @curl_config; -open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n"; +open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Cannot get curl-config $what list\n"; while() { chomp; $_ = lc($_) if($what eq "protocols"); # accept uppercase protocols in curl-config diff --git a/tests/libtest/test1022.pl b/tests/libtest/test1022.pl index e1c3cd598e..7309372d22 100755 --- a/tests/libtest/test1022.pl +++ b/tests/libtest/test1022.pl @@ -34,7 +34,7 @@ if($#ARGV != 2) { my $what=$ARGV[2]; # Read the output of curl --version -open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n"; +open(CURL, "$ARGV[1]") || die "Cannot open curl --version list in $ARGV[1]\n"; $_ = ; chomp; /libcurl\/([\.\d]+((-DEV)|(-rc\d)|(-\d+))?)/; @@ -44,7 +44,7 @@ close CURL; my $curlconfigversion; # Read the output of curl-config --version/--vernum -open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n"; +open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Cannot get curl-config --$what list\n"; $_ = ; chomp; my $filever=$_; @@ -65,7 +65,7 @@ else { # "vernum" case $curlconfigversion = "illegal value"; } - # Strip off the -DEV and -rc suffixes from the curl version if they're there + # Strip off the -DEV and -rc suffixes from the curl version if they are there $version =~ s/-\w*$//; } close CURLCONFIG; diff --git a/tests/libtest/test307.pl b/tests/libtest/test307.pl index 5a0a97a3a6..bef5ebae14 100755 --- a/tests/libtest/test307.pl +++ b/tests/libtest/test307.pl @@ -31,7 +31,7 @@ if($#ARGV != 0) { exit 3; } if(!open(CURL, "$ARGV[0] -s --engine list|")) { - print "Can't get SSL engine list\n"; + print "Cannot get SSL engine list\n"; exit 2; } while() { diff --git a/tests/libtest/test613.pl b/tests/libtest/test613.pl index d45e2e4e96..88c0e49682 100755 --- a/tests/libtest/test613.pl +++ b/tests/libtest/test613.pl @@ -29,7 +29,7 @@ use warnings; use Time::Local; if($#ARGV < 1) { - print "Usage: $0 prepare|postprocess dir [logfile]\n"; + print "Usage: $0 prepare|postprocess directory [logfile]\n"; exit 1; } diff --git a/tests/libtest/testtrace.c b/tests/libtest/testtrace.c index 092aca8385..7c45173787 100644 --- a/tests/libtest/testtrace.c +++ b/tests/libtest/testtrace.c @@ -69,7 +69,7 @@ void debug_dump(const char *timebuf, const char *text, curl_mfprintf(stream, "%c", ((ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80)) ? ptr[i + c] : '.'); - /* check again for 0D0A, to avoid an extra \n if it's at width */ + /* check again for 0D0A, to avoid an extra \n if it is at width */ if(nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && ptr[i + c + 2] == 0x0A) { i += (c + 3 - width); @@ -105,7 +105,7 @@ int libtest_debug_cb(CURL *curl, curl_infotype type, } secs = epoch_offset + tv.tv_sec; /* !checksrc! disable BANNEDFUNC 1 */ - now = localtime(&secs); /* not thread safe but we don't care */ + now = localtime(&secs); /* not thread safe but we do not care */ curl_msnprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ", now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec); } diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c index 269479c3ce..b5cfa70369 100644 --- a/tests/libtest/testutil.c +++ b/tests/libtest/testutil.c @@ -25,7 +25,7 @@ #include "memdebug.h" -/* build request url */ +/* build request URL */ char *tutil_suburl(const char *base, int i) { return curl_maprintf("%s%.4d", base, i); diff --git a/tests/libtest/testutil.h b/tests/libtest/testutil.h index 7c98e0aade..3dcd7e3417 100644 --- a/tests/libtest/testutil.h +++ b/tests/libtest/testutil.h @@ -25,7 +25,7 @@ ***************************************************************************/ #include "first.h" -/* build request url */ +/* build request URL */ char *tutil_suburl(const char *base, int i); #ifdef HAVE_SYS_RESOURCE_H diff --git a/tests/memanalyze.pl b/tests/memanalyze.pl index f0ebd7fbaf..e35b2e7aba 100755 --- a/tests/memanalyze.pl +++ b/tests/memanalyze.pl @@ -420,7 +420,7 @@ if($totalmem) { $addr = $_; $size = $sizeataddr{$addr}; if($size > 0) { - print "At $addr, there's $size bytes.\n"; + print "At $addr, there is $size bytes.\n"; print " allocated by ".$getmem{$addr}."\n"; } } diff --git a/tests/negtelnetserver.py b/tests/negtelnetserver.py index e043d538e5..61bc1d0359 100755 --- a/tests/negtelnetserver.py +++ b/tests/negtelnetserver.py @@ -135,7 +135,7 @@ class Negotiator(object): """ buffer = bytearray() - # If we keep receiving negotiation sequences, we won't fill the buffer. + # If we keep receiving negotiation sequences, we will not fill the buffer. # Keep looping while we can, and until we have something to give back # to the caller. while len(buffer) == 0: @@ -190,8 +190,8 @@ class Negotiator(object): log.debug("Client can do") self.state = self.DO elif byte_int == NegTokens.DONT: - # Client is indicating they can't do an option - log.debug("Client can't do") + # Client is indicating they cannot do an option + log.debug("Client cannot do") self.state = self.DONT else: # Received an unexpected byte. Stop negotiations @@ -296,9 +296,9 @@ def get_options(): parser.add_argument("--verbose", action="store", type=int, default=0, help="verbose output") parser.add_argument("--pidfile", action="store", - help="file name for the PID") + help="filename for the PID") parser.add_argument("--logfile", action="store", - help="file name for the log") + help="filename for the log") parser.add_argument("--srcdir", action="store", help="test directory") parser.add_argument("--id", action="store", help="server ID") parser.add_argument("--ipv4", action="store_true", default=0, diff --git a/tests/pathhelp.pm b/tests/pathhelp.pm index 49987f7453..92871617b3 100644 --- a/tests/pathhelp.pm +++ b/tests/pathhelp.pm @@ -36,7 +36,7 @@ # Forward slashes are simpler processed in Perl, do not require extra escaping # for shell (unlike back slashes) and accepted by Windows native programs, so # all functions return paths with only forward slashes. -# All returned paths don't contain any duplicated slashes, only single slashes +# All returned paths do not contain any duplicated slashes, only single slashes # are used as directory separators on output. # On non-Windows platforms functions acts as transparent wrappers for similar # Perl's functions or return unmodified string (depending on functionality), @@ -195,7 +195,7 @@ sub dirsepadd { ####################################################################### # Quote an argument for passing safely to a Bourne shell -# This does the same thing as String::ShellQuote but doesn't need a package. +# This does the same thing as String::ShellQuote but does not need a package. # sub shell_quote { my ($s)=@_; diff --git a/tests/rtspserver.pl b/tests/rtspserver.pl index d2e1339073..d23ed7e637 100755 --- a/tests/rtspserver.pl +++ b/tests/rtspserver.pl @@ -104,7 +104,7 @@ while(@ARGV) { $verbose = 1; } else { - print STDERR "\nWarning: rtspserver.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: rtspserver.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } diff --git a/tests/runner.pm b/tests/runner.pm index fe43ed05ba..6113c18745 100644 --- a/tests/runner.pm +++ b/tests/runner.pm @@ -190,7 +190,7 @@ sub runner_init { $SIG{INT} = 'IGNORE'; $SIG{TERM} = 'IGNORE'; eval { - # some msys2 perl versions don't define SIGUSR1, also missing from Win32 Perl + # some MSYS2 Perl versions do not define SIGUSR1, also missing from Win32 Perl $SIG{USR1} = 'IGNORE'; }; @@ -214,7 +214,7 @@ sub runner_init { # handle IPC calls event_loop(); - # Can't rely on logmsg here in case it's buffered + # Cannot rely on logmsg here in case it is buffered print "Runner $thisrunnerid exiting\n" if($verbose); # To reach this point, either the controller has sent @@ -234,7 +234,7 @@ sub runner_init { # Create our pid directory mkdir("$LOGDIR/$PIDDIR", 0777); - # Don't create a separate process + # Do not create a separate process $thisrunnerid = "integrated"; } @@ -522,7 +522,7 @@ sub torture { delete $ENV{'CURL_MEMLIMIT'} if($ENV{'CURL_MEMLIMIT'}); if(-r "core") { - # there's core file present now! + # there is core file present now! logmsg " core dumped\n"; $dumped_core = 1; $fail = 2; @@ -542,8 +542,8 @@ sub torture { } } - # verify that it returns a proper error code, doesn't leak memory - # and doesn't core dump + # verify that it returns a proper error code, does not leak memory + # and does not core dump if(($ret & 255) || ($ret >> 8) >= 128) { logmsg " system() returned $ret\n"; $fail=1; @@ -885,7 +885,7 @@ sub singletest_run { chomp $dis[0] if($dis[0]); if($dis[0] eq "test-duphandle") { # marked to not run with duphandle - logmsg " $testnum: IGNORED: Can't run test-duphandle\n"; + logmsg " $testnum: IGNORED: Cannot run test-duphandle\n"; return (-1, 0, 0, "", "", 0); } } @@ -1059,7 +1059,7 @@ sub singletest_clean { if(!$dumped_core) { if(-r "core") { - # there's core file present now! + # there is core file present now! $dumped_core = 1; } } @@ -1144,7 +1144,7 @@ sub singletest_postcheck { logmsg "postcheck $cmd\n" if($verbose); my $rc = runclient("$cmd"); # Must run the postcheck command in torture mode in order - # to clean up, but the result can't be relied upon. + # to clean up, but the result cannot be relied upon. if($rc != 0 && !$torture) { logmsg " $testnum: postcheck FAILED\n"; return -1; @@ -1317,7 +1317,7 @@ sub controlleripccall { # Get the name of the function from the reference my $cv = svref_2object($funcref); my $gv = $cv->GV; - # Prepend the name to the function arguments so it's marshalled along with them + # Prepend the name to the function arguments so it is marshalled along with them unshift @_, $gv->NAME; # Marshall the arguments into a flat string my $margs = freeze \@_; @@ -1368,7 +1368,7 @@ sub runnerar { my $resarrayref = thaw $buf; # First argument is runner ID - # TODO: remove this; it's unneeded since it's passed in + # TODO: remove this; it is unneeded since it is passed in unshift @$resarrayref, $runnerid; return @$resarrayref; } @@ -1376,7 +1376,7 @@ sub runnerar { ################################################################### # Returns runner ID if a response from an async call is ready or error # First value is ready, second is error, however an error case shows up -# as ready in Linux, so you can't trust it. +# as ready in Linux, so you cannot trust it. # argument is 0 for nonblocking, undef for blocking, anything else for timeout # Called by controller sub runnerar_ready { @@ -1402,7 +1402,7 @@ sub runnerar_ready { my $e_in = $r_in; if(select(my $r_out=$r_in, undef, my $e_out=$e_in, $blocking) >= 1) { for my $fd (0..$maxfileno) { - # Return an error condition first in case it's both + # Return an error condition first in case it is both if(vec($e_out, $fd, 1)) { return (undef, $idbyfileno{$fd}); } diff --git a/tests/runtests.pl b/tests/runtests.pl index 226573941d..192c92a641 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -54,7 +54,7 @@ # to check the remote system's PATH, and the places in the code where # the curl binary is read directly to determine its type also need to be # fixed. As long as the -g option is never given, and the -n is always -# given, this won't be a problem. +# given, this will not be a problem. use strict; use warnings; @@ -233,7 +233,7 @@ sub singletest_logmsg { } ####################################################################### -# Stop buffering log messages, but don't touch them +# Stop buffering log messages, but do not touch them sub singletest_unbufferlogs { undef $singletest_bufferedrunner; } @@ -276,7 +276,7 @@ sub catch_usr1 { } eval { - # some msys2 perl versions don't define SIGUSR1 + # some msys2 perl versions do not define SIGUSR1 $SIG{USR1} = \&catch_usr1; }; $SIG{PIPE} = 'IGNORE'; # these errors are captured in the read/write calls @@ -293,7 +293,7 @@ foreach my $protocol (('ftp', 'http', 'ftps', 'https', 'no', 'all')) { delete $ENV{uc($proxy)} if($ENV{uc($proxy)}); } -# make sure we don't get affected by other variables that control our +# make sure we do not get affected by other variables that control our # behavior delete $ENV{'SSL_CERT_DIR'} if($ENV{'SSL_CERT_DIR'}); @@ -331,7 +331,7 @@ if($ENV{"NGHTTPX"}) { my $disttests = ""; sub get_disttests { # If a non-default $TESTDIR is being used there may not be any - # Makefile.am in which case there's nothing to do. + # Makefile.am in which case there is nothing to do. open(my $dh, "<", "$TESTDIR/Makefile.am") or return; while(<$dh>) { chomp $_; @@ -354,9 +354,9 @@ sub cleardir { # Get all files opendir(my $dh, $dir) || - return 0; # can't open dir + return 0; # cannot open dir while($file = readdir($dh)) { - # Don't clear the $PIDDIR or $LOCKDIR since those need to live beyond + # Do not clear the $PIDDIR or $LOCKDIR since those need to live beyond # one test if(($file !~ /^(\.|\.\.)\z/) && "$file" ne $PIDDIR && "$file" ne $LOCKDIR) { @@ -469,7 +469,7 @@ sub parseprotocols { # Generate a "proto-ipv6" version of each protocol to match the # IPv6 name and a "proto-unix" to match the variant which - # uses Unix domain sockets. This works even if support isn't + # uses Unix domain sockets. This works even if support is not # compiled in because the test will fail. push @protocols, map(("$_-ipv6", "$_-unix"), @protocols); @@ -632,11 +632,20 @@ sub checksystemfeatures { } if($libcurl =~ /libssh\/([0-9.]*)\//i) { $feature{"libssh"} = 1; - if($1 =~ /(\d+)\.(\d+).(\d+)/) { - my $v = $1 * 100 + $2 * 10 + $3; - if($v < 94) { - # before 0.9.4 - $feature{"oldlibssh"} = 1; + # Detect simple cases of default libssh configuration files ending up + # setting `StrictHostKeyChecking no`. include files, quoted values, + # '=value' format not implemented. + $feature{"badlibssh"} = 0; + foreach my $libssh_configfile (('/etc/ssh/ssh_config', $ENV{'HOME'} . '/.ssh/config')) { + if(open(my $fd, '<', $libssh_configfile)) { + while(my $line = <$fd>) { + chomp $line; + if($line =~ /^\s*StrictHostKeyChecking\s+(yes|no)\s*$/) { + $feature{"badlibssh"} = ($1 eq 'no' ? 1 : 0); + last; # Do as openssh and libssh + } + } + close($fd); } } } @@ -767,7 +776,7 @@ sub checksystemfeatures { displaylogcontent("$curlverout"); logmsg "contents of $curlvererr: \n"; displaylogcontent("$curlvererr"); - die "couldn't get curl's version"; + die "Could not get curl's version"; } if(-r "../lib/curl_config.h") { @@ -839,12 +848,12 @@ sub checksystemfeatures { if($torture) { if(!$feature{"TrackMemory"}) { - die "can't run torture tests since curl was built without ". + die "cannot run torture tests since curl was built without ". "TrackMemory feature (--enable-curldebug)"; } if($feature{"threaded-resolver"} && !$valgrind) { - die "can't run torture tests since curl was built with the ". - "threaded resolver, and we aren't running with valgrind"; + die "cannot run torture tests since curl was built with the ". + "threaded resolver, and we are not running with valgrind"; } } @@ -961,7 +970,7 @@ sub citest_starttestrun { $AZURE_RUN_ID = azure_create_test_run($ACURL); logmsg "Azure Run ID: $AZURE_RUN_ID\n" if($verbose); } - # Appveyor doesn't require anything here + # Appveyor does not require anything here } @@ -1001,7 +1010,7 @@ sub citest_finishtestrun { if(azure_check_environment() && $AZURE_RUN_ID) { $AZURE_RUN_ID = azure_update_test_run($ACURL, $AZURE_RUN_ID); } - # Appveyor doesn't require anything here + # Appveyor does not require anything here } @@ -1058,7 +1067,7 @@ sub getrunnerlogdir { # Verify that this test case should be run sub singletest_shouldrun { my $testnum = $_[0]; - my $why; # why the test won't be run + my $why; # why the test will not be run my $errorreturncode = 1; # 1 means normal error, 2 means ignored error my @what; # what features are needed @@ -1081,7 +1090,7 @@ sub singletest_shouldrun { if(loadtest("${TESTDIR}/test${testnum}", 1)) { if($verbose) { # this is not a test - logmsg "RUN: $testnum doesn't look like a test case\n"; + logmsg "RUN: $testnum does not look like a test case\n"; } $why = "no test"; } @@ -1205,7 +1214,7 @@ sub singletest_count { my ($testnum, $why) = @_; if($why && !$listonly) { - # there's a problem, count it as "skipped" + # there is a problem, count it as "skipped" $skipped{$why}++; $teststat[$testnum]=$why; # store reason for this test case @@ -1220,7 +1229,7 @@ sub singletest_count { return -1; } - # At this point we've committed to run this test + # At this point we have committed to run this test logmsg sprintf("test %04d...", $testnum) if(!$automakestyle); # name of the test @@ -1394,7 +1403,7 @@ sub singletest_check { # Verify the sent request my @out = loadarray("$logdir/$SERVERIN"); - # check if there's any attributes on the verify/protocol section + # check if there is any attributes on the verify/protocol section my %hash = getpartattr("verify", "protocol"); if($hash{'nonewline'}) { @@ -1564,7 +1573,7 @@ sub singletest_check { my @proxyprot = getpart("verify", "proxy"); if(@proxyprot) { # Verify the sent proxy request - # check if there's any attributes on the verify/protocol section + # check if there is any attributes on the verify/protocol section my %hash = getpartattr("verify", "proxy"); if($hash{'nonewline'}) { @@ -1613,7 +1622,7 @@ sub singletest_check { for my $partsuffix (('', '1', '2', '3', '4')) { my @outfile=getpart("verify", "file".$partsuffix); if(@outfile || partexists("verify", "file".$partsuffix) ) { - # we're supposed to verify a dynamically generated file! + # we are supposed to verify a dynamically generated file! my %hash = getpartattr("verify", "file".$partsuffix); my $filename=$hash{'name'}; @@ -1704,7 +1713,7 @@ sub singletest_check { my @dnsd = getpart("verify", "dns"); if(@dnsd) { - # we're supposed to verify a dynamically generated file! + # we are supposed to verify a dynamically generated file! my %hash = getpartattr("verify", "dns"); my $hostname=$hash{'host'}; @@ -1973,7 +1982,7 @@ sub singletest { ################################################################### # Restore environment variables that were modified in a previous run. # Test definition may instruct to (un)set environment vars. - # This is done this early so that leftover variables don't affect + # This is done this early so that leftover variables do not affect # starting servers or CI registration. # restore_test_env(1); @@ -2341,8 +2350,8 @@ while(@ARGV) { # use this path to a curl used to verify servers # Particularly useful when you introduce a crashing bug somewhere in - # the development version as then it won't be able to run any tests - # since it can't verify the servers! + # the development version as then it will not be able to run any tests + # since it cannot verify the servers! $VCURL=shell_quote($ARGV[1]); shift @ARGV; @@ -2372,7 +2381,7 @@ while(@ARGV) { # load additional reasons to skip tests shift @ARGV; my $exclude_file = $ARGV[0]; - open(my $fd, "<", $exclude_file) or die "Couldn't open '$exclude_file': $!"; + open(my $fd, "<", $exclude_file) or die "Could not open '$exclude_file': $!"; while(my $line = <$fd>) { next if($line =~ /^#/); chomp $line; @@ -2656,7 +2665,7 @@ if($valgrind) { # since valgrind 2.1.x, '--tool' option is mandatory # use it, if it is supported by the version installed on the system - # (this happened in 2003, so we could probably don't need to care about + # (this happened in 2003, so we could probably do not need to care about # that old version any longer and just delete this check) runclient("valgrind --help 2>&1 | grep -- --tool >$dev_null 2>&1"); if(($? >> 8)) { @@ -2671,7 +2680,7 @@ if($valgrind) { close($curlh); # valgrind 3 renamed the --logfile option to --log-file!!! - # (this happened in 2005, so we could probably don't need to care about + # (this happened in 2005, so we could probably do not need to care about # that old version any longer and just delete this check) my $ver=join(' ', runclientoutput("valgrind --version")); # cut off all but digits and dots @@ -2703,7 +2712,7 @@ if($gdbthis) { # clear and create logging directory: # -# TODO: figure how to get around this. This dir is needed for checksystemfeatures() +# TODO: figure how to get around this. This directory is needed for checksystemfeatures() # Maybe create & use & delete a temporary directory in that function cleardir($LOGDIR); mkdir($LOGDIR, 0777); @@ -2806,7 +2815,7 @@ sub disabledtests { if($TESTCASES eq "all") { # Get all commands and find out their test numbers - opendir(DIR, $TESTDIR) || die "can't opendir $TESTDIR: $!"; + opendir(DIR, $TESTDIR) || die "cannot opendir $TESTDIR: $!"; my @cmds = grep { /^test([0-9]+)$/ && -f "$TESTDIR/$_" } readdir(DIR); closedir(DIR); @@ -2910,11 +2919,11 @@ sub displaylogs { my ($runnerid, $testnum)=@_; my $logdir = getrunnerlogdir($runnerid); opendir(DIR, "$logdir") || - die "can't open dir: $!"; + die "cannot open dir: $!"; my @logs = readdir(DIR); closedir(DIR); - logmsg "== Contents of files in the $logdir/ dir after test $testnum\n"; + logmsg "== Contents of files in the $logdir/ directory after test $testnum\n"; foreach my $log (sort @logs) { if($log =~ /\.(\.|)$/) { next; # skip "." and ".." @@ -2956,7 +2965,7 @@ sub displaylogs { next; # skip valgrindNnn of other tests } if(($log =~ /^test$testnum$/)) { - next; # skip test$testnum since it can be very big + next; # skip test$testnum since it can be big } logmsg "=== Start of file $log\n"; displaylogcontent("$logdir/$log"); @@ -3079,7 +3088,7 @@ while() { } } - # See if we've completed all the tests + # See if we have completed all the tests if(!scalar(%runnersrunning)) { # No runners are running; we must be done scalar(@runtests) && die 'Internal error: still have tests to run'; @@ -3087,7 +3096,7 @@ while() { } # See if a test runner needs attention - # If we could be running more tests, don't wait so we can schedule a new + # If we could be running more tests, do not wait so we can schedule a new # one immediately. If all runners are busy, wait a fraction of a second # for one to finish so we can still loop around to check the abort flag. my $runnerwait = scalar(@runnersidle) && scalar(@runtests) ? 0.1 : 1.0; @@ -3122,7 +3131,7 @@ while() { next; } - $total++; # number of tests we've run + $total++; # number of tests we have run $executed++; if($error>0) { @@ -3191,9 +3200,9 @@ while() { $endwaitcnt += $runnerwait; if($endwaitcnt >= 10) { # Once all tests have been scheduled on a runner at the end of a test - # run, we just wait for their results to come in. If we're still + # run, we just wait for their results to come in. If we are still # waiting after a couple of minutes ($endwaitcnt multiplied by - # $runnerwait, plus $jobs because that number won't time out), display + # $runnerwait, plus $jobs because that number will not time out), display # the same test runner status as we give with a SIGUSR1. This will # likely point to a single test that has hung. logmsg "Hmmm, the tests are taking a while to finish. Here is the status:\n"; @@ -3222,9 +3231,9 @@ foreach my $runnerid (values %runnerids) { } # Kill the runners -# There is a race condition here since we don't know exactly when the runners -# have each finished shutting themselves down, but we're about to exit so it -# doesn't make much difference. +# There is a race condition here since we do not know exactly when the runners +# have each finished shutting themselves down, but we are about to exit so it +# does not make much difference. foreach my $runnerid (values %runnerids) { runnerac_shutdown($runnerid); sleep 0; # give runner a context switch so it can shut itself down diff --git a/tests/secureserver.pl b/tests/secureserver.pl index 930845e971..0e34bf1d7c 100755 --- a/tests/secureserver.pl +++ b/tests/secureserver.pl @@ -176,7 +176,7 @@ while(@ARGV) { $mtls = 1; } else { - print STDERR "\nWarning: secureserver.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: secureserver.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } @@ -217,7 +217,7 @@ foreach my $veropt (('-version', '-V')) { $ver_minor = $2; } elsif($verstr =~ /^sslVersion.*fips *= *yes/) { - # the fips option causes an error if stunnel doesn't support it + # the fips option causes an error if stunnel does not support it $fips_support = 1; last } @@ -304,7 +304,7 @@ if($stunnel_version >= 400) { print $stunconf "verifyChain = yes\n"; } if($fips_support) { - # disable fips in case OpenSSL doesn't support it + # disable fips in case OpenSSL does not support it print $stunconf "fips = no\n"; } if(!$tstunnel_windows) { @@ -358,7 +358,7 @@ if($tstunnel_windows) { # Put an "exec" in front of the command so that the child process # keeps this child's process ID by being tied to the spawned shell. - exec("exec $cmd") || die "Can't exec() $cmd: $!"; + exec("exec $cmd") || die "Cannot exec() $cmd: $!"; # exec() will create a new process, but ties the existence of the # new process to the parent waiting perl.exe and sh.exe processes. diff --git a/tests/server/first.h b/tests/server/first.h index 3a7255ccb8..2979239ad3 100644 --- a/tests/server/first.h +++ b/tests/server/first.h @@ -48,9 +48,7 @@ struct entry_s { extern const struct entry_s s_entries[]; -#ifndef UNDER_CE #include -#endif #ifdef HAVE_NETINET_IN_H #include #endif @@ -152,7 +150,7 @@ extern curl_socket_t sockdaemon(curl_socket_t sock, bool bind_only); /* global variables */ -static const char *srcpath = "."; /* pointing to the test dir */ +static const char *srcpath = "."; /* pointing to the test directory */ static const char *pidname = NULL; static const char *portname = NULL; /* none by default */ static const char *serverlogfile = NULL; diff --git a/tests/server/getpart.c b/tests/server/getpart.c index 6bff92ab1a..efec3de634 100644 --- a/tests/server/getpart.c +++ b/tests/server/getpart.c @@ -50,7 +50,7 @@ static size_t line_length(const char *buffer, int bytestocheck) } if(*buffer != '\n') { /* - * We didn't find a new line so the last byte must be a + * We did not find a new line so the last byte must be a * '\0' character inserted by fgets() which we should not * count. */ diff --git a/tests/server/mqttd.c b/tests/server/mqttd.c index df5fb36903..2701d61260 100644 --- a/tests/server/mqttd.c +++ b/tests/server/mqttd.c @@ -563,7 +563,7 @@ static curl_socket_t mqttit(curl_socket_t fd) memcpy(topic, &buffer[4], topic_len); topic[topic_len] = 0; - /* there's a QoS byte (two bits) after the topic */ + /* there is a QoS byte (two bits) after the topic */ logmsg("SUBSCRIBE to '%s' [%d]", topic, packet_id); stream = test2fopen(testno, logdir); @@ -572,7 +572,7 @@ static curl_socket_t mqttit(curl_socket_t fd) error = errno; logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); - logmsg("Couldn't open test file %ld", testno); + logmsg("Could not open test file %ld", testno); goto end; } error = getpart(&data, &datalen, "reply", "data", stream); @@ -679,7 +679,7 @@ static bool mqttd_incoming(curl_socket_t listenfd) FD_ZERO(&fds_write); FD_ZERO(&fds_err); - /* there's always a socket to wait for */ + /* there is always a socket to wait for */ #ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" diff --git a/tests/server/resolve.c b/tests/server/resolve.c index cab3cb7dff..c41c2fc68a 100644 --- a/tests/server/resolve.c +++ b/tests/server/resolve.c @@ -93,7 +93,7 @@ static int test_resolve(int argc, char *argv[]) /* Check that the system has IPv6 enabled before checking the resolver */ curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0); if(s == CURL_SOCKET_BAD) - /* an IPv6 address was requested and we can't get/use one */ + /* an IPv6 address was requested and we cannot get/use one */ rc = -1; else { sclose(s); @@ -128,7 +128,7 @@ static int test_resolve(int argc, char *argv[]) #endif if(rc) - printf("Resolving %s '%s' didn't work\n", ipv_inuse, host); + printf("Resolving %s '%s' did not work\n", ipv_inuse, host); return !!rc; } diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index c3d4678ae4..5ffd0f28e5 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -62,8 +62,8 @@ struct rtspd_httprequest { long testno; /* test number found in the request */ long partno; /* part number found in the request */ bool open; /* keep connection open info, as found in the request */ - bool auth_req; /* authentication required, don't wait for body unless - there's an Authorization header */ + bool auth_req; /* authentication required, do not wait for body unless + there is an Authorization header */ bool auth; /* Authorization header present in the incoming request */ size_t cl; /* Content-Length of the incoming request */ bool digest; /* Authorization digest header found */ @@ -238,7 +238,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req) int error = errno; logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); - logmsg("Couldn't open test file %ld", req->testno); + logmsg("Could not open test file %ld", req->testno); req->open = FALSE; /* closes connection */ return 1; /* done */ } @@ -285,7 +285,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req) if(num < 0) logmsg("negative pipe size ignored"); else if(num > 0) - req->pipe = num-1; /* decrease by one since we don't count the + req->pipe = num-1; /* decrease by one since we do not count the first request in this number */ } else if(sscanf(ptr, "skip: %d", &num) == 1) { @@ -362,10 +362,10 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req) req->open = FALSE; /* HTTP 1.0 closes connection by default */ if(!strncmp(doc, "bad", 3)) - /* if the host name starts with bad, we fake an error here */ + /* if the hostname starts with bad, we fake an error here */ req->testno = DOCNUMBER_BADCONNECT; else if(!strncmp(doc, "test", 4)) { - /* if the host name starts with test, the port number used in the + /* if the hostname starts with test, the port number used in the CONNECT line will be used as test number! */ char *portp = strchr(doc, ':'); if(portp && (*(portp + 1) != '\0') && ISDIGIT(*(portp + 1))) { @@ -389,7 +389,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req) } if(!end) { - /* we don't have a complete request yet! */ + /* we do not have a complete request yet! */ logmsg("rtspd_ProcessRequest returned without a complete request"); return 0; /* not complete yet */ } @@ -403,7 +403,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req) /* **** Persistence **** * * If the request is an HTTP/1.0 one, we close the connection unconditionally - * when we're done. + * when we are done. * * If the request is an HTTP/1.1 one, we MUST check for a "Connection:" * header that might say "close". If it does, we close a connection when @@ -416,8 +416,8 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req) return 1; /* done */ if((req->cl == 0) && !CURL_STRNICMP("Content-Length:", line, 15)) { - /* If we don't ignore content-length, we read it and we read the whole - request including the body before we return. If we've been told to + /* If we do not ignore content-length, we read it and we read the whole + request including the body before we return. If we have been told to ignore the content-length, we will return as soon as all headers have been received */ curl_off_t clen; @@ -645,7 +645,7 @@ static int rtspd_get_request(curl_socket_t sock, struct rtspd_httprequest *req) else { if(req->skip) /* we are instructed to not read the entire thing, so we make sure to - only read what we're supposed to and NOT read the entire thing the + only read what we are supposed to and NOT read the entire thing the client wants to send! */ got = sread(sock, reqbuf + req->offset, req->cl); else @@ -810,7 +810,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req) error = errno; logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); - logmsg("Couldn't open test file"); + logmsg("Could not open test file"); return 0; } else { @@ -834,7 +834,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req) error = errno; logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); - logmsg("Couldn't open test file"); + logmsg("Could not open test file"); free(ptr); return 0; } @@ -876,7 +876,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req) logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); logmsg("Error opening file '%s'", responsedump); - logmsg("couldn't create logfile '%s'", responsedump); + logmsg("could not create logfile '%s'", responsedump); free(ptr); free(cmd); return -1; diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 7320fa6fe9..e30f54c415 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -101,7 +101,7 @@ enum sockmode { ACTIVE_DISCONNECT /* as a client, disconnected from server */ }; -#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) /* * read-wrapper to support reading from stdin on Windows. */ @@ -128,7 +128,7 @@ static ssize_t read_wincon(int fd, void *buf, size_t count) return rcount; } - CURL_SETERRNO((int)GetLastError()); + errno = (int)GetLastError(); return -1; } @@ -161,7 +161,7 @@ static ssize_t write_wincon(int fd, const void *buf, size_t count) return wcount; } - CURL_SETERRNO((int)GetLastError()); + errno = (int)GetLastError(); return -1; } #define SOCKFILT_read read_wincon @@ -171,8 +171,6 @@ static ssize_t write_wincon(int fd, const void *buf, size_t count) #define SOCKFILT_write write #endif -#ifndef UNDER_CE - /* On Windows, we sometimes get this for a broken pipe, seemingly * when the client just closed stdin? */ #define CURL_WIN32_EPIPE 109 @@ -296,7 +294,6 @@ static bool read_stdin(void *buffer, size_t nbytes) } return TRUE; } -#endif /* * write_stdout tries to write to stdio nbytes from the given buffer. This is a @@ -308,12 +305,7 @@ static bool read_stdin(void *buffer, size_t nbytes) static bool write_stdout(const void *buffer, size_t nbytes) { ssize_t nwrite; -#ifdef UNDER_CE - puts(buffer); - nwrite = nbytes; -#else nwrite = fullwrite(fileno(stdout), buffer, nbytes); -#endif if(nwrite != (ssize_t)nbytes) { logmsg("exiting..."); return FALSE; @@ -321,7 +313,6 @@ static bool write_stdout(const void *buffer, size_t nbytes) return TRUE; } -#ifndef UNDER_CE static void lograw(unsigned char *buffer, ssize_t len) { char data[120]; @@ -401,10 +392,8 @@ static bool read_data_block(unsigned char *buffer, ssize_t maxlen, return TRUE; } -#endif - -#if defined(USE_WINSOCK) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#if defined(USE_WINSOCK) && !defined(CURL_WINDOWS_UWP) /* * Winsock select() does not support standard file descriptors, * it can only check SOCKETs. The following function is an attempt @@ -867,8 +856,6 @@ static int select_ws(int nfds, fd_set *readfds, fd_set *writefds, #define SOCKFILT_select(a,b,c,d,e) select(a,b,c,d,e) #endif /* USE_WINSOCK */ - -#ifndef UNDER_CE /* Perform the disconnect handshake with sockfilt * This involves waiting for the disconnect acknowledgment after the DISC * command, while throwing away anything else that might come in before @@ -914,7 +901,7 @@ static bool disc_handshake(void) * The only other messages that could occur here are PING and PORT, * and both of them occur at the start of a test when nothing should be * trying to DISC. Therefore, we should not ever get here, but if we - * do, it's probably due to some kind of unclean shutdown situation so + * do, it is probably due to some kind of unclean shutdown situation so * us shutting down is what we probably ought to be doing, anyway. */ return FALSE; @@ -923,7 +910,6 @@ static bool disc_handshake(void) } while(TRUE); return TRUE; } -#endif /* sockfdp is a pointer to an established stream or CURL_SOCKET_BAD @@ -935,12 +921,6 @@ static bool juggle(curl_socket_t *sockfdp, curl_socket_t listenfd, enum sockmode *mode) { -#ifdef UNDER_CE - (void)sockfdp; - (void)listenfd; - (void)mode; - return FALSE; -#else struct timeval timeout; fd_set fds_read; fd_set fds_write; @@ -990,7 +970,7 @@ static bool juggle(curl_socket_t *sockfdp, /* server mode */ sockfd = listenfd; - /* there's always a socket to wait for */ + /* there is always a socket to wait for */ #ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" @@ -1011,7 +991,7 @@ static bool juggle(curl_socket_t *sockfdp, maxfd = 0; /* stdin */ } else { - /* there's always a socket to wait for */ + /* there is always a socket to wait for */ #ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" @@ -1170,7 +1150,7 @@ static bool juggle(curl_socket_t *sockfdp, if((sockfd != CURL_SOCKET_BAD) && (FD_ISSET(sockfd, &fds_read)) ) { ssize_t nread_socket; if(*mode == PASSIVE_LISTEN) { - /* there's no stream set up yet, this is an indication that there's a + /* there is no stream set up yet, this is an indication that there is a client connecting. */ curl_socket_t newfd = accept(sockfd, NULL, NULL); if(CURL_SOCKET_BAD == newfd) { @@ -1217,7 +1197,6 @@ static bool juggle(curl_socket_t *sockfdp, } return TRUE; -#endif } static int test_sockfilt(int argc, char *argv[]) diff --git a/tests/server/socksd.c b/tests/server/socksd.c index f14ee13ee4..1a1d40113b 100644 --- a/tests/server/socksd.c +++ b/tests/server/socksd.c @@ -42,7 +42,7 @@ * state * "nmethods_max [number: 3]" - the minimum numberf NMETHODS the client must * state - * "user [string]" - the user name that must match (if method is 2) + * "user [string]" - the username that must match (if method is 2) * "password [string]" - the password that must match (if method is 2) * "backend [IPv4]" - numerical IPv4 address of backend to connect to * "backendport [number:0]" - TCP port of backend to connect to. 0 means use @@ -644,7 +644,7 @@ static bool socksd_incoming(curl_socket_t listenfd) FD_ZERO(&fds_write); FD_ZERO(&fds_err); - /* there's always a socket to wait for */ + /* there is always a socket to wait for */ #ifdef __DJGPP__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warith-conversion" diff --git a/tests/server/sws.c b/tests/server/sws.c index 29e69d893b..d590cd6fef 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -59,8 +59,8 @@ struct sws_httprequest { long testno; /* test number found in the request */ long partno; /* part number found in the request */ bool open; /* keep connection open info, as found in the request */ - bool auth_req; /* authentication required, don't wait for body unless - there's an Authorization header */ + bool auth_req; /* authentication required, do not wait for body unless + there is an Authorization header */ bool auth; /* Authorization header present in the incoming request */ size_t cl; /* Content-Length of the incoming request */ bool digest; /* Authorization digest header found */ @@ -76,7 +76,7 @@ struct sws_httprequest { int prot_version; /* HTTP version * 10 */ int callcount; /* times sws_ProcessRequest() gets called */ bool skipall; /* skip all incoming data */ - bool noexpect; /* refuse Expect: (don't read the body) */ + bool noexpect; /* refuse Expect: (do not read the body) */ bool connmon; /* monitor the state of the connection, log disconnects */ bool upgrade; /* test case allows upgrade */ bool upgrade_request; /* upgrade request found and allowed */ @@ -208,7 +208,7 @@ static int sws_parse_servercmd(struct sws_httprequest *req) error = errno; logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); - logmsg(" Couldn't open test file %ld", req->testno); + logmsg(" Could not open test file %ld", req->testno); req->open = FALSE; /* closes connection */ return 1; /* done */ } @@ -340,7 +340,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req) if(http && sscanf(http, "HTTP/%d.%d", &prot_major, &prot_minor) == 2) { - /* between the request keyword and HTTP/ there's a path */ + /* between the request keyword and HTTP/ there is a path */ httppath = line + strlen(request); npath = http - httppath; @@ -414,7 +414,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req) } if(req->testno == DOCNUMBER_NOTHING) { - /* didn't find any in the first scan, try alternative test case + /* did not find any in the first scan, try alternative test case number placements */ static char doc[MAXDOCNAMELEN]; if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d", @@ -485,7 +485,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req) } if(!end) { - /* we don't have a complete request yet! */ + /* we do not have a complete request yet! */ logmsg("request not complete yet"); return 0; /* not complete yet */ } @@ -545,7 +545,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req) /* **** Persistence **** * * If the request is an HTTP/1.0 one, we close the connection unconditionally - * when we're done. + * when we are done. * * If the request is an HTTP/1.1 one, we MUST check for a "Connection:" * header that might say "close". If it does, we close a connection when @@ -558,8 +558,8 @@ static int sws_ProcessRequest(struct sws_httprequest *req) return 1; /* done */ if((req->cl == 0) && !CURL_STRNICMP("Content-Length:", line, 15)) { - /* If we don't ignore content-length, we read it and we read the whole - request including the body before we return. If we've been told to + /* If we do not ignore content-length, we read it and we read the whole + request including the body before we return. If we have been told to ignore the content-length, we will return as soon as all headers have been received */ curl_off_t clen; @@ -883,7 +883,7 @@ static int sws_get_request(curl_socket_t sock, struct sws_httprequest *req) else { if(req->skip) /* we are instructed to not read the entire thing, so we make sure to - only read what we're supposed to and NOT read the entire thing the + only read what we are supposed to and NOT read the entire thing the client wants to send! */ got = sread(sock, reqbuf + req->offset, req->cl); else @@ -1955,7 +1955,7 @@ static int service_connection(curl_socket_t *msgsock, if(req->connect_request) { /* a CONNECT request, setup and talk the tunnel */ if(!is_proxy) { - logmsg("received CONNECT but isn't running as proxy!"); + logmsg("received CONNECT but not running as proxy!"); return 1; } else { @@ -2419,7 +2419,7 @@ static int test_sws(int argc, char *argv[]) if(!req->open) /* When instructed to close connection after server-reply we - wait a very small amount of time before doing so. If this + wait a small amount of time before doing so. If this is not done client might get an ECONNRESET before reading a single byte of server-reply. */ curlx_wait_ms(50); @@ -2437,7 +2437,7 @@ static int test_sws(int argc, char *argv[]) goto sws_cleanup; } - /* Reset the request, unless we're still in the middle of reading */ + /* Reset the request, unless we are still in the middle of reading */ if(rc && !req->upgrade_request) /* Note: resetting the HTTP request here can cause problems if: * 1) req->skipall is TRUE, @@ -2448,9 +2448,9 @@ static int test_sws(int argc, char *argv[]) * data (in service_connection()) as the first data received on * this new HTTP request and report "** Unusual request" (skipall * would have otherwise caused that data to be ignored). Normally, - * that socket will be closed by the client and there won't be any - * stale data to cause this, but stranger things have happened (see - * issue #11678). + * that socket will be closed by the client and there will not be + * any stale data to cause this, but stranger things have happened + * (see issue #11678). */ init_httprequest(req); } while(rc > 0); diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 819f06bf2d..a701f223c5 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -310,7 +310,7 @@ static struct tftphdr *rw_init(int x) { newline = 0; /* init crlf flag */ prevchar = -1; - bfs[0].counter = BF_ALLOC; /* pass out the first buffer */ + bfs[0].counter = BF_ALLOC; /* pass out the first buffer */ current = 0; bfs[1].counter = BF_FREE; nextone = x; /* ahead or behind? */ @@ -339,7 +339,7 @@ static int readit(struct testcase *test, struct tftphdr * volatile *dpp, current = !current; /* "incr" current */ b = &bfs[current]; /* look at new buffer */ - if(b->counter == BF_FREE) /* if it's empty */ + if(b->counter == BF_FREE) /* if empty */ read_ahead(test, convert); /* fill it */ *dpp = &b->buf.hdr; /* set caller's ptr */ @@ -360,7 +360,7 @@ static void read_ahead(struct testcase *test, struct tftphdr *dp; b = &bfs[nextone]; /* look at "next" buffer */ - if(b->counter != BF_FREE) /* nop if not free */ + if(b->counter != BF_FREE) /* nop if not free */ return; nextone = !nextone; /* "incr" next buffer ptr */ @@ -447,7 +447,7 @@ static ssize_t write_behind(struct testcase *test, int convert) snprintf(outfile, sizeof(outfile), "%s/upload.%ld", logdir, test->testno); test->ofile = open(outfile, O_CREAT|O_RDWR|CURL_O_BINARY, 0777); if(test->ofile == -1) { - logmsg("Couldn't create and/or open file %s for upload!", outfile); + logmsg("Could not create and/or open file %s for upload!", outfile); return -1; /* failure! */ } } @@ -1017,7 +1017,7 @@ static int tftpd_parse_servercmd(struct testcase *req) error = errno; logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); - logmsg(" Couldn't open test file %ld", req->testno); + logmsg(" Could not open test file %ld", req->testno); return 1; /* done */ } else { @@ -1141,7 +1141,7 @@ static int validate_access(struct testcase *test, int error = errno; logmsg("fopen() failed with error (%d) %s", error, curlx_strerror(error, errbuf, sizeof(errbuf))); - logmsg("Couldn't open test file for test: %ld", testno); + logmsg("Could not open test file for test: %ld", testno); return TFTP_EACCESS; } else { diff --git a/tests/server/util.c b/tests/server/util.c index 6de8000327..6551e47426 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -97,7 +97,7 @@ void logmsg(const char *msg, ...) } sec = epoch_offset + tv.tv_sec; /* !checksrc! disable BANNEDFUNC 1 */ - now = localtime(&sec); /* not thread safe but we don't care */ + now = localtime(&sec); /* not thread safe but we do not care */ snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld", (int)now->tm_hour, (int)now->tm_min, (int)now->tm_sec, @@ -227,7 +227,7 @@ int write_pidfile(const char *filename) pidfile = fopen(filename, "wb"); if(!pidfile) { char errbuf[STRERROR_LEN]; - logmsg("Couldn't write pid file: %s (%d) %s", filename, + logmsg("Could not write pid file: %s (%d) %s", filename, errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); return 0; /* fail */ } @@ -243,7 +243,7 @@ int write_portfile(const char *filename, int port) FILE *portfile = fopen(filename, "wb"); if(!portfile) { char errbuf[STRERROR_LEN]; - logmsg("Couldn't write port file: %s (%d) %s", filename, + logmsg("Could not write port file: %s (%d) %s", filename, errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); return 0; /* fail */ } @@ -333,7 +333,7 @@ static SIGHANDLER_T old_sigterm_handler = SIG_ERR; static SIGHANDLER_T old_sigbreak_handler = SIG_ERR; #endif -#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) static DWORD thread_main_id = 0; static HANDLE thread_main_window = NULL; static HWND hidden_main_window = NULL; @@ -344,7 +344,6 @@ static HWND hidden_main_window = NULL; * The first time this is called it will set got_exit_signal to one and * store in exit_signal the signal that triggered its execution. */ -#ifndef UNDER_CE /* * Only call signal-safe functions from the signal handler, as required by * the POSIX specification: @@ -387,11 +386,10 @@ static void exit_signal_handler(int signum) #endif } (void)signal(signum, exit_signal_handler); - CURL_SETERRNO(old_errno); + errno = old_errno; } -#endif -#if defined(_WIN32) && !defined(UNDER_CE) +#ifdef _WIN32 /* CTRL event handler for Windows Console applications to simulate * SIGINT, SIGTERM and SIGBREAK on CTRL events and trigger signal handler. * @@ -439,7 +437,7 @@ static BOOL WINAPI ctrl_event_handler(DWORD dwCtrlType) } #endif -#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP) /* Window message handler for Windows applications to add support * for graceful process termination via taskkill (without /f) which * sends WM_CLOSE to all Windows of a process (even hidden ones). @@ -519,7 +517,6 @@ static DWORD WINAPI main_window_loop(void *lpParameter) } #endif -#ifndef UNDER_CE static SIGHANDLER_T set_signal(int signum, SIGHANDLER_T handler, bool restartable) { @@ -549,7 +546,6 @@ static SIGHANDLER_T set_signal(int signum, SIGHANDLER_T handler, return oldhdlr; #endif } -#endif void install_signal_handlers(bool keep_sigalrm) { @@ -608,12 +604,10 @@ void install_signal_handlers(bool keep_sigalrm) errno, curlx_strerror(errno, errbuf, sizeof(errbuf))); #endif #ifdef _WIN32 -#ifndef UNDER_CE if(!SetConsoleCtrlHandler(ctrl_event_handler, TRUE)) logmsg("cannot install CTRL event handler"); -#endif -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP thread_main_window = CreateThread(NULL, 0, &main_window_loop, GetModuleHandle(NULL), 0, &thread_main_id); if(!thread_main_window || !thread_main_id) @@ -653,10 +647,8 @@ void restore_signal_handlers(bool keep_sigalrm) (void)set_signal(SIGBREAK, old_sigbreak_handler, FALSE); #endif #ifdef _WIN32 -#ifndef UNDER_CE (void)SetConsoleCtrlHandler(ctrl_event_handler, FALSE); -#endif -#if !defined(CURL_WINDOWS_UWP) && !defined(UNDER_CE) +#ifndef CURL_WINDOWS_UWP if(thread_main_window && thread_main_id) { if(PostThreadMessage(thread_main_id, WM_APP, 0, 0)) { if(WaitForSingleObjectEx(thread_main_window, INFINITE, TRUE)) { diff --git a/tests/serverhelp.pm b/tests/serverhelp.pm index 1a3c997755..c79528af71 100644 --- a/tests/serverhelp.pm +++ b/tests/serverhelp.pm @@ -64,7 +64,7 @@ use testutil qw( exerunner ); -our $logfile; # server log file name, for logmsg +our $logfile; # server log filename, for logmsg #*************************************************************************** # Just for convenience, test harness uses 'https' and 'httptls' literals as @@ -153,7 +153,7 @@ sub servername_id { #*************************************************************************** -# Return server name string formatted for file name purposes +# Return server name string formatted for filename purposes # sub servername_canon { my ($proto, $ipver, $idnum) = @_; @@ -165,7 +165,7 @@ sub servername_canon { #*************************************************************************** -# Return file name for server pid file. +# Return filename for server pid file. # sub server_pidfilename { my ($piddir, $proto, $ipver, $idnum) = @_; @@ -174,7 +174,7 @@ sub server_pidfilename { } #*************************************************************************** -# Return file name for server port file. +# Return filename for server port file. # sub server_portfilename { my ($piddir, $proto, $ipver, $idnum) = @_; @@ -184,7 +184,7 @@ sub server_portfilename { #*************************************************************************** -# Return file name for server log file. +# Return filename for server log file. # sub server_logfilename { my ($logdir, $proto, $ipver, $idnum) = @_; @@ -195,7 +195,7 @@ sub server_logfilename { #*************************************************************************** -# Return file name for server commands file. +# Return filename for server commands file. # sub server_cmdfilename { my ($logdir, $proto, $ipver, $idnum) = @_; @@ -205,7 +205,7 @@ sub server_cmdfilename { #*************************************************************************** -# Return file name for server input file. +# Return filename for server input file. # sub server_inputfilename { my ($logdir, $proto, $ipver, $idnum) = @_; @@ -215,7 +215,7 @@ sub server_inputfilename { #*************************************************************************** -# Return file name for server output file. +# Return filename for server output file. # sub server_outputfilename { my ($logdir, $proto, $ipver, $idnum) = @_; @@ -253,7 +253,7 @@ sub server_exe_args { #*************************************************************************** -# Return file name for main or primary sockfilter pid file. +# Return filename for main or primary sockfilter pid file. # sub mainsockf_pidfilename { my ($piddir, $proto, $ipver, $idnum) = @_; @@ -265,7 +265,7 @@ sub mainsockf_pidfilename { #*************************************************************************** -# Return file name for main or primary sockfilter log file. +# Return filename for main or primary sockfilter log file. # sub mainsockf_logfilename { my ($logdir, $proto, $ipver, $idnum) = @_; @@ -277,7 +277,7 @@ sub mainsockf_logfilename { #*************************************************************************** -# Return file name for data or secondary sockfilter pid file. +# Return filename for data or secondary sockfilter pid file. # sub datasockf_pidfilename { my ($piddir, $proto, $ipver, $idnum) = @_; @@ -289,7 +289,7 @@ sub datasockf_pidfilename { #*************************************************************************** -# Return file name for data or secondary sockfilter log file. +# Return filename for data or secondary sockfilter log file. # sub datasockf_logfilename { my ($logdir, $proto, $ipver, $idnum) = @_; diff --git a/tests/servers.pm b/tests/servers.pm index e5505886f6..db4b3757b5 100644 --- a/tests/servers.pm +++ b/tests/servers.pm @@ -118,12 +118,12 @@ use testutil qw( ); -my %serverpidfile; # all server pid file names, identified by server id -my %serverportfile;# all server port file names, identified by server id +my %serverpidfile; # all server pid filenames, identified by server id +my %serverportfile;# all server port filenames, identified by server id my $sshdvernum; # for socks server, ssh daemon version number my $sshdverstr; # for socks server, ssh daemon version string my $sshderror; # for socks server, ssh daemon version error -my %doesntrun; # servers that don't work, identified by pidfile +my %doesntrun; # servers that do not work, identified by pidfile my %PORT = (nolisten => 47); # port we use for a local non-listening service my $server_response_maxtime=13; my $httptlssrv = find_httptlssrv(); @@ -185,7 +185,7 @@ sub getfreeport { Type => SOCK_STREAM, Reuse => 1, Listen => 10 ) - or die "Couldn't create tcp server socket: $@\n"; + or die "Could not create tcp server socket: $@\n"; return $server->sockport(); } @@ -225,7 +225,7 @@ sub initserverconfig { } ####################################################################### -# Load serverpidfile and serverportfile hashes with file names for all +# Load serverpidfile and serverportfile hashes with filenames for all # possible servers. # sub init_serverpidfile_hash { @@ -362,14 +362,14 @@ sub startnew { # Put an "exec" in front of the command so that the child process # keeps this child's process ID. - exec("exec $cmd") || die "Can't exec() $cmd: $!"; + exec("exec $cmd") || die "Cannot exec() $cmd: $!"; # exec() should never return back here to this process. We protect # ourselves by calling die() just in case something goes really bad. die "error: exec() has returned"; } - # Ugly hack but ssh client and gnutls-serv don't support pid files + # Ugly hack but ssh client and gnutls-serv do not support pid files if($fakepidfile) { if(open(my $out, ">", "$pidfile")) { print $out $child . "\n"; @@ -400,7 +400,7 @@ sub startnew { if(checkdied($child)) { logmsg "startnew: child process has died, server might start up\n" if($verbose); - # We can't just abort waiting for the server with a + # We cannot just abort waiting for the server with a # return (-1,-1); # because the server might have forked and could still start # up normally. Instead, just reduce the amount of time we remain @@ -427,7 +427,7 @@ sub protoport { ####################################################################### -# Stop a test server along with pids which aren't in the %run hash yet. +# Stop a test server along with pids which are not in the %run hash yet. # This also stops all servers which are relative to the given one. # sub stopserver { @@ -523,7 +523,7 @@ sub getexternalproxyflags { ####################################################################### # Verify that the server that runs on $ip, $port is our server. This also # implies that we can speak with it, as there might be occasions when the -# server runs fine but we cannot talk to it ("Failed to connect to ::1: Can't +# server runs fine but we cannot talk to it ("Failed to connect to ::1: Cannot # assign requested address") # sub verifyhttp { @@ -596,7 +596,7 @@ sub verifyhttp { $pid = 0+$1; } elsif($res == 6) { - # curl: (6) Couldn't resolve host '::1' + # curl: (6) Could not resolve hostname '::1' logmsg "RUN: failed to resolve host ($proto://$ip:$port/verifiedserver)\n"; return -1; } @@ -610,7 +610,7 @@ sub verifyhttp { ####################################################################### # Verify that the server that runs on $ip, $port is our server. This also # implies that we can speak with it, as there might be occasions when the -# server runs fine but we cannot talk to it ("Failed to connect to ::1: Can't +# server runs fine but we cannot talk to it ("Failed to connect to ::1: Cannot # assign requested address") # sub verifyftp { @@ -677,7 +677,7 @@ sub verifyftp { ####################################################################### # Verify that the server that runs on $ip, $port is our server. This also # implies that we can speak with it, as there might be occasions when the -# server runs fine but we cannot talk to it ("Failed to connect to ::1: Can't +# server runs fine but we cannot talk to it ("Failed to connect to ::1: Cannot # assign requested address") # sub verifyrtsp { @@ -739,7 +739,7 @@ sub verifyrtsp { $pid = 0+$1; } elsif($res == 6) { - # curl: (6) Couldn't resolve host '::1' + # curl: (6) Could not resolve hostname '::1' logmsg "RUN: failed to resolve host ($proto://$ip:$port/verifiedserver)\n"; return -1; } @@ -774,13 +774,13 @@ sub verifysftp { my ($proto, $ipvnum, $idnum, $ip, $port) = @_; my $server = servername_id($proto, $ipvnum, $idnum); my $verified = 0; - # Find out sftp client canonical file name + # Find out sftp client canonical filename my $sftp = find_sftp(); if(!$sftp) { logmsg "RUN: SFTP server cannot find $sftpexe\n"; return -1; } - # Find out ssh client canonical file name + # Find out ssh client canonical filename my $ssh = find_ssh(); if(!$ssh) { logmsg "RUN: SFTP server cannot find $sshexe\n"; @@ -807,7 +807,7 @@ sub verifysftp { # Verify that the non-stunnel HTTP TLS extensions capable server that runs # on $ip, $port is our server. This also implies that we can speak with it, # as there might be occasions when the server runs fine but we cannot talk -# to it ("Failed to connect to ::1: Can't assign requested address") +# to it ("Failed to connect to ::1: Cannot assign requested address") # sub verifyhttptls { my ($proto, $ipvnum, $idnum, $ip, $port) = @_; @@ -874,7 +874,7 @@ sub verifyhttptls { return $pid; } elsif($res == 6) { - # curl: (6) Couldn't resolve host '::1' + # curl: (6) Could not resolve hostname '::1' logmsg "RUN: failed to resolve host (https://$ip:$port/verifiedserver)\n"; return -1; } @@ -902,7 +902,7 @@ sub verifypid { ####################################################################### # Verify that the server that runs on $ip, $port is our server. This also # implies that we can speak with it, as there might be occasions when the -# server runs fine but we cannot talk to it ("Failed to connect to ::1: Can't +# server runs fine but we cannot talk to it ("Failed to connect to ::1: Cannot # assign requested address") # sub verifysmb { @@ -962,7 +962,7 @@ sub verifysmb { ####################################################################### # Verify that the server that runs on $ip, $port is our server. This also # implies that we can speak with it, as there might be occasions when the -# server runs fine but we cannot talk to it ("Failed to connect to ::1: Can't +# server runs fine but we cannot talk to it ("Failed to connect to ::1: Cannot # assign requested address") # sub verifytelnet { @@ -1110,7 +1110,7 @@ sub runhttpserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1189,7 +1189,7 @@ sub runhttp2server { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0, 0); } @@ -1250,7 +1250,7 @@ sub runhttp3server { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1316,7 +1316,7 @@ sub runhttpsserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1360,7 +1360,7 @@ sub runhttpsserver { if($httpspid <= 0 || !pidexists($httpspid)) { # it is NOT alive - # don't call stopserver since that will also kill the dependent + # do not call stopserver since that will also kill the dependent # server that has already been started properly $doesntrun{$pidfile} = 1; $httpspid = $pid2 = 0; @@ -1397,7 +1397,7 @@ sub runhttptlsserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1460,7 +1460,7 @@ sub runpingpongserver { my $pidfile = $serverpidfile{$server}; my $portfile = $serverportfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0); } @@ -1531,7 +1531,7 @@ sub runsecureserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1564,7 +1564,7 @@ sub runsecureserver { if($protospid <= 0 || !pidexists($protospid)) { # it is NOT alive - # don't call stopserver since that will also kill the dependent + # do not call stopserver since that will also kill the dependent # server that has already been started properly $doesntrun{$pidfile} = 1; $protospid = $pid2 = 0; @@ -1602,7 +1602,7 @@ sub runtftpserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1673,7 +1673,7 @@ sub rundnsserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1746,7 +1746,7 @@ sub runrtspserver { my $pidfile = $serverpidfile{$server}; my $portfile = $serverportfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1808,7 +1808,7 @@ sub runsshserver { my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1; if(!$USER) { - logmsg "Can't start ssh server due to lack of USER name\n"; + logmsg "Cannot start ssh server due to lack of username\n"; return (4, 0, 0, 0); } @@ -1816,7 +1816,7 @@ sub runsshserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -1870,8 +1870,8 @@ sub runsshserver { # once it is known that the ssh server is alive, sftp server # verification is performed actually connecting to it, authenticating - # and performing a very simple remote command. This verification is - # tried only one time. + # and performing a simple remote command. This verification is tried + # only one time. $sshdlog = server_logfilename($LOGDIR, 'ssh', $ipvnum, $idnum); $sftplog = server_logfilename($LOGDIR, 'sftp', $ipvnum, $idnum); @@ -1889,7 +1889,7 @@ sub runsshserver { logmsg "RUN: failed to verify the $srvrname server on $port\n"; return (5, 0, 0, 0); } - # we're happy, no need to loop anymore! + # we are happy, no need to loop anymore! $doesntrun{$pidfile} = 0; my $hostfile; @@ -1934,7 +1934,7 @@ sub runmqttserver { my $pidfile = $serverpidfile{$server}; my $portfile = $serverportfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0); } @@ -1996,7 +1996,7 @@ sub runsocksserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -2079,7 +2079,7 @@ sub rundictserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -2140,7 +2140,7 @@ sub runsmbserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -2201,7 +2201,7 @@ sub runnegtelnetserver { my $pidfile = $serverpidfile{$server}; - # don't retry if the server doesn't work + # do not retry if the server does not work if($doesntrun{$pidfile}) { return (2, 0, 0, 0); } @@ -2584,7 +2584,7 @@ sub startservers { elsif($what =~ /^(ftp|imap|pop3|smtp)s$/) { my $cproto = $1; if(!$stunnel) { - # we can't run ftps tests without stunnel + # we cannot run ftps tests without stunnel return ("no stunnel", 4); } if($runcert{$what} && ($runcert{$what} ne $certfile)) { @@ -2624,7 +2624,7 @@ sub startservers { } elsif($what eq "https" || $what eq "https-mtls") { if(!$stunnel) { - # we can't run https tests without stunnel + # we cannot run https tests without stunnel return ("no stunnel", 4); } if($runcert{$what} && ($runcert{$what} ne $certfile)) { @@ -2677,7 +2677,7 @@ sub startservers { } } elsif($what eq "http/2") { - # http/2 server proxies to a http server + # http/2 server proxies to an HTTP server if($run{'http/2'} && !responsive_http_server("https", $verbose, 0, protoport('http2tls'))) { logmsg "* restarting unresponsive HTTP/2 server\n"; @@ -2718,7 +2718,7 @@ sub startservers { } } elsif($what eq "http/3") { - # http/3 server proxies to a http server + # http/3 server proxies to an HTTP server if($run{'http/3'} && !responsive_http_server("https", $verbose, 0, protoport('http3'), 1)) { logmsg "* restarting unresponsive HTTP/3 server\n"; @@ -2759,7 +2759,7 @@ sub startservers { } elsif($what eq "gophers") { if(!$stunnel) { - # we can't run TLS tests without stunnel + # we cannot run TLS tests without stunnel return ("no stunnel", 4); } if($runcert{'gophers'} && ($runcert{'gophers'} ne $certfile)) { @@ -2803,7 +2803,7 @@ sub startservers { } elsif($what eq "https-proxy") { if(!$stunnel) { - # we can't run https-proxy tests without stunnel + # we cannot run https-proxy tests without stunnel return ("no stunnel", 4); } if($runcert{'https-proxy'} && @@ -2834,7 +2834,7 @@ sub startservers { } elsif($what eq "httptls") { if(!$httptlssrv) { - # for now, we can't run http TLS-EXT tests without gnutls-serv + # for now, we cannot run http TLS-EXT tests without gnutls-serv return ("no gnutls-serv (with SRP support)", 4); } if($run{'httptls'} && @@ -2856,7 +2856,7 @@ sub startservers { } elsif($what eq "httptls-ipv6") { if(!$httptlssrv) { - # for now, we can't run http TLS-EXT tests without gnutls-serv + # for now, we cannot run http TLS-EXT tests without gnutls-serv return ("no gnutls-serv", 4); } if($run{'httptls-ipv6'} && @@ -3027,7 +3027,7 @@ sub startservers { } } else { - warn "we don't support a server for $what"; + warn "we do not support a server for $what"; return ("no server for $what", 4); } } @@ -3188,7 +3188,7 @@ sub subvariables { # The purpose of FTPTIME2 is to provide times that can be # used for time-out tests and that would work on most hosts as these # adjust for the startup/check time for this particular host. We needed to - # do this to make the test suite run better on very slow hosts. + # do this to make the test suite run better on slow hosts. my $ftp2 = $ftpchecktime * 8; $$thing =~ s/${prefix}FTPTIME2/$ftp2/g; diff --git a/tests/smbserver.py b/tests/smbserver.py index bbaea6069e..aff9bb067e 100755 --- a/tests/smbserver.py +++ b/tests/smbserver.py @@ -23,9 +23,6 @@ # """Server for testing SMB.""" -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import argparse import logging import os @@ -33,15 +30,11 @@ import signal import sys import tempfile import threading +import configparser # Import our curl test data helper from util import ClosingFileHandler, TestData -if sys.version_info.major >= 3: - import configparser -else: - import ConfigParser as configparser - # impacket needs to be installed in the Python environment try: import impacket # noqa: F401 @@ -178,7 +171,7 @@ class TestSmbServer(imp_smbserver.SMBSERVER): self.ctd = TestData(test_data_directory) # Override smbComNtCreateAndX so we can pretend to have files which - # don't exist. + # do not exist. self.hookSmbCommand(imp_smb.SMB.SMB_COM_NT_CREATE_ANDX, self.create_and_x) @@ -318,7 +311,7 @@ class TestSmbServer(imp_smbserver.SMBSERVER): log.debug("[SMB] Get server path '%s'", requested_filename) if requested_filename not in [VERIFIED_REQ]: - raise SmbError(STATUS_NO_SUCH_FILE, "Couldn't find the file") + raise SmbError(STATUS_NO_SUCH_FILE, "Could not find the file") fid, filename = tempfile.mkstemp() log.debug("[SMB] Created %s (%d) for storing '%s'", @@ -390,9 +383,9 @@ def get_options(): parser.add_argument("--verbose", action="store", type=int, default=0, help="verbose output") parser.add_argument("--pidfile", action="store", - help="file name for the PID") + help="filename for the PID") parser.add_argument("--logfile", action="store", - help="file name for the log") + help="filename for the log") parser.add_argument("--srcdir", action="store", help="test directory") parser.add_argument("--id", action="store", help="server ID") parser.add_argument("--ipv4", action="store_true", default=0, diff --git a/tests/sshserver.pl b/tests/sshserver.pl index 98c15bc2a9..ae1a2579f2 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -107,7 +107,7 @@ my $error; my @cfgarr; #*************************************************************************** -# Returns a path of the given file name in the log directory (PiddirPath) +# Returns a path of the given filename in the log directory (PiddirPath) # sub pp { my $file = $_[0]; @@ -191,7 +191,7 @@ while(@ARGV) { } } else { - print STDERR "\nWarning: sshserver.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: sshserver.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } @@ -201,7 +201,7 @@ while(@ARGV) { # #*************************************************************************** -# Default ssh daemon pid file name & directory +# Default ssh daemon pid filename & directory # if($pidfile) { # Use our pidfile directory to store server config files @@ -214,7 +214,7 @@ else { } #*************************************************************************** -# ssh and sftp server log file names +# ssh and sftp server log filenames # $sshdlog = server_logfilename($logdir, 'ssh', $ipvnum, $idnum); $sftplog = server_logfilename($logdir, 'sftp', $ipvnum, $idnum); @@ -230,7 +230,7 @@ my $loglevel = $debugprotocol?'DEBUG3':'DEBUG2'; # Validate username # if(!$username) { - $error = 'Will not run ssh server without a user name'; + $error = 'Will not run ssh server without a username'; } elsif($username eq 'root') { $error = 'Will not run ssh server as root to mitigate security risks'; @@ -242,7 +242,7 @@ if($error) { #*************************************************************************** -# Find out ssh daemon canonical file name +# Find out ssh daemon canonical filename # my $sshd = find_sshd(); if(!$sshd) { @@ -293,7 +293,7 @@ if((($sshdid =~ /OpenSSH/) && ($sshdvernum < 299)) || #*************************************************************************** -# Find out sftp server plugin canonical file name +# Find out sftp server plugin canonical filename # my $sftpsrv = find_sftpsrv(); if(!$sftpsrv) { @@ -304,7 +304,7 @@ logmsg "sftp server plugin found $sftpsrv\n" if($verbose); #*************************************************************************** -# Find out sftp client canonical file name +# Find out sftp client canonical filename # my $sftp = find_sftp(); if(!$sftp) { @@ -315,7 +315,7 @@ logmsg "sftp client found $sftp\n" if($verbose); #*************************************************************************** -# Find out ssh keygen canonical file name +# Find out ssh keygen canonical filename # my $sshkeygen = find_sshkeygen(); if(!$sshkeygen) { @@ -326,7 +326,7 @@ logmsg "ssh keygen found $sshkeygen\n" if($verbose); #*************************************************************************** -# Find out ssh client canonical file name +# Find out ssh client canonical filename # my $ssh = find_ssh(); if(!$ssh) { @@ -406,7 +406,7 @@ if((! -e pp($hstprvkeyf)) || (! -s pp($hstprvkeyf)) || (! -e pp($hstpubsha256f)) || (! -s pp($hstpubsha256f)) || (! -e pp($cliprvkeyf)) || (! -s pp($cliprvkeyf)) || (! -e pp($clipubkeyf)) || (! -s pp($clipubkeyf))) { - # Make sure all files are gone so ssh-keygen doesn't complain + # Make sure all files are gone so ssh-keygen does not complain unlink(pp($hstprvkeyf), pp($hstpubkeyf), pp($hstpubmd5f), pp($hstpubsha256f), pp($cliprvkeyf), pp($clipubkeyf)); @@ -435,7 +435,7 @@ if((! -e pp($hstprvkeyf)) || (! -s pp($hstprvkeyf)) || exit 1; } display_file_top(pp($cliprvkeyf)) if($verbose); - # Make sure that permissions are restricted so openssh doesn't complain + # Make sure that permissions are restricted so openssh does not complain chmod 0600, pp($hstprvkeyf); chmod 0600, pp($cliprvkeyf); if(($^O eq 'cygwin' || $^O eq 'msys') && -e "/bin/setfacl") { @@ -1207,7 +1207,7 @@ if($sshdid =~ /OpenSSH-Windows/) { # Put an "exec" in front of the command so that the child process # keeps this child's process ID by being tied to the spawned shell. - exec("exec $cmd") || die "Can't exec() $cmd: $!"; + exec("exec $cmd") || die "Cannot exec() $cmd: $!"; # exec() will create a new process, but ties the existence of the # new process to the parent waiting perl.exe and sh.exe processes. diff --git a/tests/test1119.pl b/tests/test1119.pl index 45196926c3..48d080bc7a 100755 --- a/tests/test1119.pl +++ b/tests/test1119.pl @@ -47,7 +47,7 @@ if(!$rc) { $Cpreprocessor = 'cpp'; } -# we may get the dir root pointed out +# we may get the directory root pointed out my $root=$ARGV[0] || "."; # need an include directory when building out-of-tree @@ -93,7 +93,7 @@ sub scanheader { sub scanallheaders { my $d = "$root/include/curl"; opendir(my $dh, $d) || - die "Can't opendir: $!"; + die "Cannot opendir: $!"; my @headers = grep { /.h\z/ } readdir($dh); closedir $dh; foreach my $h (@headers) { @@ -126,7 +126,7 @@ sub checkmanpage { sub scanman_md_dir { my ($d) = @_; opendir(my $dh, $d) || - die "Can't opendir: $!"; + die "Cannot opendir: $!"; my @mans = grep { /.md\z/ } readdir($dh); closedir $dh; for my $m (@mans) { @@ -197,7 +197,7 @@ for my $e (sort @syms) { # now scan through all symbols that were present in the symbols-in-versions # but not in the headers # -# If the symbols were marked 'removed' in symbols-in-versions we don't output +# If the symbols were marked 'removed' in symbols-in-versions we do not output # anything about it since that is perfectly fine. # diff --git a/tests/test1132.pl b/tests/test1132.pl index e808c2e8c8..966bd09a48 100755 --- a/tests/test1132.pl +++ b/tests/test1132.pl @@ -72,10 +72,10 @@ sub scanfile { } else { if(!$memdebug) { - print STDERR "$file doesn't include \"memdebug.h\"!\n"; + print STDERR "$file does not include \"memdebug.h\"!\n"; } if(!$curlmem) { - print STDERR "$file doesn't include \"curl_memory.h\"!\n"; + print STDERR "$file does not include \"curl_memory.h\"!\n"; } return 1; } @@ -83,7 +83,7 @@ sub scanfile { return 0; } -opendir(my $dh, $dir) || die "can't opendir $dir: $!"; +opendir(my $dh, $dir) || die "cannot opendir $dir: $!"; my @cfiles = grep { /\.c\z/ && -f "$dir/$_" } readdir($dh); closedir $dh; diff --git a/tests/test1135.pl b/tests/test1135.pl index b64e4bf8a8..15982e659d 100755 --- a/tests/test1135.pl +++ b/tests/test1135.pl @@ -28,7 +28,7 @@ use warnings; my $sort = 0; -# we may get the dir root pointed out +# we may get the directory root pointed out my $root = shift @ARGV; while(defined $root) { diff --git a/tests/test1139.pl b/tests/test1139.pl index e2eb8946eb..bfe636578f 100755 --- a/tests/test1139.pl +++ b/tests/test1139.pl @@ -34,14 +34,14 @@ # src/tool_getparam.c lists all options curl can parse # docs/curl.1 documents all command line options # src/tool_listhelp.c outputs all options with curl -h -# - make sure they're all in sync +# - make sure they are all in sync # # Output all deviances to stderr. use strict; use warnings; -# we may get the dir roots pointed out +# we may get the directory roots pointed out my $root=$ARGV[0] || "."; my $buildroot=$ARGV[1] || "."; my $syms = "$root/docs/libcurl/symbols-in-versions"; @@ -126,7 +126,7 @@ while(<$r>) { } elsif($rem) { # $opt was removed in $rem - # so don't check for that + # so do not check for that } else { if($type eq "OPT") { diff --git a/tests/test1165.pl b/tests/test1165.pl index a15071c256..654a2ad642 100755 --- a/tests/test1165.pl +++ b/tests/test1165.pl @@ -37,7 +37,7 @@ my %file; # the DISABLE options that are documented my %docs; -# we may get the dir root pointed out +# we may get the directory root pointed out my $root=$ARGV[0] || "."; my $DOCS="CURL-DISABLE.md"; @@ -54,7 +54,7 @@ sub scanconf { } sub scan_configure { - opendir(my $m, "$root/m4") || die "Can't opendir $root/m4: $!"; + opendir(my $m, "$root/m4") || die "Cannot opendir $root/m4: $!"; my @m4 = grep { /\.m4$/ } readdir($m); closedir $m; scanconf("$root/configure.ac"); @@ -105,7 +105,7 @@ sub scan_file { sub scan_dir { my ($dir)=@_; - opendir(my $dh, $dir) || die "Can't opendir $dir: $!"; + opendir(my $dh, $dir) || die "Cannot opendir $dir: $!"; my @cfiles = grep { /\.[ch]\z/ && -f "$dir/$_" } readdir($dh); closedir $dh; for my $f (sort @cfiles) { diff --git a/tests/test1167.pl b/tests/test1167.pl index e2965b784a..1bcaedddcd 100755 --- a/tests/test1167.pl +++ b/tests/test1167.pl @@ -55,7 +55,7 @@ if($ARGV[0] eq "-v") { shift; } -# we may get the dir root pointed out +# we may get the directory root pointed out my $root=$ARGV[0] || "."; # need an include directory when building out-of-tree @@ -77,7 +77,7 @@ sub scanenums { while() { my ($line, $linenum) = ($_, $.); if(/^#(line|) (\d+) \"(.*)\"/) { - # if the included file isn't in our incdir, then we skip this section + # if the included file is not in our incdir, then we skip this section # until next #line # if($3 !~ /^$incdir/) { @@ -135,7 +135,7 @@ sub scanheader { } -opendir(my $dh, $incdir) || die "Can't opendir $incdir: $!"; +opendir(my $dh, $incdir) || die "Cannot opendir $incdir: $!"; my @hfiles = grep { /\.h$/ } readdir($dh); closedir $dh; diff --git a/tests/test1173.pl b/tests/test1173.pl index 19bcd1af8c..493ce37ca7 100755 --- a/tests/test1173.pl +++ b/tests/test1173.pl @@ -31,10 +31,10 @@ use strict; use warnings; use File::Basename; -# get the file name first +# get the filename first my $symbolsinversions=shift @ARGV; -# we may get the dir roots pointed out +# we may get the directory roots pointed out my @manpages=@ARGV; my $errors = 0; @@ -119,7 +119,7 @@ sub checkref { } } -# option-looking words that aren't options +# option-looking words that are not options my %allownonref = ( 'CURLINFO_TEXT' => 1, 'CURLINFO_HEADER_IN' => 1, @@ -148,7 +148,7 @@ sub scanmanpage { open(my $m, "<", "$file") || die "test1173.pl could not open $file"; if($file =~ /[\/\\](CURL|curl_)([^\/\\]*).3/) { - # This is a man page for libcurl. It requires an example unless it's + # This is a man page for libcurl. It requires an example unless it is # considered deprecated. $reqex = 1 unless defined $deprecated{'CURL'.$2}; if($1 eq "CURL") { @@ -372,7 +372,7 @@ sub scanmanpage { allsymbols(); if(!$symbol{'CURLALTSVC_H1'}) { - print STDERR "didn't get the symbols-in-version!\n"; + print STDERR "did not get the symbols-in-version!\n"; exit; } diff --git a/tests/test1175.pl b/tests/test1175.pl index 2e67142613..54e0a1fe76 100755 --- a/tests/test1175.pl +++ b/tests/test1175.pl @@ -26,7 +26,7 @@ use strict; use warnings; -# we may get the dir root pointed out +# we may get the directory root pointed out my $root = $ARGV[0] || "."; my %error; # from the include file diff --git a/tests/test1222.pl b/tests/test1222.pl index 8186d63511..6aebc9646a 100755 --- a/tests/test1222.pl +++ b/tests/test1222.pl @@ -259,8 +259,8 @@ if(!glob("$libdocdir/*.3")) { exit 0; } -# Get header file names, -opendir(my $dh, $incdir) || die "Can't opendir $incdir"; +# Get header filenames, +opendir(my $dh, $incdir) || die "Cannot opendir $incdir"; my @hfiles = grep { /\.h$/ } readdir($dh); closedir $dh; diff --git a/tests/test1477.pl b/tests/test1477.pl index 44a0f90200..2ce5d8e89b 100755 --- a/tests/test1477.pl +++ b/tests/test1477.pl @@ -29,7 +29,7 @@ use strict; use warnings; -# we may get the dir roots pointed out +# we may get the directory roots pointed out my $root=$ARGV[0] || "."; my $buildroot=$ARGV[1] || "."; my $manpge = "$buildroot/docs/libcurl/libcurl-errors.3"; @@ -79,7 +79,7 @@ sub scanmanpage { } -opendir(my $dh, $curlh) || die "Can't opendir $curlh: $!"; +opendir(my $dh, $curlh) || die "Cannot opendir $curlh: $!"; my @hfiles = grep { /\.h$/ } readdir($dh); closedir $dh; diff --git a/tests/test1486.pl b/tests/test1486.pl index f679261061..05006ebc63 100755 --- a/tests/test1486.pl +++ b/tests/test1486.pl @@ -26,7 +26,7 @@ use strict; use warnings; -# we may get the dir root pointed out +# we may get the directory root pointed out my $root=$ARGV[0] || "."; my %insrc; # variable set in source diff --git a/tests/test1488.pl b/tests/test1488.pl index 1994f93bee..3d67908195 100755 --- a/tests/test1488.pl +++ b/tests/test1488.pl @@ -48,7 +48,7 @@ if(!$rc) { $Cpreprocessor = 'cpp'; } -# we may get the dir root pointed out +# we may get the directory root pointed out my $root=$ARGV[0] || "."; # need an include directory when building out-of-tree @@ -98,7 +98,7 @@ sub checkmanpage { sub scanman_md_dir { my ($d) = @_; opendir(my $dh, $d) || - die "Can't opendir: $!"; + die "Cannot opendir: $!"; my @mans = grep { /.md\z/ } readdir($dh); closedir $dh; for my $m (@mans) { diff --git a/tests/test745.pl b/tests/test745.pl index 4395eb9681..766496f238 100755 --- a/tests/test745.pl +++ b/tests/test745.pl @@ -26,7 +26,7 @@ use strict; use warnings; -# we may get the dir root pointed out +# we may get the directory root pointed out my $root=$ARGV[0] || "."; my %typecheck; # from the include file diff --git a/tests/test971.pl b/tests/test971.pl index b7046ac678..a0b900282b 100755 --- a/tests/test971.pl +++ b/tests/test971.pl @@ -24,7 +24,7 @@ ########################################################################### # # - Get all options mentioned in the $cmddir. -# - Make sure they're all mentioned in the $opts document +# - Make sure they are all mentioned in the $opts document # - Make sure that the version in $opts matches the version in the file in # $cmddir # @@ -45,7 +45,7 @@ my $error = 0; sub cmdfiles { my ($dir)=@_; - opendir(my $dh, $dir) || die "Can't opendir $dir: $!"; + opendir(my $dh, $dir) || die "Cannot opendir $dir: $!"; my @opts = grep { /[a-z0-9].*\.md$/ && -f "$dir/$_" } readdir($dh); closedir $dh; diff --git a/tests/testcurl.pl b/tests/testcurl.pl index 4f3eade703..109272da3f 100755 --- a/tests/testcurl.pl +++ b/tests/testcurl.pl @@ -33,8 +33,8 @@ # at a regular interval. The output is suitable to be mailed to # curl-autocompile@haxx.se to be dealt with automatically (make sure the # subject includes the word "autobuild" as the mail gets silently discarded -# otherwise). The most current build status (with a reasonable backlog) will -# be published on the curl site, at https://curl.se/auto/ +# otherwise). The most current build status (with a reasonable backlog) is +# published on the curl site, at https://curl.se/auto/ # USAGE: # testcurl.pl [options] [curl-daily-name] > output @@ -49,12 +49,12 @@ # --mktarball=[command] Command to run after completed test # --name=[name] Set name to report as # --notes=[notes] More human-readable information about this configuration -# --nocvsup Don't pull from git even though it is a git tree -# --nogitpull Don't pull from git even though it is a git tree -# --nobuildconf Don't run autoreconf -fi -# --noconfigure Don't run configure +# --nocvsup Do not pull from git even though it is a git tree +# --nogitpull Do not pull from git even though it is a git tree +# --nobuildconf Do not run autoreconf -fi +# --noconfigure Do not run configure # --runtestopts=[options] Options to pass to runtests.pl -# --setup=[file name] File name to read setup from (deprecated) +# --setup=[filename] Filename to read setup from (deprecated) # --target=[your os] Specify your target environment. # # if [curl-daily-name] is omitted, a 'curl' git directory is assumed. @@ -66,7 +66,7 @@ use warnings; use Cwd; use File::Spec; -# Turn on warnings (equivalent to -w, which can't be used with /usr/bin/env) +# Turn on warnings (equivalent to -w, which cannot be used with /usr/bin/env) #BEGIN { $^W = 1; } use vars qw($version $fixed $infixed $CURLDIR $git $pwd $build $buildlog @@ -84,7 +84,7 @@ $runtestopts=''; $version='2024-11-28'; $fixed=0; -# Determine if we're running from git or a canned copy of curl, +# Determine if we are running from git or a canned copy of curl, # or if we got a specific target option or setup file option. $CURLDIR="curl"; if(-f ".git/config") { @@ -362,7 +362,7 @@ logit "date = $timestamp"; # When the test build starts $str1066os = undef; -# Make $pwd to become the path without newline. We'll use that in order to cut +# Make $pwd to become the path without newline. We use that in order to cut # off that path from all possible logs and error messages etc. $pwd = getcwd(); @@ -374,14 +374,14 @@ if(-d $CURLDIR) { # remove the generated sources to force them to be re-generated each # time we run this test unlink "$CURLDIR/src/tool_hugehelp.c"; - # find out if curl source dir has an in-tree c-ares repo + # find out if curl source directory has an in-tree c-ares repo $have_embedded_ares = 1 if(-f "$CURLDIR/ares/GIT-INFO"); } elsif(!$git && -f "$CURLDIR/tests/testcurl.pl") { logit "$CURLDIR is verified to be a fine daily source dir"; - # find out if curl source dir has an in-tree c-ares extracted tarball + # find out if curl source directory has an in-tree c-ares extracted tarball $have_embedded_ares = 1 if(-f "$CURLDIR/ares/ares_build.h"); } else { - mydie "$CURLDIR is not a daily source dir or checked out from git!" + mydie "$CURLDIR is not a daily source directory or checked out from git!" } } @@ -399,13 +399,13 @@ rmtree "buildlog-*"; # this is to remove old build logs that ended up in the wrong dir foreach(glob("$CURLDIR/buildlog-*")) { unlink $_; } -# create a dir to build in +# create a directory to build in mkdir $build, 0777; if(-d $build) { - logit "build dir $build was created fine"; + logit "build directory $build was created fine"; } else { - mydie "failed to create dir $build"; + mydie "failed to create directory $build"; } # get in the curl source tree root @@ -500,7 +500,7 @@ if($git) { } } -# Set timestamp to the one in curlver.h if this isn't a git test build. +# Set timestamp to the one in curlver.h if this is not a git test build. if((-f "include/curl/curlver.h") && (open(my $f, "<", "include/curl/curlver.h"))) { while(<$f>) { @@ -548,7 +548,7 @@ sub findinpath { my $make = findinpath("gmake", "make", "nmake"); if(!$make) { - mydie "Couldn't find make in the PATH"; + mydie "Could not find make in the PATH"; } # force to 'nmake' for VC builds $make = "nmake" if($targetos =~ /vc/); @@ -564,10 +564,10 @@ if($configurebuild) { if(-f "lib/Makefile") { logit "configure seems to have finished fine"; } else { - mydie "configure didn't work"; + mydie "configure did not work"; } } else { - logit "copying files to build dir ..."; + logit "copying files to build directory ..."; if($^O eq 'MSWin32') { system("xcopy /s /q \"$CURLDIR\" ."); } @@ -777,7 +777,7 @@ else { close($log); chdir "$pwd/$build"; } - logit_spaced "cross-compiling, can't run tests"; + logit_spaced "cross-compiling, cannot run tests"; } # dummy message to feign success print "TESTDONE: 1 tests out of 0 (dummy message)\n"; diff --git a/tests/testutil.pm b/tests/testutil.pm index 35fe4bd633..6317a5e931 100644 --- a/tests/testutil.pm +++ b/tests/testutil.pm @@ -183,7 +183,7 @@ sub subnewlines { } else { if(($$thing =~ /^\n\z/) && $prevupdate) { - # if there's a blank link after a line we update, we hope it is + # if there is a blank link after a line we update, we hope it is # the empty line following headers $$thing =~ s/\x0a/\x0d\x0a/; } diff --git a/tests/tftpserver.pl b/tests/tftpserver.pl index 862d21cd13..bb96bb743e 100755 --- a/tests/tftpserver.pl +++ b/tests/tftpserver.pl @@ -104,7 +104,7 @@ while(@ARGV) { $verbose = 1; } else { - print STDERR "\nWarning: tftpserver.pl unknown parameter: $ARGV[0]\n"; + print STDERR "\nWarning: tftpserver.pl unknown parameter: '$ARGV[0]'\n"; } shift @ARGV; } diff --git a/tests/unit/README.md b/tests/unit/README.md index 80e2c5c469..190821b33b 100644 --- a/tests/unit/README.md +++ b/tests/unit/README.md @@ -47,7 +47,7 @@ For the actual C file, here's a simple example: ~~~c #include "unitcheck.h" - #include "a libcurl header.h" /* from the lib dir */ + #include "a libcurl header.h" /* from the lib directory */ static CURLcode test_unit9998(const char *arg) { @@ -68,7 +68,7 @@ Here's an example using optional initialization and cleanup: ~~~c #include "unitcheck.h" - #include "a libcurl header.h" /* from the lib dir */ + #include "a libcurl header.h" /* from the lib directory */ static CURLcode t9999_setup(void) { diff --git a/tests/unit/unit1300.c b/tests/unit/unit1300.c index a5ddf11f49..77fb1fb386 100644 --- a/tests/unit/unit1300.c +++ b/tests/unit/unit1300.c @@ -127,7 +127,7 @@ static CURLcode test_unit1300(const char *arg) fail_unless(Curl_node_elem(Curl_node_next(Curl_llist_head(&llist))) == &unusedData_case2, "the node next to head is not getting set correctly"); - /* better safe than sorry, check that the tail isn't corrupted */ + /* better safe than sorry, check that the tail is not corrupted */ fail_unless(Curl_node_elem(Curl_llist_tail(&llist)) != &unusedData_case2, "the list tail is not getting set correctly"); diff --git a/tests/unit/unit1303.c b/tests/unit/unit1303.c index b02cb3abad..03673c544e 100644 --- a/tests/unit/unit1303.c +++ b/tests/unit/unit1303.c @@ -47,7 +47,7 @@ static void t1303_stop(struct Curl_easy *easy) } /* BASE is just a define to make us fool around with decently large number so - that we aren't zero-based */ + that we are not zero-based */ #define BASE 1000000 /* macro to set the pretended current time */ diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index 248adb99c2..d5fcf5c6b1 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -186,13 +186,13 @@ static CURLcode test_unit1307(const char *arg) { "[[:foo:]]", "bar", NOMATCH|MAC_FAIL}, { "[[:foo:]]", "f]", MATCH|LINUX_NOMATCH|MAC_FAIL}, - { "Curl[[:blank:]];-)", "Curl ;-)", MATCH }, + { "curl[[:blank:]];-)", "curl ;-)", MATCH }, { "*[[:blank:]]*", " ", MATCH }, { "*[[:blank:]]*", "", NOMATCH }, { "*[[:blank:]]*", "hi, im_Pavel", MATCH }, /* common using */ - { "filename.dat", "filename.dat", MATCH }, + { "Filename.dat", "Filename.dat", MATCH }, { "*curl*", "lets use curl!!", MATCH }, { "filename.txt", "filename.dat", NOMATCH }, { "*.txt", "text.txt", MATCH }, diff --git a/tests/unit/unit1605.c b/tests/unit/unit1605.c index a092ff1639..8b1ec447ca 100644 --- a/tests/unit/unit1605.c +++ b/tests/unit/unit1605.c @@ -54,10 +54,10 @@ static CURLcode test_unit1605(const char *arg) char *esc; esc = curl_easy_escape(easy, "", -1); - fail_unless(esc == NULL, "negative string length can't work"); + fail_unless(esc == NULL, "negative string length cannot work"); esc = curl_easy_unescape(easy, "%41%41%41%41", -1, &len); - fail_unless(esc == NULL, "negative string length can't work"); + fail_unless(esc == NULL, "negative string length cannot work"); UNITTEST_END(t1605_stop(easy)) } diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c index dda6769782..089caa1c45 100644 --- a/tests/unit/unit1607.c +++ b/tests/unit/unit1607.c @@ -66,7 +66,7 @@ static CURLcode test_unit1607(const char *arg) /* CURLOPT_RESOLVE address parsing tests */ static const struct testcase tests[] = { - /* spaces aren't allowed, for now */ + /* spaces are not allowed, for now */ { "test.com:80:127.0.0.1, 127.0.0.2", "test.com", 80, TRUE, { NULL, } }, diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c index 26934d89bf..00164617f5 100644 --- a/tests/unit/unit1609.c +++ b/tests/unit/unit1609.c @@ -85,7 +85,7 @@ static CURLcode test_unit1609(const char *arg) }; static const struct testcase tests[] = { - /* spaces aren't allowed, for now */ + /* spaces are not allowed, for now */ { "test.com:80:127.0.0.1", "test.com", 80, { "127.0.0.1", } }, diff --git a/tests/unit/unit1652.c b/tests/unit/unit1652.c index 0b3337f688..d90dea36d4 100644 --- a/tests/unit/unit1652.c +++ b/tests/unit/unit1652.c @@ -37,7 +37,7 @@ static char output[4096]; /* * This debugf callback is simply dumping the string into the static buffer - * for the unit test to inspect. Since we know that we're only dealing with + * for the unit test to inspect. Since we know that we are only dealing with * text we can afford the luxury of skipping the type check here. */ static int debugf_cb(CURL *handle, curl_infotype type, char *buf, size_t size, diff --git a/tests/unit/unit1653.c b/tests/unit/unit1653.c index 1e6fd9ef26..714b52a8e6 100644 --- a/tests/unit/unit1653.c +++ b/tests/unit/unit1653.c @@ -173,7 +173,7 @@ static CURLcode test_unit1653(const char *arg) free_and_clear(ipv6port); curl_url_cleanup(u); - /* Incorrect zone index syntax, but the port extractor doesn't care */ + /* Incorrect zone index syntax, but the port extractor does not care */ u = curl_url(); if(!u) goto fail; diff --git a/tests/unit/unit1654.c b/tests/unit/unit1654.c index d2144fc214..c16a9ebfd6 100644 --- a/tests/unit/unit1654.c +++ b/tests/unit/unit1654.c @@ -119,13 +119,13 @@ static CURLcode test_unit1654(const char *arg) ALPN_h2, "6.example.net", 80); fail_if(res, "Curl_altsvc_parse(9) failed!"); - /* missing port in host name */ + /* missing port in hostname */ res = Curl_altsvc_parse(curl, asi, "h2=\"example.net\"; ma=\"180\";\r\n", ALPN_h2, "7.example.net", 80); fail_if(res, "Curl_altsvc_parse(10) failed!"); - /* illegal port in host name */ + /* illegal port in hostname */ res = Curl_altsvc_parse(curl, asi, "h2=\"example.net:70000\"; ma=\"180\";\r\n", ALPN_h2, "8.example.net", 80); diff --git a/tests/unit/unit1655.c b/tests/unit/unit1655.c index 8b49fb32f8..ab42b971ef 100644 --- a/tests/unit/unit1655.c +++ b/tests/unit/unit1655.c @@ -23,7 +23,7 @@ ***************************************************************************/ #include "unitcheck.h" -#include "doh.h" /* from the lib dir */ +#include "doh.h" static CURLcode test_unit1655(const char *arg) { diff --git a/tests/unit/unit1658.c b/tests/unit/unit1658.c index 3273c2141a..d60fa96b8f 100644 --- a/tests/unit/unit1658.c +++ b/tests/unit/unit1658.c @@ -23,7 +23,7 @@ ***************************************************************************/ #include "unitcheck.h" -#include "doh.h" /* from the lib dir */ +#include "doh.h" /* DoH + HTTPSRR are required */ #if !defined(CURL_DISABLE_DOH) && defined(USE_HTTPSRR) diff --git a/tests/unit/unit2603.c b/tests/unit/unit2603.c index 5915555f8b..a8ed09f1c2 100644 --- a/tests/unit/unit2603.c +++ b/tests/unit/unit2603.c @@ -51,6 +51,7 @@ static void check_eq(const char *s, const char *exp_s, const char *name) struct tcase { const char **input; const char *default_scheme; + const char *custom_method; const char *method; const char *scheme; const char *authority; @@ -74,7 +75,7 @@ static void parse_success(const struct tcase *t) buflen = strlen(buf); in_len += buflen; nread = Curl_h1_req_parse_read(&p, buf, buflen, t->default_scheme, - 0, &err); + t->custom_method, 0, &err); if(nread < 0) { curl_mfprintf(stderr, "got err %d parsing: '%s'\n", err, buf); fail("error consuming"); @@ -122,10 +123,10 @@ static CURLcode test_unit2603(const char *arg) NULL, }; static const struct tcase TEST1a = { - T1_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 0 + T1_INPUT, NULL, NULL, "GET", NULL, NULL, "/path", 1, 0 }; static const struct tcase TEST1b = { - T1_INPUT, "https", "GET", "https", NULL, "/path", 1, 0 + T1_INPUT, "https", NULL, "GET", "https", NULL, "/path", 1, 0 }; static const char *T2_INPUT[] = { @@ -136,7 +137,7 @@ static CURLcode test_unit2603(const char *arg) NULL, }; static const struct tcase TEST2 = { - T2_INPUT, NULL, "GET", NULL, NULL, "/path", 1, 8 + T2_INPUT, NULL, NULL, "GET", NULL, NULL, "/path", 1, 8 }; static const char *T3_INPUT[] = { @@ -145,7 +146,7 @@ static CURLcode test_unit2603(const char *arg) NULL, }; static const struct tcase TEST3a = { - T3_INPUT, NULL, "GET", "ftp", "ftp.curl.se", "/xxx?a=2", 2, 0 + T3_INPUT, NULL, NULL, "GET", "ftp", "ftp.curl.se", "/xxx?a=2", 2, 0 }; static const char *T4_INPUT[] = { @@ -155,7 +156,7 @@ static CURLcode test_unit2603(const char *arg) NULL, }; static const struct tcase TEST4a = { - T4_INPUT, NULL, "CONNECT", NULL, "ftp.curl.se:123", NULL, 3, 2 + T4_INPUT, NULL, NULL, "CONNECT", NULL, "ftp.curl.se:123", NULL, 3, 2 }; static const char *T5_INPUT[] = { @@ -165,7 +166,7 @@ static CURLcode test_unit2603(const char *arg) NULL, }; static const struct tcase TEST5a = { - T5_INPUT, NULL, "OPTIONS", NULL, NULL, "*", 2, 3 + T5_INPUT, NULL, NULL, "OPTIONS", NULL, NULL, "*", 2, 3 }; static const char *T6_INPUT[] = { @@ -173,7 +174,19 @@ static CURLcode test_unit2603(const char *arg) NULL, }; static const struct tcase TEST6a = { - T6_INPUT, NULL, "PUT", NULL, NULL, "/path", 1, 3 + T6_INPUT, NULL, NULL, "PUT", NULL, NULL, "/path", 1, 3 + }; + + /* test a custom method with space, #19543 */ + static const char *T7_INPUT[] = { + "IN SANE /path HTTP/1.1\r\nContent-Length: 0\r\n\r\n", + NULL, + }; + static const struct tcase TEST7a = { + T7_INPUT, NULL, NULL, "IN", NULL, NULL, "SANE /path", 1, 0 + }; + static const struct tcase TEST7b = { + T7_INPUT, NULL, "IN SANE", "IN SANE", NULL, NULL, "/path", 1, 0 }; parse_success(&TEST1a); @@ -183,6 +196,8 @@ static CURLcode test_unit2603(const char *arg) parse_success(&TEST4a); parse_success(&TEST5a); parse_success(&TEST6a); + parse_success(&TEST7a); + parse_success(&TEST7b); #endif UNITTEST_END_SIMPLE diff --git a/tests/util.py b/tests/util.py index 8ed8c89267..3982f2b671 100755 --- a/tests/util.py +++ b/tests/util.py @@ -23,9 +23,6 @@ # """Module for extracting test data from the test data folder and other utils.""" -from __future__ import (absolute_import, division, print_function, - unicode_literals) - import logging import os import re @@ -69,7 +66,7 @@ class TestData(object): self.data_folder = data_folder def get_test_data(self, test_number): - # Create the test file name + # Create the test filename filename = os.path.join(self.data_folder, "test{0}".format(test_number)) @@ -80,9 +77,9 @@ class TestData(object): m = REPLY_DATA.search(contents) if not m: - raise Exception("Couldn't find a section") + raise Exception("Could not find a section") - # Left-strip the data so we don't get a newline before our data. + # Left-strip the data so we do not get a newline before our data. return m.group(1).lstrip()