]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
21 months agotest574: add a timeout to the test
Dan Fandrich [Fri, 29 Sep 2023 19:28:57 +0000 (12:28 -0700)] 
test574: add a timeout to the test

This one hangs occasionally, so this will speed up a test run and allow
logs to be seen when it does.

Closes #12025

21 months agotests: propagate errors in libtests
Dan Fandrich [Fri, 29 Sep 2023 23:32:48 +0000 (16:32 -0700)] 
tests: propagate errors in libtests

Use the test macros to automatically propagate some errors, and check
and log others while running the tests. This can help in debugging
exactly why a test has failed.

21 months agotests: set --expect100-timeout to improve test reliability
Dan Fandrich [Fri, 29 Sep 2023 22:27:21 +0000 (15:27 -0700)] 
tests: set --expect100-timeout to improve test reliability

On an overloaded server, the default 1 second timeout can go by without
the test server having a chance to respond with the expected headers,
causing tests to fail. Increase the 1 second timeout to 99 seconds so
this failure mode is no longer a problem on test 1129. Some other tests
already set a high value, but make them consistently 99 seconds so if
something goes wrong the test is stalled for less time.

Ref: #11328

21 months agoCI: ignore the "flaky" and "timing-dependent" test results in CMake
Dan Fandrich [Fri, 29 Sep 2023 19:06:30 +0000 (12:06 -0700)] 
CI: ignore the "flaky" and "timing-dependent" test results in CMake

This was already done for automake builds but CMake builds were missed.
Test 1086 actually causes the test harness to crash with:

Warning: unable to close filehandle DWRITE properly: Broken pipe at C:/projects/curl/tests/ftpserver.pl line 527

Rather than fix it now, this change leaves test 1086 entirely skipped on
those builds that show this problem.

Follow-up to 589dca761

Ref: #11865

21 months agocmake: improve OpenLDAP builds
Viktor Szakats [Tue, 3 Oct 2023 18:17:37 +0000 (18:17 +0000)] 
cmake: improve OpenLDAP builds

- cmake: detect OpenLDAP based on function `ldap_init_fd`.
  autotools does this. autotools also publishes this detection result
  in `HAVE_LDAP_INIT_FD`. We don't mimic that with CMake as the source
  doesn't use this value. (it might need to be remove-listed in
  `scripts/cmp-config.pl` for future OpenLDAP test builds.)
  This also deletes existing self-declaration method via the
  CMake-specific `CURL_USE_OPENLDAP` configuration.

- cmake: define `LDAP_DEPRECATED=1` for OpenLDAP.
  Like autotools does. This fixes a long list of these warnings:
  ```
  /usr/local/opt/openldap/include/ldap.h:1049:5: warning: 'LDAP_DEPRECATED' is not defined, evaluates to 0 [-Wundef]
  ```

- cmake: delete LDAP TODO comment no longer relevant.

Also:

- autotools: replace domain name `dummy` with `0.0.0.0` in LDAP feature
  detection functions.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12024

21 months agocmake: fix unity builds for more build combinations
Viktor Szakats [Tue, 3 Oct 2023 21:18:01 +0000 (21:18 +0000)] 
cmake: fix unity builds for more build combinations

By using unique static function/variable names in source files
implementing these interfaces.

- OpenLDAP combined with any SSH backend.

- MultiSSL with mbedTLS, OpenSSL, wolfSSL, SecureTransport.

Closes #12027

21 months agotests: remove leading spaces from some tags
Daniel Stenberg [Wed, 4 Oct 2023 09:35:54 +0000 (11:35 +0200)] 
tests: remove leading spaces from some tags

The threee tags `<name>`, `</name>` and `<command>` were frequently used
with a leading space that this removes. The reason this habbit is so
widespread in testcases is probably that they have been copy and pasted.

Hence, fixing them all now might curb this practice from now on.

Closes #12028

21 months agoGHA: bump actions/checkout
Viktor Szakats [Tue, 3 Oct 2023 21:58:26 +0000 (21:58 +0000)] 
GHA: bump actions/checkout

Follow-up to 2e0fa50fc16b9339f51e0a7bfff0352829323acb #11964
Follow-up to c39585d9b7ef3cbfc1380812dec60e7b275b6af3 #12000

Closes #12023

21 months agospelling: fix codespell 2.2.6 typos
Viktor Szakats [Tue, 3 Oct 2023 14:44:13 +0000 (14:44 +0000)] 
spelling: fix codespell 2.2.6 typos

Closes #12019

21 months agoGHA: add workflow to compare configure vs cmake outputs
Daniel Stenberg [Wed, 27 Sep 2023 11:35:03 +0000 (13:35 +0200)] 
GHA: add workflow to compare configure vs cmake outputs

Uses scripts/cmp-config.pl two compare two curl_config.h files,
presumbly generated with configure and cmake. It displays the
differences and filters out a lot of known lines we ignore.

The script also shows the matches that were *not* used. Possibly
subjects for removal.

Closes #11964

21 months agoappveyor: enable test 571
Daniel Stenberg [Tue, 3 Oct 2023 12:25:52 +0000 (14:25 +0200)] 
appveyor: enable test 571

Follow-up from 8a940fd55c175f7 / #12013

Closes #12017

21 months agobuild: alpha-sort source files for lib and src
Viktor Szakats [Tue, 3 Oct 2023 09:38:02 +0000 (09:38 +0000)] 
build: alpha-sort source files for lib and src

Closes #12014

21 months agocmake: delete old `HAVE_LDAP_URL_PARSE` logic
Viktor Szakats [Tue, 3 Oct 2023 10:36:27 +0000 (10:36 +0000)] 
cmake: delete old `HAVE_LDAP_URL_PARSE` logic

Left there by accident after adding proper detection for this.

Follow-up to 772f0d8edf1c3c2745543f42388ccec5a16ee2c0 #12006

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12015

21 months agotests: increase lib571 timeout from 3s to 30s
Stefan Eissing [Tue, 3 Oct 2023 09:06:27 +0000 (11:06 +0200)] 
tests: increase lib571 timeout from 3s to 30s

- 3s is too short for our CI, making this test fail occasionally
- test usually experiences no delay run locally, so 30s wont hurt

Closes #12013

21 months agocmake: fix unity with Windows Unicode + TrackMemory
Viktor Szakats [Tue, 3 Oct 2023 02:27:05 +0000 (02:27 +0000)] 
cmake: fix unity with Windows Unicode + TrackMemory

Found the root cause of the startup crash in unity builds with Unicode
and TrackMemory enabled at the same time.

We must make sure that the `memdebug.h` header doesn't apply to
`lib/curl_multibyte.c` (as even noted in a comment there.) In unity
builds all headers apply to all sources, including `curl_multibyte.c`.
This probably resulted in an infinite loop on startup.

Exclude this source from unity compilation with TrackMemory enabled,
in both libcurl and curl tool. Enable unity mode for a debug Unicode
CI job to keep it tested. Also delete the earlier workaround that
fully disabled unity for affected builds.

Follow-up to d82b080f6374433ce7c98241329189ad2d3976f8 #12005
Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719 #11095

Closes #11928

21 months agocmake: disable unity mode with Windows Unicode + TrackMemory
Viktor Szakats [Mon, 2 Oct 2023 01:03:43 +0000 (01:03 +0000)] 
cmake: disable unity mode with Windows Unicode + TrackMemory

"TrackMemory" is `ENABLE_DEBUG=ON` (aka `ENABLE_CURLDEBUG=ON`,
aka `-DCURLDEBUG`).

There is an issue with memory tracking and Unicode when built in "unity"
mode, which results in the curl tool crashing right on startup, even
without any command-line option. Interestingly this doesn't happen under
WINE (at least on the system I tested this on), but consistenly happens
on real Windows machines. Crash is 0xC0000374 heap corruption. Both
shared and static curl executables are affected.

This limitation probably won't hit too many people, but it remains
a TODO to find and fix the root cause and drop this workaround.

Example builds and runs:
https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/17cptxhtpubd7iwj#L313 (static)
https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/76e1ge758tbyqu9c#L317 (shared)

Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719 #11095

Ref: #11928
Closes #12005

21 months agocmake: tidy-up `NOT_NEED_LBER_H` detection
Viktor Szakats [Mon, 2 Oct 2023 22:56:02 +0000 (22:56 +0000)] 
cmake: tidy-up `NOT_NEED_LBER_H` detection

Follow-up to 772f0d8edf1c3c2745543f42388ccec5a16ee2c0 #12006

21 months agoappveyor: rewrite batch in PowerShell + CI improvements
Viktor Szakats [Sun, 1 Oct 2023 17:32:59 +0000 (17:32 +0000)] 
appveyor: rewrite batch in PowerShell + CI improvements

1. Rewrite in PowerShell:

- rewrite MS-DOS batch build script in PowerShell.
- move some bash operations into native PowerShell.
- fixups for PowerShell insisting on failure when a command outputs
  something to stderr.
- fix to actually run `curl -V` after every build.
  (and exclude ARM64 builds.)
- also say why we skipped `curl -V` if we had to skip.
- fix CMake warnings about unused configuration variables, by adapting
  these dynamically for build cases.
- dedupe OpenSSL path into a variable.
- disable `test1451` failing with a warning anyway due to missing python
  impacket. (after trying and failing to install impacket)
  PowerShell promotes these warnings to errors by PowerShell. We can also
  suppress they wholesale if they start causing issues in the future,
  like we already to with `autoreconf` and `./configure`.

PowerShell is better than MS-DOS batches, so the hope is this makes it
easier to extend and maintain the AppVeyor build logic. POSIX/bash isn't
supported inline by AppVeyor on Windows build machines, but we are okay
to keep it in an external script, so it's also an option.

2. CI improvements:

- enable tests for a "unity" build job.
- speed-up CI initialization by using shallow clones of the curl repo.
- speed-up CMake MSVC jobs with `TrackFileAccess=false`.
- enable parallelism in `VisualStudioSolution` builds.
- display CMake version before builds.
- always show the CPU in job names.
- tell which jobs are build-only in job names.
- move `TESTING:` value next to `DISABLED_TESTS:` in two jobs.
- add `config.log` (autotools) to dumped logs (need to enable manually).

3. Style:

- use single-quotes in YAML like we do in other CI YAML files.
  It also allows to drop quoting characters and lighter to write/read.
  (keep double quotes for PowerShell strings needing expansion.)

Closes #11999

21 months agocmake: fix `HAVE_LDAP_SSL`, `HAVE_LDAP_URL_PARSE` on non-Windows
Viktor Szakats [Mon, 2 Oct 2023 09:57:14 +0000 (09:57 +0000)] 
cmake: fix `HAVE_LDAP_SSL`, `HAVE_LDAP_URL_PARSE` on non-Windows

- set `HAVE_LDAP_URL_PARSE` if `ldap_url_parse` function exists.
  Before this patch we set it based it on the presence of `stricmp`,
  which correctly enabled it on e.g. Windows, but was inaccurate for
  other platforms.

- always set `HAVE_LDAP_SSL` if an LDAP backend is detected and
  LDAPS is not explicitly disabled. This mimics autotools behaviour.
  Previously we set it only for Windows LDAP. After this fix, LDAPS is
  correctly enabled in default macOS builds.

- enable LDAP[S] for a CMake macOS CI job. Target OS X 10.9 (Mavericks)
  to avoid deprecation warnings for LDAP API.

- always detect `HAVE_LDAP_SSL_H`, even with LDAPS explicitly disabled.
  This doesn't make much sense, but let's do it to sync behaviour with
  autotools.

- fix benign typo in variable name.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12006

21 months agoautotools: restore `HAVE_IOCTL_*` detections
Viktor Szakats [Mon, 2 Oct 2023 11:24:14 +0000 (11:24 +0000)] 
autotools: restore `HAVE_IOCTL_*` detections

This restores `CURL_CHECK_FUNC_IOCTL` detection. I deleted it in
4d73854462f30948acab12984b611e9e33ee41e6 and
c3456652a0c72d1845d08df9769667db7e159949 (2022-08), because the
`HAVE_IOCTL` result it generated was unused in the source. But,
I did miss the fact that this had two dependent checks:
`CURL_CHECK_FUNC_IOCTL_FIONBIO`,
`CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR` that we do actually need:
`HAVE_IOCTL_FIONBIO`, `HAVE_IOCTL_SIOCGIFADDR`.

Regression from 4d73854462f30948acab12984b611e9e33ee41e6

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12008

21 months agoRELEASE-PROCEDURE.md: updated coming release dates
Daniel Stenberg [Mon, 2 Oct 2023 11:31:51 +0000 (13:31 +0200)] 
RELEASE-PROCEDURE.md: updated coming release dates

21 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 2 Oct 2023 07:41:33 +0000 (09:41 +0200)] 
RELEASE-NOTES: synced

21 months agocmake: pre-cache `HAVE_POLL_FINE` on Windows
Viktor Szakats [Sun, 1 Oct 2023 13:13:28 +0000 (13:13 +0000)] 
cmake: pre-cache `HAVE_POLL_FINE` on Windows

Windows doesn't support `poll()`, so we can safely skip checking for
fine poll.

Closes #12003

21 months agogha: bump actions to latest versions
Viktor Szakats [Sat, 30 Sep 2023 15:34:53 +0000 (15:34 +0000)] 
gha: bump actions to latest versions

- actions@checkout@v4 (from v3 and v2)

- fsfe/reuse-action@v2 (from v1)

Closes #12000

22 months agoh2: testcase and fix for pausing h2 streams
Stefan Eissing [Fri, 29 Sep 2023 12:17:08 +0000 (14:17 +0200)] 
h2: testcase and fix for pausing h2 streams

- refs #11982 where it was noted that paused transfers may
  close successfully without delivering the complete data
- made sample poc into tests/http/client/h2-pausing.c and
  added test_02_27 to reproduce

Closes #11989
Fixes #11982
Reported-by: Harry Sintonen
22 months agocmake: validate `CURL_DEFAULT_SSL_BACKEND` config value
Viktor Szakats [Sat, 30 Sep 2023 11:13:27 +0000 (11:13 +0000)] 
cmake: validate `CURL_DEFAULT_SSL_BACKEND` config value

Before this patch CMake builds accepted any value and it was used at
runtime as-is. This patch make sure that the selected default backend
is also enabled in the build. It also enforces a full lowercase value.

This improves reproducibility and brings CMake in sync with autotools
which already worked like described above.

Follow-up to 26c7feb8b9d51a57fab3325571b4bbfa03b11af0 #11774

Closes #11998

22 months agoautotools: adjust `CURL_CA_PATH` value to CMake
Viktor Szakats [Sat, 30 Sep 2023 10:55:15 +0000 (10:55 +0000)] 
autotools: adjust `CURL_CA_PATH` value to CMake

autotools was using the same value as CMake, but with an ending
slash. Delete the ending slash to match configurations.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11997

22 months agocmake: detect `sys/wait.h` and `netinet/udp.h`
Viktor Szakats [Sat, 30 Sep 2023 10:35:26 +0000 (10:35 +0000)] 
cmake: detect `sys/wait.h` and `netinet/udp.h`

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11996

22 months agolib: provide and use Curl_hexencode
Daniel Stenberg [Fri, 29 Sep 2023 16:06:49 +0000 (18:06 +0200)] 
lib: provide and use Curl_hexencode

Generates a lower case ASCII hex output from a binary input.

Closes #11990

22 months agoconfigure: check for the capath by default
Daniel Stenberg [Fri, 29 Sep 2023 10:57:32 +0000 (12:57 +0200)] 
configure: check for the capath by default

... if the chosen TLS backend supports it: OpenSSL, GnuTLS, mbedTLS or wolfSSL

cmake: synced

Assisted-by: Viktor Szakats
Closes #11987

22 months agowolfssl: ignore errors in CA path
Daniel Stenberg [Fri, 29 Sep 2023 10:58:43 +0000 (12:58 +0200)] 
wolfssl: ignore errors in CA path

The default wolfSSL_CTX_load_verify_locations() function is quite picky
with the certificates it loads and will for example return error if just
one of the certs has expired.

With the *_ex() function and its WOLFSSL_LOAD_FLAG_IGNORE_ERR flag, it
behaves more similar to what OpenSSL does by default.

Even the set of default certs on my Debian unstable has several expired
ones.

Assisted-by: Juliusz Sosinowicz
Assisted-by: Michael Osipov
Closes #11987

22 months agocreate-dirs.d: clarify it also uses --output-dirs
Daniel Stenberg [Fri, 29 Sep 2023 21:53:07 +0000 (23:53 +0200)] 
create-dirs.d: clarify it also uses --output-dirs

Reported-by: Robert Simpson
Fixes #11991
Closes #11995

22 months agoappveyor: fix yamlint issues, indent
Viktor Szakats [Fri, 29 Sep 2023 18:47:08 +0000 (18:47 +0000)] 
appveyor: fix yamlint issues, indent

Also:
- use double quotes in all batch if statements.

Closes #11994

22 months agocmake: detect `HAVE_CLOCK_GETTIME_MONOTONIC_RAW`
Viktor Szakats [Fri, 29 Sep 2023 02:20:44 +0000 (02:20 +0000)] 
cmake: detect `HAVE_CLOCK_GETTIME_MONOTONIC_RAW`

Based on existing autotools logic.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11981

22 months agocmake: detect `HAVE_GETADDRINFO_THREADSAFE`
Viktor Szakats [Fri, 29 Sep 2023 00:38:06 +0000 (00:38 +0000)] 
cmake: detect `HAVE_GETADDRINFO_THREADSAFE`

Based on existing autotools logic.

autotools checks for old versions of the allowlisted target OSes and
disables this feature when seeing them. In CMake we assume we're running
on newer systems and enable regardless of OS version.

autotools always runs all 3 probes for non-fast-tracked systems and
enables this feature if any one of them was successful. To save
configuration time,  CMake stops at the first successful check.

OpenBSD is not fast-tracked and then gets blocklisted as a generic BSD
system. I haven't double-checked if this is correct, but looks odd.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11979

22 months agocmake: fix `HAVE_WRITABLE_ARGV` detection
Viktor Szakats [Thu, 28 Sep 2023 22:52:02 +0000 (22:52 +0000)] 
cmake: fix `HAVE_WRITABLE_ARGV` detection

Move detection before the creation of detection results in
`curl_config.h`.

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #11978

22 months agoappveyor: minor improvements
Viktor Szakats [Thu, 28 Sep 2023 13:56:06 +0000 (13:56 +0000)] 
appveyor: minor improvements

- run `curl -V` after builds to see if they run and with what features.
  Except for one job where a CRT DLL is missing. And ARM64 which should
  fail, but is silently not launched instead.

- copy libcurl DLL next to curl tool and tests binaries in shared mode.
  This makes it possible to run the tests. (We don't run tests after
  these builds yet.)

- list the DLLs and EXEs present after the builds.

- add `DEBUG` variable for CMake builds to allow disabling it, for
  testing non-debug builds. (currently enabled for all)

- add commented lines that dump CMake configuration logs for debugging
  build/auto-detection issues.

- add gcc version to jobs where missing.

- switch a job to the native MSYS2 mingw-w64 toolchain. This adds gcc 9
  to the build mix.

- make `SHARED=OFF` and `OPENSSL=OFF` defaults global.

- delete a duplicate backslash.

Closes #11976

22 months agoconfigure: replace adhoc domain with `localhost` in tests
Viktor Szakats [Fri, 29 Sep 2023 12:01:17 +0000 (12:01 +0000)] 
configure: replace adhoc domain with `localhost` in tests

Reviewed-by: Daniel Stenberg
Closes #11988

22 months agotidy-up: use more example domains
Viktor Szakats [Fri, 29 Sep 2023 15:42:39 +0000 (15:42 +0000)] 
tidy-up: use more example domains

Also make use of the example TLD:
https://en.wikipedia.org/wiki/.example

Reviewed-by: Daniel Stenberg
Closes #11992

22 months agoruntests: display the test status if tests appear hung
Dan Fandrich [Thu, 28 Sep 2023 17:41:50 +0000 (10:41 -0700)] 
runtests: display the test status if tests appear hung

It sometimes happens that a test hangs during a test run and never
returns. The test harness will wait indefinitely for the results and on
CI servers the CI job will eventually be killed after an hour or two.
At the end of a test run, if results haven't come in within a couple of
minutes, display the status of all test runners and what tests they're
running to help in debugging the problem.

This feature is really only kick in with parallel testing enabled, which
is fine because without parallel testing it's usually easy to tell what
test has hung.

Closes #11980

22 months agogithub/labeler: remove workaround for labeler
Dan Fandrich [Fri, 29 Sep 2023 01:45:35 +0000 (18:45 -0700)] 
github/labeler: remove workaround for labeler

This was added due to what seemed to be a bug regarding the sync-labels:
config option, but it looks like it wasn't necessary.

Follow-up to b2b0534e7

22 months agodocs: upgrade an URL to HTTPS in `BINDINGS.md` [ci skip]
Viktor Szakats [Fri, 29 Sep 2023 12:15:35 +0000 (12:15 +0000)] 
docs: upgrade an URL to HTTPS in `BINDINGS.md` [ci skip]

22 months agodocs: replace made up domains with example.com
Daniel Stenberg [Fri, 29 Sep 2023 08:17:03 +0000 (10:17 +0200)] 
docs: replace made up domains with example.com

in FAQ and MANUAL.md

- example.com was made for this purpose.

- reduces the risk that one of those domains suddenly start hosting
  something nasty and we provide links to them

Closes #11986

22 months agoacinclude.m4: Document proper system truststore on FreeBSD
Michael Osipov [Fri, 29 Sep 2023 08:15:08 +0000 (10:15 +0200)] 
acinclude.m4: Document proper system truststore on FreeBSD

The default system truststore on FreeBSD has been /etc/ssl/certs for many
years now. It is managed canonically through certctl(8) and contains hashed
symlinks for OpenSSL and other TLS providers.
The previous ones require security/ca_root_nss which might not be installed or
will not contain any custom CA certificates.

Closes #11985

22 months agoFAQ: How do I upgrade curl.exe in Windows?
Daniel Stenberg [Fri, 29 Sep 2023 07:36:59 +0000 (09:36 +0200)] 
FAQ: How do I upgrade curl.exe in Windows?

This is a growing question, better answer it here to get somewhere to
point users to.

Closes #11984

22 months agocmake: pre-cache `HAVE_BASENAME` for mingw-w64 and MSVC
Viktor Szakats [Thu, 28 Sep 2023 11:50:43 +0000 (11:50 +0000)] 
cmake: pre-cache `HAVE_BASENAME` for mingw-w64 and MSVC

`basename` is present in mingw-w64, missing from MSVC. Pre-cache
accordingly to make configure faster.

Notice that `basename` has a bug so we later disable it even with
mingw-w64:
https://github.com/curl/curl/blob/781242ffa44a9f9b95b6da5ac5a1bf6372ec6257/lib/curl_setup.h#L820-L825

Closes #11974

22 months agocmake: add missing checks
Daniel Stenberg [Wed, 27 Sep 2023 11:37:43 +0000 (13:37 +0200)] 
cmake: add missing checks

- check for arc4random. To make rand.c use it accordingly.
- check for fcntl
- fix fseek detection
- add SIZEOF_CURL_SOCKET_T
- fix USE_UNIX_SOCKETS
- define HAVE_SNPRINTF to 1
- check for fnmatch
- check for sched_yield
- remove HAVE_GETPPID duplicate from curl_config.h
- add HAVE_SENDMSG

Ref: #11964

Co-authored-by: Viktor Szakats
Closes #11973

22 months agoconfigure: remove unused checks
Daniel Stenberg [Wed, 27 Sep 2023 11:35:46 +0000 (13:35 +0200)] 
configure: remove unused checks

- for sys/uio.h
- for fork
- for connect

Ref: #11964

Closes #11973

22 months agolib: remove TIME_WITH_SYS_TIME
Daniel Stenberg [Thu, 28 Sep 2023 11:57:07 +0000 (13:57 +0200)] 
lib: remove TIME_WITH_SYS_TIME

It is not used in any code anywhere.

Ref: #11964
Closes #11975

22 months agodocs: update curl man page references
Daniel Stenberg [Wed, 27 Sep 2023 09:36:03 +0000 (11:36 +0200)] 
docs: update curl man page references

Detected by the manpage-syntax update

Closes #11963

22 months agomanpage-syntax: verify curl man page references
Daniel Stenberg [Wed, 27 Sep 2023 09:33:45 +0000 (11:33 +0200)] 
manpage-syntax: verify curl man page references

1. References to curl symbols are now checked that they indeed exist as
   man pages. This for \f references as well as the names referenced in the
   SEE ALSO section.

   Allowlist curl.1 since it is not always built in builds

2. References to curl symbols that lack section now causes warning, since that
   will prevent them from getting linked properly

3. Check for "bare" references to curl functions and warn, they should be
   references

Closes #11963

22 months agocmake: add check for suseconds_t
Daniel Stenberg [Thu, 28 Sep 2023 16:29:42 +0000 (18:29 +0200)] 
cmake: add check for suseconds_t

And fix the HAVE_LONGLONG define

Ref: #11964
Closes #11977

22 months agotidy-up: whitespace fixes
Viktor Szakats [Thu, 28 Sep 2023 11:04:57 +0000 (11:04 +0000)] 
tidy-up: whitespace fixes

Closes #11972

22 months agocmake: detect TLS-SRP in OpenSSL/wolfSSL/GnuTLS
Viktor Szakats [Wed, 27 Sep 2023 13:40:54 +0000 (13:40 +0000)] 
cmake: detect TLS-SRP in OpenSSL/wolfSSL/GnuTLS

With new option `CURL_DISABLE_SRP=ON` to force-disable it.
To match existing option and detection logic in autotools.

Also:
- fix detecting GnuTLS.
  We assume `nettle` as a GnuTLS dependency.
- add CMake GnuTLS CI job.
- bump AppVeyor CMake OpenSSL MSVC job to OpenSSL 1.1.1 (from 1.0.2)
  TLS-SRP fails to detect with 1.0.2 due to an OpenSSL header bug.
- fix compiler warning when building with GnuTLS and disabled TLS-SRP.
- fix comment typos, whitespace.

Ref: #11964

Closes #11967

22 months agotool: use our own stderr variable
Viktor Szakats [Thu, 28 Sep 2023 10:50:07 +0000 (10:50 +0000)] 
tool: use our own stderr variable

Earlier this year we changed our own stderr variable to use the standard
name `stderr` (to avoid bugs where someone is using `stderr` instead of
the curl-tool specific variable). This solution needed to override the
standard `stderr` symbol via the preprocessor. This in turn didn't play
well with unity builds and caused curl tool to crash or stay silent due
to an uninitialized stderr. This was a hard to find issue, fixed by
manually breaking out one file from the unity sources.

To avoid two these two tricks, this patch implements a different
solution: Restore using our own local variable for our stderr output and
leave `stderr` as-is. To avoid using `stderr` by mistake, add a
`checksrc` rule (based on logic we already used in lib for `strerror`)
that detects any `stderr` use in `src` and points to using our own
variable instead: `tool_stderr`.

Follow-up to 06133d3e9b8aeb9e9ca0b3370c246bdfbfc8619e
Follow-up to 2f17a9b654121dd1ecf4fc043c6d08a9da3522db

Closes #11958

22 months agoconnect: only start the happy eyeballs timer when needed
Loïc Yhuel [Mon, 25 Sep 2023 15:03:40 +0000 (17:03 +0200)] 
connect: only start the happy eyeballs timer when needed

The timeout is only used when there is a second address family, for the
delayed eyeballer.

Closes #11939

22 months agotool_operate: free 'gateway' correctly
Daniel Stenberg [Thu, 28 Sep 2023 07:32:39 +0000 (09:32 +0200)] 
tool_operate: free 'gateway' correctly

Pointed out by Coverity. The fix in 93885cf3a8d4e was incomplete.

Also removed repeated wording in IPFS related error messages.

Closes #11969

22 months agolib: move handling of `data->req.writer_stack` into Curl_client_write()
Stefan Eissing [Wed, 20 Sep 2023 09:59:16 +0000 (11:59 +0200)] 
lib: move handling of `data->req.writer_stack` into Curl_client_write()

- move definitions from content_encoding.h to sendf.h
- move create/cleanup/add code into sendf.c
- installed content_encoding writers will always be called
  on Curl_client_write(CLIENTWRITE_BODY)
- Curl_client_cleanup() frees writers and tempbuffers from
  paused transfers, irregardless of protocol

Closes #11908

22 months agomulti: round the timeout up to prevent early wakeups
Loïc Yhuel [Mon, 25 Sep 2023 19:55:29 +0000 (21:55 +0200)] 
multi: round the timeout up to prevent early wakeups

Curl_timediff rounds down to the millisecond, so curl_multi_perform can
be called too early, then we get a timeout of 0 and call it again.

The code already handled the case of timeouts which expired less than
1ms in the future.  By rounding up, we make sure we will never ask the
platform to wake up too early.

Closes #11938

22 months agoRELEASE-NOTES: spell out that IPFS is via gateway
Daniel Stenberg [Thu, 28 Sep 2023 07:49:43 +0000 (09:49 +0200)] 
RELEASE-NOTES: spell out that IPFS is via gateway

22 months agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 28 Sep 2023 07:42:52 +0000 (09:42 +0200)] 
RELEASE-NOTES: synced

22 months agotool_operate: avoid strlen() -1 on zero length content from file
Daniel Stenberg [Wed, 27 Sep 2023 08:27:07 +0000 (10:27 +0200)] 
tool_operate: avoid strlen() -1 on zero length content from file

Follow-up to 65b563a96a226649ba12cb1e

Closes #11959

22 months agotool_operate: fix memory mixups
Daniel Stenberg [Wed, 27 Sep 2023 07:51:46 +0000 (09:51 +0200)] 
tool_operate: fix memory mixups

Switch to plain getenv() from curl_getenv() to avoid the allocation and
having to keep track of which free() or curl_free() that need to be
used.

Coverity found issues and a memory leak.

Follow-up to 65b563a96a226649ba12cb1e

Closes #11959

22 months agocurl-functions.m4: fixup recent bad edits
Viktor Szakats [Wed, 27 Sep 2023 12:47:35 +0000 (12:47 +0000)] 
curl-functions.m4: fixup recent bad edits

Follow-up to 96c29900bcec32dd6bc8e9857c8871ff4b8b8ed9 #11940

Closes #11966

22 months agocurl-functions.m4: fix include line
Daniel Stenberg [Wed, 27 Sep 2023 12:10:30 +0000 (14:10 +0200)] 
curl-functions.m4: fix include line

This made the getaddrinfo detection fail, but we did not spot it in the
CI because it graciously falled back to using legacy functions instead!

Follow-up to 96c29900bcec (#11940)

Closes #11965

22 months agoinet_ntop: add typecast to silence Coverity
Daniel Stenberg [Wed, 27 Sep 2023 08:04:40 +0000 (10:04 +0200)] 
inet_ntop: add typecast to silence Coverity

CID 1024653:  Integer handling issues  (SIGN_EXTENSION)

Suspicious implicit sign extension: "src[i]" with type "unsigned char
const" (8 bits, unsigned) is promoted in "src[i] << (1 - i % 2 << 3)" to
type "int" (32 bits, signed), then sign-extended to type "unsigned long"
(64 bits, unsigned).  If "src[i] << (1 - i % 2 << 3)" is greater than
0x7FFFFFFF, the upper bits of the result will all be 1.

111         words[i/2] |= (src[i] << ((1 - (i % 2)) << 3));

The value will not be greater than 0x7FFFFFFF so this still cannot
happen.

Also, switch to ints here instead of longs. The values stored are 16 bit
so at least no need to use 64 bit variables. Also, longs are 32 bit on
some platforms so this logic still needs to work with 32 bits.

Closes #11960

22 months agodocs: adapt SEE ALSO sections to new requirements
Daniel Stenberg [Tue, 26 Sep 2023 21:25:11 +0000 (23:25 +0200)] 
docs: adapt SEE ALSO sections to new requirements

To please manpage-syntax.pl used by test 1173

Closes #11957

22 months agomanpage-syntax.pl: verify SEE ALSO syntax
Daniel Stenberg [Tue, 26 Sep 2023 07:54:14 +0000 (09:54 +0200)] 
manpage-syntax.pl: verify SEE ALSO syntax

- Enforce a single reference per .BR line
- Skip the quotes around the section number for example (3)
- Insist on trailing commas on all lines except the last
- Error on comma on the last SEE ALSO entry

- List the entries alpha-sorted, not enforced just recommended

Closes #11957

22 months agoconnect: expire the timeout when trying next
Daniel Stenberg [Mon, 25 Sep 2023 13:59:38 +0000 (15:59 +0200)] 
connect: expire the timeout when trying next

... so that it gets called again immediately and can continue trying
addresses to connect to. Otherwise it might unnecessarily wait for a
while there.

Fixes #11920
Reported-by: Loïc Yhuel
Closes #11935

22 months agohttp: remove wrong comment for http_should_fail
Daniel Stenberg [Mon, 25 Sep 2023 21:01:15 +0000 (23:01 +0200)] 
http: remove wrong comment for http_should_fail

Reported-by: Christian Schmitz
Ref: #11936
Closes #11941

22 months agotool_setopt: remove unused function tool_setopt_flags
Dan Fandrich [Mon, 25 Sep 2023 21:41:15 +0000 (14:41 -0700)] 
tool_setopt: remove unused function tool_setopt_flags

This function is identical to tool_setopt_bitmask except that it treats
the argument as unsigned.

Closes #11943

22 months agocmake: add feature checks for `memrchr` and `getifaddrs`
Viktor Szakats [Mon, 25 Sep 2023 22:35:26 +0000 (22:35 +0000)] 
cmake: add feature checks for `memrchr` and `getifaddrs`

- `HAVE_MEMRCHR` for `memrchr`.
- `HAVE_GETIFADDRS` for `getifaddrs`.
  This was present in `lib/curl_config.h.cmake` but missed the detection
  logic.

To match existing autotools feature checks.

Closes #11954

22 months agocmake: move global headers to specific checks
Viktor Szakats [Mon, 25 Sep 2023 22:35:26 +0000 (22:35 +0000)] 
cmake: move global headers to specific checks

Before this patch we added standard headers unconditionally to the
global list of headers used for feature checks. This is unnecessary
and also doesn't help CMake 'Generate' performance. This patch moves
these headers to each feature check where they are actually needed.
Stop using `stddef.h`, as it seems unnecessary.

I've used autotools' `m4/curl-functions.m4` to figure out these
dependencies.

Also delete checking for the C89 standard header `time.h`, that I
missed in the earlier commit.

Ref: 96c29900bcec32dd6bc8e9857c8871ff4b8b8ed9 #11940

Closes #11951

22 months agosrc/mkhelp: make generated code pass `checksrc`
Viktor Szakats [Tue, 26 Sep 2023 17:08:26 +0000 (17:08 +0000)] 
src/mkhelp: make generated code pass `checksrc`

Closes #11955

22 months agotests: show which curl tool `runtests.pl` is using
Viktor Szakats [Tue, 26 Sep 2023 11:02:08 +0000 (11:02 +0000)] 
tests: show which curl tool `runtests.pl` is using

To help debugging when there is issue finding or running it.

Closes #11953

22 months agoCI/azure: make `MAKEFLAGS` global to parallelize all jobs
Viktor Szakats [Tue, 26 Sep 2023 11:24:02 +0000 (11:24 +0000)] 
CI/azure: make `MAKEFLAGS` global to parallelize all jobs

https://dev.azure.com/daniel0244/curl/_build/results?buildId=17528 (before)
https://dev.azure.com/daniel0244/curl/_build/results?buildId=17545 (after, with -j3)

Closes #11952

22 months agoCI/azure: migrate old mingw MSYS1 jobs to MSYS2
Viktor Szakats [Tue, 26 Sep 2023 03:15:52 +0000 (03:15 +0000)] 
CI/azure: migrate old mingw MSYS1 jobs to MSYS2

Also delete an accidental variable reference.

Follow-up to 38029101e2d78ba125732b3bab6ec267b80a0e72

Closes #11945

22 months agodocs: add see also curl_multi_get_handles to some man pages
Daniel Stenberg [Mon, 25 Sep 2023 21:24:06 +0000 (23:24 +0200)] 
docs: add see also curl_multi_get_handles to some man pages

Assisted-by: Jay Satiro
Closes #11942

22 months agocmake: assume `_fseeki64` and no `fseeko` on Windows
Viktor Szakats [Tue, 26 Sep 2023 09:55:33 +0000 (09:55 +0000)] 
cmake: assume `_fseeki64` and no `fseeko` on Windows

`_fseeki64` is present in mingw-w64 1.0 (2011-09-26) headers, and
at least Watcom C 1.9 (2010) headers and MSVS 2008 [1].

`fseeko` is not present in any of these.

(mingw-w64 1.0 also offers `fseeko64`.)

[1] https://github.com/curl/curl/pull/11944#issuecomment-1734995004

Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918

Closes #11950

22 months agobuild: delete checks for C89 standard headers
Viktor Szakats [Mon, 25 Sep 2023 20:06:44 +0000 (20:06 +0000)] 
build: delete checks for C89 standard headers

Delete checks and guards for standard C89 headers and assume these are
available: `stdio.h`, `string.h`, `time.h`, `setjmp.h`, `stdlib.h`,
`stddef.h`, `signal.h`.

Some of these we already used unconditionally, some others we only used
for feature checks.

Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918 (for `stdio.h` in CMake)

Closes #11940

22 months agomultiif.h: remove Curl_multi_dump declaration
Stefan Eissing [Tue, 26 Sep 2023 07:22:57 +0000 (09:22 +0200)] 
multiif.h: remove Curl_multi_dump declaration

Follow-up to d850eea2 which removed the Curl_multi_dump definition.

Closes https://github.com/curl/curl/pull/11946

22 months agoconfig-win32: define HAVE__FSEEKI64
Jay Satiro [Mon, 25 Sep 2023 22:22:25 +0000 (18:22 -0400)] 
config-win32: define HAVE__FSEEKI64

Follow-up to 9c7165e9 which added an fseeko wrapper to the lib that
calls _fseeki64 if it is available.

Closes https://github.com/curl/curl/pull/11944

22 months agodocs: explain how PINNEDPUBLICKEY is independent of VERIFYPEER
Jay Satiro [Mon, 25 Sep 2023 05:41:20 +0000 (01:41 -0400)] 
docs: explain how PINNEDPUBLICKEY is independent of VERIFYPEER

- Explain that peer verification via CURLOPT_PINNEDPUBLICKEY takes place
  even if peer verification via CURLOPT_SSL_VERIFYPEER is turned off.

The behavior is verified by test2048.

Bug: https://github.com/curl/curl/issues/2935#issuecomment-418371872
Reported-by: claudiusaiz@users.noreply.github.com
Bug: https://github.com/curl/curl/discussions/11910
Reported-by: Hakan Sunay Halil
Closes https://github.com/curl/curl/pull/11930

22 months agoopenssl: improve ssl shutdown handling
Stefan Eissing [Fri, 15 Sep 2023 07:12:52 +0000 (09:12 +0200)] 
openssl: improve ssl shutdown handling

- If SSL shutdown is not finished then make an additional call to
  SSL_read to gather additional tracing.

- Fix http2 and h2-proxy filters to forward do_close() calls to the next
  filter.

For example h2 and SSL shutdown before and after this change:

Before:

Curl_conn_close -> cf_hc_close -> Curl_conn_cf_discard_chain ->
ssl_cf_destroy

After:

Curl_conn_close -> cf_hc_close -> cf_h2_close -> cf_setup_close ->
ssl_cf_close

Note that currently the tracing does not show output on the connection
closure handle. Refer to discussion in #11878.

Ref: https://github.com/curl/curl/discussions/11878

Closes https://github.com/curl/curl/pull/11858

22 months agomulti: fix small timeouts
Loïc Yhuel [Mon, 25 Sep 2023 19:12:42 +0000 (21:12 +0200)] 
multi: fix small timeouts

Since Curl_timediff rounds down to the millisecond, timeouts which
expire in less than 1ms are considered as outdated and removed from the
list. We can use Curl_timediff_us instead, big timeouts could saturate
but this is not an issue.

Closes #11937

22 months agocmake: fix stderr initialization in unity builds
Viktor Szakats [Mon, 25 Sep 2023 01:08:02 +0000 (01:08 +0000)] 
cmake: fix stderr initialization in unity builds

Before this patch, in certain build configurations the curl tool may
not have displayed anything (debug, macOS), or crashed at startup
(debug, Windows).

Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719
Necessary after 2f17a9b654121dd1ecf4fc043c6d08a9da3522db

Closes #11929

22 months agocmake: fix missing `zlib.h` when compiling `libcurltool`
Viktor Szakats [Sun, 24 Sep 2023 18:30:43 +0000 (18:30 +0000)] 
cmake: fix missing `zlib.h` when compiling `libcurltool`

Came up while testing debug/testing build for Windows. I'm not sure why
it didn't come up in earlier tests with similar config.
`tool_hugehelp.c` might indeed require `zlib.h` and without linking
`CURL_LIBS` to the `curltool` target, CMake doesn't seem to add detected
dependency headers to the compiler command.

```
[ 25%] Building C object src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
cd .../curl/bld-cmake-llvm-x64/src && /usr/local/opt/llvm/bin/clang
  --target=x86_64-w64-mingw32 --sysroot=/usr/local/opt/mingw-w64/toolchain-x86_64
  -DCURLDEBUG -DCURL_STATICLIB -DHAVE_CONFIG_H -DUNICODE -DUNITTESTS -D_UNICODE
  -I.../curl/include -I.../curl/lib -I.../curl/bld-cmake-llvm-x64/lib
  -I.../curl/bld-cmake-llvm-x64/include -I.../curl/src -Wno-unused-command-line-argument
  -D_UCRT -DDEBUGBUILD -DHAS_ALPN -DUSE_MANUAL=1  -fuse-ld=lld -Wl,-s -static-libgcc
  -lucrt [...] -O3 -DNDEBUG -municode -MD
  -MT src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
  -MF CMakeFiles/curltool.dir/tool_hugehelp.c.obj.d
  -o CMakeFiles/curltool.dir/tool_hugehelp.c.obj -c .../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c
.../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c:6:10: fatal error: 'zlib.h' file not found
    6 | #include <zlib.h>
      |          ^~~~~~~~
```

Follow-up to 39e7c22bb459c2e818f079984989a26a09741860

Closes #11927

22 months agocmake: fix duplicate symbols when linking tests
Viktor Szakats [Sun, 24 Sep 2023 00:52:57 +0000 (00:52 +0000)] 
cmake: fix duplicate symbols when linking tests

The linker resolves this automatically in non-unity builds. In unity
builds the linker cannot drop a single object with the duplicates,
resulting in these errors. The root issue is that we started including
certain objects both via both libcurlu and libcurltool libs.

Regression from 39e7c22bb459c2e818f079984989a26a09741860

Windows errors:
```
[  3%] Linking C executable unit1303.exe
[  3%] Building C object tests/server/CMakeFiles/rtspd.dir/__/__/lib/curl_multibyte.c.obj
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_UTF8_to_wchar':
C:/projects/curl/lib/curl_multibyte.c:44: multiple definition of `curlx_convert_UTF8_to_wchar'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:44: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_wchar_to_UTF8':
C:/projects/curl/lib/curl_multibyte.c:66: multiple definition of `curlx_convert_wchar_to_UTF8'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:66: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_open':
C:/projects/curl/lib/curl_multibyte.c:92: multiple definition of `curlx_win32_open'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:92: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_fopen':
C:/projects/curl/lib/curl_multibyte.c:120: multiple definition of `curlx_win32_fopen'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:120: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_stat':
[...]
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/48110107/job/nvlhpt9aa4ehny5q#L247

macOS errors:
```
[ 56%] Linking C executable unit1302
duplicate symbol '_curlx_sotouz' in:
    ../../lib/libcurlu.a(unity_0_c.c.o)
    ../../src/libcurltool.a(unity_0_c.c.o)
duplicate symbol '_curlx_sitouz' in:
    ../../lib/libcurlu.a(unity_0_c.c.o)
    ../../src/libcurltool.a(unity_0_c.c.o)
duplicate symbol '_curlx_uztosz' in:
    ../../lib/libcurlu.a(unity_0_c.c.o)
    ../../src/libcurltool.a(unity_0_c.c.o)
[...]
```
with config:
```
  -DCMAKE_UNITY_BUILD=ON \
  -DENABLE_DEBUG=ON -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=-DDEBUGBUILD \
  -DBUILD_SHARED_LIBS=ON \
  -DBUILD_STATIC_LIBS=OFF
```

Closes #11926

22 months agocmake: lib `CURL_STATICLIB` fixes (Windows)
Viktor Szakats [Fri, 22 Sep 2023 10:18:26 +0000 (10:18 +0000)] 
cmake: lib `CURL_STATICLIB` fixes (Windows)

- always define `CURL_STATICLIB` when building libcurl for Windows.

  This disables `__declspec(dllexport)` for exported libcurl symbols.
  In normal mode (hide symbols) these exported symbols are specified
  via `libcurl.def`. When not hiding symbols, all symbols are exported
  by default.

  Regression from 1199308dbc902c52be67fc805c72dd2582520d30

  Fixes #11844

- fix to omit `libcurl.def` when not hiding private symbols.

  Regression from 2ebc74c36a19a1700af394c16855ce144d9878e3

- fix `ENABLED_DEBUG=ON` + shared curl tool Windows builds by also
  omitting `libcurl.def` in this case, and exporting all symbols
  instead. This ensures that a shared curl tool can access all debug
  functions which are not normally exported from libcurl DLL.

- delete `INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB"` for "objects"
  target.

  Follow-up to 2ebc74c36a19a1700af394c16855ce144d9878e3

- delete duplicate `BUILDING_LIBCURL` definitions.

- fix `HIDES_CURL_PRIVATE_SYMBOLS` to not overwrite earlier build settings.

  Follow-up to 1199308dbc902c52be67fc805c72dd2582520d30

Closes #11914

22 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 25 Sep 2023 21:35:49 +0000 (23:35 +0200)] 
RELEASE-NOTES: synced

22 months agotests: fix log directory path in IPFS tests
Dan Fandrich [Mon, 25 Sep 2023 19:37:20 +0000 (12:37 -0700)] 
tests: fix log directory path in IPFS tests

Hard-coding the log directory name fails with parallel tests.

Follow-up to 65b563a96

Ref: #8805

22 months agocurl_multi_get_handles: get easy handles from a multi handle
Daniel Stenberg [Mon, 25 Sep 2023 15:08:41 +0000 (17:08 +0200)] 
curl_multi_get_handles: get easy handles from a multi handle

Closes #11750

22 months agohttp: h1/h2 proxy unification
Stefan Eissing [Wed, 6 Sep 2023 12:43:22 +0000 (14:43 +0200)] 
http: h1/h2 proxy unification

- use shared code for setting up the CONNECT request
  when tunneling, used in HTTP/1.x and HTTP/2 proxying
- eliminate use of Curl_buffer_send() and other manipulations
  of `data->req` or `data->state.ulbuf`

Closes #11808

22 months agolib: use wrapper for curl_mime_data fseek callback
Natanael Copa [Fri, 22 Sep 2023 13:58:49 +0000 (13:58 +0000)] 
lib: use wrapper for curl_mime_data fseek callback

fseek uses long offset which does not match with curl_off_t. This leads
to undefined behavior when calling the callback and caused failure on
arm 32 bit.

Use a wrapper to solve this and use fseeko which uses off_t instead of
long.

Thanks to the nice people at Libera IRC #musl for helping finding this
out.

Fixes #11882
Fixes #11900
Closes #11918

22 months agoconfigure: sort AC_CHECK_FUNCS
Natanael Copa [Mon, 25 Sep 2023 11:03:26 +0000 (13:03 +0200)] 
configure: sort AC_CHECK_FUNCS

No functional changes.

22 months agowarnless: remove unused functions
Daniel Stenberg [Mon, 25 Sep 2023 10:32:07 +0000 (12:32 +0200)] 
warnless: remove unused functions

Previously put there for use with the intel compiler

Closes #11932

22 months agoGHA/linux: run singleuse to detect single-use global functions
Daniel Stenberg [Mon, 25 Sep 2023 07:44:51 +0000 (09:44 +0200)] 
GHA/linux: run singleuse to detect single-use global functions

Use --unit for configure --enable-debug builds

Closes #11932

22 months agosingleuse: add scan for use in other source codes
Daniel Stenberg [Mon, 25 Sep 2023 07:42:12 +0000 (09:42 +0200)] 
singleuse: add scan for use in other source codes

This should reduce false-positive to almost zero. Checks for presence in
unit tests if --unit is specified, which is intended for debug builds
where unit testing is enabled.

Closes #11932

22 months agomulti: remove Curl_multi_dump
Daniel Stenberg [Mon, 25 Sep 2023 07:42:47 +0000 (09:42 +0200)] 
multi: remove Curl_multi_dump

A debug-only function that is basically never used. Removed to ease the
use of the singleuse script to detect non-static functions not used
outside the file where it is defined.

Closes #11931

22 months agotests: fix compiler warnings
Viktor Szakats [Sun, 24 Sep 2023 09:50:39 +0000 (09:50 +0000)] 
tests: fix compiler warnings

Seen with llvm 17 on Windows x64.

```
.../curl/tests/server/rtspd.c:136:13: warning: no previous extern declaration for non-static variable 'logdir' [-Wmissing-variable-declarations]
  136 | const char *logdir = "log";
      |             ^
.../curl/tests/server/rtspd.c:136:7: note: declare 'static' if the variable is not intended to be used outside of this translation unit
  136 | const char *logdir = "log";
      |       ^
.../curl/tests/server/rtspd.c:137:6: warning: no previous extern declaration for non-static variable 'loglockfile' [-Wmissing-variable-declarations]
  137 | char loglockfile[256];
      |      ^
.../curl/tests/server/rtspd.c:137:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
  137 | char loglockfile[256];
      | ^
.../curl/tests/server/fake_ntlm.c:43:13: warning: no previous extern declaration for non-static variable 'logdir' [-Wmissing-variable-declarations]
   43 | const char *logdir = "log";
      |             ^
.../curl/tests/server/fake_ntlm.c:43:7: note: declare 'static' if the variable is not intended to be used outside of this translation unit
   43 | const char *logdir = "log";
      |       ^
.../curl/src/tool_doswin.c:350:8: warning: possible misuse of comma operator here [-Wcomma]
  350 |     ++d, ++s;
      |        ^
.../curl/src/tool_doswin.c:350:5: note: cast expression to void to silence warning
  350 |     ++d, ++s;
      |     ^~~
      |     (void)( )
```

```
.../curl/tests/libtest/lib540.c:146:27: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
  146 |         int itimeout = (L > (long)INT_MAX) ? INT_MAX : (int)L;
      |                         ~ ^ ~~~~~~~~~~~~~
1 warning generated.

.../curl/tests/libtest/libntlmconnect.c:195:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
  195 |       int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
1 warning generated.

.../curl/tests/libtest/lib591.c:117:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
  117 |       int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
1 warning generated.
.../curl/tests/libtest/lib597.c:99:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
   99 |       int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
1 warning generated.
```

Seen on macOS Intel:
```
.../curl/tests/server/sws.c:440:64: warning: field precision should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
          msnprintf(logbuf, sizeof(logbuf), "Got request: %s %.*s HTTP/%d.%d",
                                                             ~~^~
1 warning generated.
```

Closes #11925