]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
17 months agosocketpair: provide `Curl_socketpair` only when `!CURL_DISABLE_SOCKETPAIR`
Andy Pan [Wed, 5 Jun 2024 08:08:15 +0000 (16:08 +0800)] 
socketpair: provide `Curl_socketpair` only when `!CURL_DISABLE_SOCKETPAIR`

Ref: https://curl.se/dev/log.cgi?id=20240605035856-3529577

Reported-by: Marcel Raad
Closes #13888

17 months agonoproxy: test bad ipv6 net size first
Daniel Stenberg [Thu, 6 Jun 2024 20:58:45 +0000 (22:58 +0200)] 
noproxy: test bad ipv6 net size first

No need to parse anything if the size is out of range.

Added some tests to this effect to test 1614.

Closes #13902

17 months agomanagen: warn on excessively long help texts
Daniel Stenberg [Wed, 5 Jun 2024 12:08:02 +0000 (14:08 +0200)] 
managen: warn on excessively long help texts

Help texts at 49 characters or longer get a warning displayed because
they make --help output uglier and we should make an effort to keep the
help texts short and succinct.

The warning is only for display, it does not break the build. That is
left for the future if necessary.

I picked 49 because the longest current text is 48.

Closes #13895

17 months agolib: tidy up types and casts
Viktor Szakats [Sun, 2 Jun 2024 20:30:52 +0000 (22:30 +0200)] 
lib: tidy up types and casts

Cherry-picked from #13489
Closes #13862

17 months agocmdline-opts/ech.md: shorten the help text
Daniel Stenberg [Wed, 5 Jun 2024 11:44:02 +0000 (13:44 +0200)] 
cmdline-opts/ech.md: shorten the help text

To make --help look sensible again

Closes #13894

17 months agocmdline-opts/_PROTOCOLS.md: mention WS(S)
Daniel Stenberg [Wed, 5 Jun 2024 09:08:33 +0000 (11:08 +0200)] 
cmdline-opts/_PROTOCOLS.md: mention WS(S)

Closes #13891

17 months agoGHA: disable TFTP and WebSockets tests in old-mingw-w64
Viktor Szakats [Wed, 5 Jun 2024 10:35:59 +0000 (12:35 +0200)] 
GHA: disable TFTP and WebSockets tests in old-mingw-w64

Follow-up to 03bd16e5339b069aa9409b75fcab2b21fd3a4b16 #13860
Follow-up to def7d05382743ea7aa1d356d1e41dcb22ecdd4d7

17 months agocmdline-opts/fail.md: expand and clarify
Daniel Stenberg [Wed, 5 Jun 2024 08:52:29 +0000 (10:52 +0200)] 
cmdline-opts/fail.md: expand and clarify

Closes #13890

17 months agodoh-insecure.md: expand
Daniel Stenberg [Wed, 5 Jun 2024 08:18:21 +0000 (10:18 +0200)] 
doh-insecure.md: expand

Closes #13889

17 months agocmdline: expand proxy option explanations
Daniel Stenberg [Wed, 5 Jun 2024 08:10:47 +0000 (10:10 +0200)] 
cmdline: expand proxy option explanations

- do less references to other options
- provide more specific text about proxies
- added more see-also references

Closes #13887

17 months agocmdline-opts: expand the parallel explanations
Daniel Stenberg [Wed, 5 Jun 2024 07:34:32 +0000 (09:34 +0200)] 
cmdline-opts: expand the parallel explanations

Closes #13886

17 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 5 Jun 2024 07:09:17 +0000 (09:09 +0200)] 
RELEASE-NOTES: synced

17 months agovtls: new io_need flags for poll handling
Stefan Eissing [Tue, 4 Jun 2024 12:00:12 +0000 (14:00 +0200)] 
vtls: new io_need flags for poll handling

- decouple need to recv/send from negotiation state, we need
  this later in shutdown handling as well
- move ssl enums from urldata.h to vtls_int.h
- implement use of `connssl->io_need` in vtls.c. and all backends

Closes #13879

17 months agocfilters: make Curl_conn_connect always assign 'done'
Daniel Stenberg [Wed, 5 Jun 2024 06:31:11 +0000 (08:31 +0200)] 
cfilters: make Curl_conn_connect always assign 'done'

It could return error without assigning it, and we have a caller in
multi.c that assumes it gets set.

Spotted by CodeSonar
Closes #13884

17 months agoCURLOPT_INTERFACE.md: quote the less-than and larger-than
Daniel Stenberg [Wed, 5 Jun 2024 06:29:50 +0000 (08:29 +0200)] 
CURLOPT_INTERFACE.md: quote the less-than and larger-than

Fixes the warnings shown on stderr.

Follow-up from 3060557af702dd5

Closes #13883

17 months agocmdline-opts/interface.md: expand the documentation
Daniel Stenberg [Tue, 4 Jun 2024 22:06:28 +0000 (00:06 +0200)] 
cmdline-opts/interface.md: expand the documentation

Explain the syntax it supports.

Closes #13882

17 months agourl: allow DoH transfers to override max connection limit
Daniel Stenberg [Tue, 4 Jun 2024 15:00:05 +0000 (17:00 +0200)] 
url: allow DoH transfers to override max connection limit

When reaching the set maximum limit of allowed connections, allow a new
connection anyway if the transfer is created for the (internal) purpose
of doing a DoH name resolve. Otherwise, unrelated "normal" transfers can
starve out new DoH requests making it impossible to name resolve for new
transfers.

Bug: https://curl.se/mail/lib-2024-06/0001.html
Reported-by: kartatz
Closes #13880

17 months agowindows: fix UWP builds, add GHA job
Viktor Szakats [Mon, 3 Jun 2024 21:06:56 +0000 (23:06 +0200)] 
windows: fix UWP builds, add GHA job

Add new job to test building for UWP (aka `CURL_WINDOWS_APP`).

Fix fallouts when building for UWP:
- rand: do not use `BCryptGenRandom()`.
- cmake: disable using win32 LDAP.
- cmake: disable telnet.
- version_win32: fix code before declaration.
- schannel: disable `HAS_MANUAL_VERIFY_API`.
- schannel: disable `SSLSUPP_PINNEDPUBKEY`
  and make `schannel_checksum()` a stub.
  Ref: e178fbd40a896f2098278ae61e1166c88e7b31d0 #1429
- schannel: make `cert_get_name_string()` a failing stub.
- system_win32: make `Curl_win32_impersonating()` a failing stub.
- system_win32: try to fix `Curl_win32_init()` (untested).
- threads: fix to use `CreateThread()`.
- src: disable searching `PATH` for the CA bundle.
- src: disable bold text support and capability detection.
- src: disable `getfiletime()`/`setfiletime()`.
- tests: make `win32_load_system_library()` a failing stub.
- tests/server/util: make it compile.
- tests/server/sockfilt: make it compile.
- tests/lib3026: fix to use `CreateThread()`.

See individual commits for build error details.

Some of these fixes may have better solutions, and some may not work
as expected. The goal of this patch is to make curl build for UWP.

Closes #13870

17 months agosocket: support binding to interface *AND* IP
Orgad Shaneh [Fri, 17 May 2024 11:44:44 +0000 (14:44 +0300)] 
socket: support binding to interface *AND* IP

Introduce new notation for CURLOPT_INTERFACE / --interface:
ifhost!<interface>!<host>

Binding to an interface doesn't set the address, and an interface can
have multiple addresses.

When binding to an address (without interface), the kernel is free to
choose the route, and it can route through any device that can access
the target address, not necessarily the one with the chosen address.

Moreover, it is possible for different interfaces to have the same IP
address, on which case we need to provide a way to be more specific.

Factor out the parsing part of interface option, and add unit tests:
1663.

Closes #13719

17 months agosocketpair: add `eventfd` and use `SOCK_NONBLOCK` for `socketpair()`
Andy Pan [Sat, 1 Jun 2024 18:26:11 +0000 (02:26 +0800)] 
socketpair: add `eventfd` and use `SOCK_NONBLOCK` for `socketpair()`

Currently, we use `pipe` for `wakeup_create`, which requires ***two***
file descriptors. Furthermore, given its complexity inside, `pipe` is a
bit heavyweight for just a simple event wait/notify mechanism.

`eventfd` would be a more suitable solution for this kind of scenario,
kernel also advocates for developers to use `eventfd` instead of `pipe`
in some simple use cases:

    Applications can use an eventfd file descriptor instead of a pipe
    (see pipe(2) in all cases where a pipe is used simply to signal
    events. The kernel overhead of an eventfd file descriptor is much
    lower than that of a pipe, and only one file descriptor is required
    (versus the two required for a pipe).

This change adds the new backend of `eventfd` for `wakeup_create` and
uses it where available, eliminating the overhead of `pipe`. Also, it
optimizes the `wakeup_create` to eliminate the system calls that make
file descriptors non-blocking by moving the logic of setting
non-blocking flags on file descriptors to `socketpair.c` and using
`SOCK_NONBLOCK` for `socketpair(2)`, `EFD_NONBLOCK` for `eventfd(2)`.

Ref:
https://man7.org/linux/man-pages/man7/pipe.7.html
https://man7.org/linux/man-pages/man2/eventfd.2.html
https://man7.org/linux/man-pages/man2/socketpair.2.html
https://www.gnu.org/software/gnulib/manual/html_node/eventfd.html

Closes #13874

17 months agoci: update github/codeql-action digest to 2e230e8
renovate[bot] [Tue, 4 Jun 2024 15:52:27 +0000 (15:52 +0000)] 
ci: update github/codeql-action digest to 2e230e8

Closes #13881

17 months agoexamples/threaded-ssl: remove locking callback code
Jay Satiro [Sat, 1 Jun 2024 18:41:41 +0000 (14:41 -0400)] 
examples/threaded-ssl: remove locking callback code

- Remove the locking callback code that demonstrates how to meet
  requirements of threading libraries (mainly OpenSSL).

Locking callback code has not been needed for many years. According to
the documentation for OpenSSL and GnuTLS they are thread-safe by design,
assuming support for the underlying OS threading API is built-in.

Ref: https://github.com/curl/curl/pull/13850#issuecomment-2143538458

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

17 months agotests: delete redundant `!MSDOS` guard
Viktor Szakats [Tue, 4 Jun 2024 11:40:13 +0000 (13:40 +0200)] 
tests: delete redundant `!MSDOS` guard

This fix was supposed to be committed earlier, but ended up missing from
the final commit.

Follow-up to e9a7d4a1c8377dbcf9a2d94365f60e3e5dff48f8 #12376
Closes #13878

17 months agolib: fix thread entry point to return `DWORD` on WinCE
Viktor Szakats [Tue, 4 Jun 2024 00:41:26 +0000 (02:41 +0200)] 
lib: fix thread entry point to return `DWORD` on WinCE

We already do this in `tests/server/util.c`:
https://github.com/curl/curl/blob/97e5e37cc8269660bc5d4a1936f10f2390b97c5a/tests/server/util.c#L604-L606
and in `sockfilt.c`, `lib3026.c`.

Before this patch it returned `unsigned int`.

Closes #13877

17 months agosocket: use SOCK_NONBLOCK to eliminate extra system call
Andy Pan [Sun, 2 Jun 2024 06:40:42 +0000 (14:40 +0800)] 
socket: use SOCK_NONBLOCK to eliminate extra system call

Every time function `cf_socket_open()` is called to create a socket,
`curlx_nonblock()` is called to make that socket non-blocking. And
`curlx_nonblock()` will cost us 1 or 2 system calls (2 for `fcntl()`, 1
for `ioctl()`, etc.), meanwhile, tucking `SOCK_NONBLOCK` and
`SOCK_CLOEXEC` into the `type` argument for `socket()` is widely
supported across UNIX-like OS: Linux, *BSD, Solaris, etc. With that
ability, we can save 1 or 2 system calls on each socket.

Another change in this PR is to eliminate the redundant
`curlx_nonblock()` call on the socket in `cf_udp_setup_quic()` as that
socket created by `cf_socket_open()` is already non-blocking.

Ref:
https://man7.org/linux/man-pages/man2/socket.2.html
https://man.freebsd.org/cgi/man.cgi?socket(2)
https://man.dragonflybsd.org/?command=socket&section=2
https://man.netbsd.org/socket.2
https://man.openbsd.org/socket
https://docs.oracle.com/cd/E88353_01/html/E37843/socket-3c.html
https://illumos.org/man/3SOCKET/socket
...

Closes #13855

17 months agoGHA: show cmake error log in Windows and non-native workflows
Viktor Szakats [Tue, 4 Jun 2024 00:46:05 +0000 (02:46 +0200)] 
GHA: show cmake error log in Windows and non-native workflows

CMake configure doesn't fail often, but when it does, it helps to see
its `CMakeFiles/CMakeConfigureLog.yaml` output. This file is present
since CMake v3.26:
  https://cmake.org/cmake/help/v3.26/manual/cmake-configure-log.7.html

(Older CMake versions save similar contend to
`CMakeFiles\CMakeOutput.log` and
`CMakeFiles\CMakeError.log`. This patch doesn't deal with that because
the workflows touched are all running a newer CMake.)

After this patch, we dump the content if cmake fails. Syncing this with
autotools, where we already did that.

Closes #13872

17 months agoGHA: switch a Windows job to UCRT (gcc)
Viktor Szakats [Tue, 4 Jun 2024 09:20:20 +0000 (11:20 +0200)] 
GHA: switch a Windows job to UCRT (gcc)

Cherry-picked from #13870

17 months agocurl-config: revert to backticks to support old target envs
Viktor Szakats [Tue, 4 Jun 2024 02:19:32 +0000 (04:19 +0200)] 
curl-config: revert to backticks to support old target envs

Make an exception for `curl-config` because this script that may be
running on any target system, including old ones, e.g. SunOS 5.10.

Reported-by: Alejandro R. SedeƱo
Ref: https://github.com/curl/curl/pull/13307#issuecomment-2146427358
Follow-up to fa69b41c7790fab86fd363242c81d8ef2e89e183 #13307
Closes #13871

17 months agombedtls: v3.6.0 workarounds
Stefan Eissing [Fri, 31 May 2024 11:01:17 +0000 (13:01 +0200)] 
mbedtls: v3.6.0 workarounds

- add special sauce to disable unwanted peer verification by mbedtls
  when negotiating TLS v1.3
- add special sauce for MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET
  return code on *writing* TLS data. We assume the data had not been
  written and EAGAIN.
- return correct Curl error code when peer verification failed.
- disable test_08_05 with 50 HTTP/1.1 connections, as mbedtls reports a
  memory allocation failed during handshake.
- bump CI mbedtls version to 3.6.0

Fixes #13653
Closes #13838

17 months agognutls: support CA caching
Stefan Eissing [Mon, 27 May 2024 14:50:15 +0000 (16:50 +0200)] 
gnutls: support CA caching

- similar to openssl, use a shared 'credentials' instance
  among TLS connections with a plain configuration.
- different to openssl, a connection with a client certificate
  is not eligible to sharing.
- document CURLOPT_CA_CACHE_TIMEOUT in man page

Closes #13795

17 months agotests: don't log buffer length in throwing away message
Dan Fandrich [Tue, 4 Jun 2024 05:19:14 +0000 (22:19 -0700)] 
tests: don't log buffer length in throwing away message

It's not available at that point, and it will be written in the
non-error case right afterward.

17 months agotests: log "Throwing away" messages before throwing away
Dan Fandrich [Mon, 3 Jun 2024 20:25:29 +0000 (13:25 -0700)] 
tests: log "Throwing away" messages before throwing away

In case the read that follows hangs we'll get a clue as to what it was
doing.

17 months agoCI: reduce memory request for FreeBSD builds
Dan Fandrich [Fri, 31 May 2024 01:39:12 +0000 (18:39 -0700)] 
CI: reduce memory request for FreeBSD builds

Also, add a comment with link to the Cirrus credit page since it's not
easy to find otherwise.

17 months agotcpkeepalive: support setting TCP keep-alive parameters on Solaris <11.4
Andy Pan [Mon, 3 Jun 2024 07:15:55 +0000 (15:15 +0800)] 
tcpkeepalive: support setting TCP keep-alive parameters on Solaris <11.4

Solaris didn't support TCP_KEEPIDLE and TCP_KEEPINTVL until 11.4,
before that it use TCP_KEEPALIVE_THRESHOLD and TCP_KEEPALIVE_ABORT_THRESHOLD
as the substitute. Therefore, for Solaris <11.4 we need to use this substitute
for setting TCP keep-alive parameters.

Ref:
https://docs.oracle.com/cd/E86824_01/html/E54777/tcp-7p.html
https://docs.oracle.com/cd/E88353_01/html/E37851/tcp-4p.html

Closes #13864

17 months agoKNOWN_BUGS: quiche: QUIC connection is draining
Daniel Stenberg [Mon, 3 Jun 2024 08:10:47 +0000 (10:10 +0200)] 
KNOWN_BUGS: quiche: QUIC connection is draining

Closes #12037
Closes #13867

17 months agoKNOWN_BUGS: aws-sigv4 has problems with particular URLs
Daniel Stenberg [Mon, 3 Jun 2024 08:04:50 +0000 (10:04 +0200)] 
KNOWN_BUGS: aws-sigv4 has problems with particular URLs

Closes #13058
Closes #13866

17 months agoKNOWN_BUGS: aws-sigv4 does not handle multipart/form-data correctly
Daniel Stenberg [Mon, 3 Jun 2024 08:02:33 +0000 (10:02 +0200)] 
KNOWN_BUGS: aws-sigv4 does not handle multipart/form-data correctly

Closes #13351
Closes #13866

17 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 3 Jun 2024 08:43:06 +0000 (10:43 +0200)] 
RELEASE-NOTES: synced

17 months agoGHA: fix old mingw-w64 32-bit job
Viktor Szakats [Sun, 2 Jun 2024 23:11:47 +0000 (01:11 +0200)] 
GHA: fix old mingw-w64 32-bit job

This toolchain resides in the `mingw32` directory. Make sure to
configure `PATH` accordingly.

Before this patch, it pointed to a non-existing `mingw64` directory,
making the job use the wrong compiler (gcc 12, 64-bit).

Follow-up to e838b341a08b44d4a8486fb0d3f15d12fc794c62 #12927
Closes #13863

17 months agotool_cb_hdr: return error for failed header writes
Daniel Stenberg [Sun, 2 Jun 2024 15:16:58 +0000 (17:16 +0200)] 
tool_cb_hdr: return error for failed header writes

By checking that fflush() works.

Reported-by: Sebastian Andersson
Fixes #13836
Closes #13859

17 months agoGHA: bump all build jobs to nproc+1
Viktor Szakats [Tue, 28 May 2024 07:01:49 +0000 (09:01 +0200)] 
GHA: bump all build jobs to nproc+1

- bump rest of the workflows (windows, macos, distrocheck).

- non-native virtualized envs have 2 CPUs, bump down accordingly.
  (for `vmactions/omnios-vm` it's just a guess.)

- bump all to nproc + 1.

Follow-up to e838b341a08b44d4a8486fb0d3f15d12fc794c62 #12927
Closes #13807

17 months agoGHA: disable MQTT and WebSocket tests in Windows jobs
Viktor Szakats [Sun, 2 Jun 2024 17:30:19 +0000 (19:30 +0200)] 
GHA: disable MQTT and WebSocket tests in Windows jobs

Trying to figure out which category is causing the remaining hangs.

Follow-up to def7d05382743ea7aa1d356d1e41dcb22ecdd4d7
Closes #13860

17 months agolib/v*: tidy up types and casts
Viktor Szakats [Mon, 13 May 2024 15:56:19 +0000 (17:56 +0200)] 
lib/v*: tidy up types and casts

Also add a couple of negative checks.

Cherry-picked from #13489
Closes #13622

17 months agoGHA: fix caching old mingw-w64 toolchains in the Windows workflow
Viktor Szakats [Sun, 2 Jun 2024 16:22:48 +0000 (18:22 +0200)] 
GHA: fix caching old mingw-w64 toolchains in the Windows workflow

- stop altering the `PATH` via `GITHUB_ENV`. This confused the
  `actions/cache` post-job, which needs to run in the exact same
  environment as its pre-job, to have a consistent cache entry "version"
  hash. Altering the `PATH` via `GITHUB_ENV` spills into the the
  post-job and breaks this hash. GHA doesn't reset the env automatically
  and I have not found a way to do it manually.

- add double-quotes where missing.

- move cache directory under `USERPROFILE` to not rely on absolute
  paths.

- make cache directory flatter and versionless.

Follow-up to 0914d8aadddac0d1459673d5b7f77e8f3378b22b #13759
Closes #13856

17 months agoci: pin actions/github-script action to 60a0d83
renovate[bot] [Sat, 1 Jun 2024 08:58:26 +0000 (08:58 +0000)] 
ci: pin actions/github-script action to 60a0d83

Closes #13846

17 months agox509asn1: add some common ECDSA OIDs
Bo Anderson [Sun, 2 Jun 2024 13:17:10 +0000 (14:17 +0100)] 
x509asn1: add some common ECDSA OIDs

Closes #13857

17 months agoci: update rojopolis/spellcheck-github-actions digest to e36f662
renovate[bot] [Sat, 1 Jun 2024 18:44:11 +0000 (18:44 +0000)] 
ci: update rojopolis/spellcheck-github-actions digest to e36f662

Closes #13852

17 months agox509asn1: fallback to dotted OID representation
Bo Anderson [Sun, 2 Jun 2024 13:18:20 +0000 (14:18 +0100)] 
x509asn1: fallback to dotted OID representation

Reported-by: Luke Hamburg
Fixes #13845
Closes #13858

17 months agorequest.md: language fix
Lee Li [Sun, 2 Jun 2024 01:42:52 +0000 (09:42 +0800)] 
request.md: language fix

improved for better readability and correctness

Closes #13854

17 months agovtls: deprioritize Secure Transport
MonkeybreadSoftware [Tue, 7 May 2024 07:45:15 +0000 (09:45 +0200)] 
vtls: deprioritize Secure Transport

Moved Secure Transport behind OpenSSL, so we can build CURL with both
and prefer using OpenSSL over Secure Transport by default.

Closes #13547

17 months agourlapi: add CURLU_NO_GUESS_SCHEME
Daniel Stenberg [Sat, 1 Jun 2024 10:03:34 +0000 (12:03 +0200)] 
urlapi: add CURLU_NO_GUESS_SCHEME

Used for extracting:

- when used asking for a scheme, it will return CURLUE_NO_SCHEME if the
  stored information was a guess

- when used asking for a URL, the URL is returned without a scheme, like
  when previously given to the URL parser when it was asked to guess

- as soon as the scheme is set explicitly, it is no longer internally
  marked as guessed

The idea being:

1. allow a user to figure out if a URL's scheme was set as a result of
  guessing

2. extract the URL without a guessed scheme

3. this makes it work similar to how we already deal with port numbers

Extend test 1560 to verify.

Closes #13616

17 months agowolfssl: support CA caching
Daniel Stenberg [Sat, 1 Jun 2024 10:24:42 +0000 (12:24 +0200)] 
wolfssl: support CA caching

As a bonus, add SSLSUPP_CA_CACHE to let TLS backends signal its support
for this so that *setopt() return error if there is no support.

Closes #13786

17 months agosocket: change TCP keepalive from ms to seconds on DragonFly BSD
Andy Pan [Sat, 1 Jun 2024 10:36:04 +0000 (18:36 +0800)] 
socket: change TCP keepalive from ms to seconds on DragonFly BSD

DragonFly BSD changed the time unit for TCP keep-alive from milliseconds
to seconds since v5.8, thus setting the keepalive options with
milliseconds with curl/libcurl will result in unexpected behaviors on
DragonFlyBSD 5.8+

Distinguish the DragonFly BSD versions and use the proper time units
accordingly.

Ref:
  https://lists.dragonflybsd.org/pipermail/commits/2019-July/719125.html
  https://github.com/DragonFlyBSD/DragonFlyBSD/blob/965b380e960908836b97aa034fa2753091e0172e/sys/sys/param.h#L207

Fixes #13847
Closes #13848

17 months agocurlver.h: aiming for 8.9.0
Daniel Stenberg [Sat, 1 Jun 2024 10:26:20 +0000 (12:26 +0200)] 
curlver.h: aiming for 8.9.0

17 months agonoproxy: patterns need to be comma separated
Daniel Stenberg [Sat, 1 Jun 2024 10:25:12 +0000 (12:25 +0200)] 
noproxy: patterns need to be comma separated

or they will not parse correctly.

Mentioned in DEPRECATED since Janurary 2023 (in 7ad8a7ba9ebdedc).

Closes #13789

17 months agosectransp: remove large cipher table
Jan Venekamp [Wed, 29 May 2024 11:58:53 +0000 (13:58 +0200)] 
sectransp: remove large cipher table

Previously a large table of ciphers was used to determine the default
ciphers and to lookup manually selected ciphers names.

With the lookup of the manually selected cipher names moved to
Curl_cipher_suite_walk_str() the large table is no longer needed for
that purpose.

The list of manually selected cipher can now be intersected with the
ciphers supported by Secure Transport (SSLGetSupportedCiphers()),
instead of using the fixed table for that.

The other use of the table was to filter the list of all supported
ciphers offered by Secure Transport to create a list of ciphers to
use by default, excluding ciphers in the table marked as weak.

Instead of using a complement based approach (exclude weak), switch
to using an intersection with a smaller list of ciphers deemed
appropriate.

Closes #13823

17 months agoGHA: unify http3 workflows into one
Tatsuhiro Tsujikawa [Tue, 21 May 2024 09:50:57 +0000 (18:50 +0900)] 
GHA: unify http3 workflows into one

This commit unifies the following http3 workflows into http3-linux.yml:

- ngtcp2-linux.yml
- osslq-linux.yml
- quiche-linux.yml

The idea is better use of the build cache. Previously, they
independently create caches with the same key. Some of the caches
include source code and intermediate object files, which makes cache
quite large. In this commit, only built artifacts are cached, which
drastically reduces the cache size. OpenSSL v3, mod_h2 and quiche caches
still include all stuff, but they are left for the later improvement.
Because the contents of the cache have been changed, the cache keys are
also changed to include the word "http3".

Closes #13841

17 months agoopenSSL: fix hostname handling when using ECH
Stephen Farrell [Wed, 29 May 2024 11:32:32 +0000 (12:32 +0100)] 
openSSL: fix hostname handling when using ECH

Reported-by: vvb2060
Fixes #13818
Closes #13822

18 months agoci: update github/codeql-action digest to f079b84
renovate[bot] [Fri, 31 May 2024 09:55:28 +0000 (09:55 +0000)] 
ci: update github/codeql-action digest to f079b84

Closes #13837

18 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 1 Jun 2024 08:40:20 +0000 (10:40 +0200)] 
RELEASE-NOTES: synced

18 months agocurl_multi_poll.md: expand the example with an custom file descriptor
Daniel Stenberg [Fri, 31 May 2024 12:42:45 +0000 (14:42 +0200)] 
curl_multi_poll.md: expand the example with an custom file descriptor

Closes #13842

18 months agoDISTROS: add a link to the list archive
Christian Heusel [Fri, 31 May 2024 12:44:02 +0000 (14:44 +0200)] 
DISTROS: add a link to the list archive

Related to https://github.com/curl/curl/discussions/13833

Signed-off-by: Christian Heusel <christian@heusel.eu>
Closes #13843

18 months agoautoconf: remove 'deeper' checks for `AC_CHECK_FUNCS`
Matt Jolly [Thu, 30 May 2024 04:47:11 +0000 (14:47 +1000)] 
autoconf: remove 'deeper' checks for `AC_CHECK_FUNCS`

The net effect of the deeper checks is to raise implicit function decls
on modern compilers.

These checks appear to have been added ~20 years ago, relating to an
unverifiable claim about HP-UX. Autoconf support for the platform has
grown in leaps and bounds since.

It didn't cause a real problem here, but when investigating a FP this
came up. No evidence has been identified that this was actually broken
in the past, and there is no evidence that this is necessary now.

`-Werror=implicit-function-declarations` is enabled for both checks;
without a working prototype they will both fail regardless. In the
second case there will in fact never be a working prototype and
therefore it will always fail unconditionally.

`AC_CHECK_FUNCS` does effectively the same thing as the removed checks,
except it actually defines a dummy prototype to see if it links.

If `AC_CHECK_FUNCS` is broken on a given platform we have bigger
problems than trying to build cURL. This should also be faster.

Bug: https://bugs.gentoo.org/932827
Reviewed-By: Eli Schwartz <eschwartz93@gmail.com>
Closes #13830

18 months agocf-socket: improve SO_SNDBUF update for Winsock
Jay Satiro [Sun, 26 May 2024 18:56:24 +0000 (14:56 -0400)] 
cf-socket: improve SO_SNDBUF update for Winsock

- Rename: Curl_sndbufset => Curl_sndbuf_init

- Rename: win_update_buffer_size => win_update_sndbuf_size

- Save the last set SO_SNDBUF size to compare against so that we can
  avoid setsockopt calls every second.

This is a follow-up to 0b520e12 which moved the SO_SNDBUF update check
into cf-socket. This change improves it further by making the function
names easier to understand and reducing the amount of setsockopt calls.

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

18 months agotidy-up: use consistent casing for Windows directories
Viktor Szakats [Thu, 30 May 2024 10:26:12 +0000 (12:26 +0200)] 
tidy-up: use consistent casing for Windows directories

C:\Windows\System32

Closes #13832

18 months agoGHA: use ubuntu-latest with OmniOS job
Viktor Szakats [Thu, 30 May 2024 10:00:27 +0000 (12:00 +0200)] 
GHA: use ubuntu-latest with OmniOS job

It's the same as ubuntu-22.04.

Also update OmniOS package search link.

Closes #13831

18 months agoGHA: adjust parallel job counts
Ayesh Karunaratne [Mon, 12 Feb 2024 07:05:35 +0000 (14:05 +0700)] 
GHA: adjust parallel job counts

Adjusts the `make -j` flag to match the latest GitHub-hosted runner
hardware specs[^1]:

 - `ubuntu-latest` on 4 CPU cores
 - `macos-latest` on 3 CPU cores

The processor count is ideally obtained from `nproc`, but setting env
vars from the current CI yaml files is not possible because they expect
literal strings.

[^1]: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

Closes #12927

18 months agoget.d: clarify the explanation
pszlazak [Sun, 19 May 2024 15:35:47 +0000 (17:35 +0200)] 
get.d: clarify the explanation

Closes #13706

18 months agocurl_url_set.md: libcurl only parses :// URLs
Daniel Stenberg [Wed, 29 May 2024 09:33:41 +0000 (11:33 +0200)] 
curl_url_set.md: libcurl only parses :// URLs

Make it clearer in the documentation.

Closes #13821

18 months agomulti: fix multi_wait() timeout handling
Stefan Eissing [Wed, 29 May 2024 15:13:34 +0000 (17:13 +0200)] 
multi: fix multi_wait() timeout handling

- determine the actual poll timeout *after* all sockets
  have been collected. Protocols and connection filters may
  install new timeouts during collection.
- add debug logging to test1533 where the mistake was noticed

Reported-by: Matt Jolly
Fixes #13782
Closes #13825

18 months agolib: prefer `var = time(NULL)` over `time(&var)`
Viktor Szakats [Tue, 28 May 2024 14:16:01 +0000 (16:16 +0200)] 
lib: prefer `var = time(NULL)` over `time(&var)`

Following up on previous occurrences showing up as gcc warnings, replace
the remaining `time(&var)` calls with `var = time(NULL)`, though these
aren't specifically causing compiler warnings. These are in the TFTP
client code (`lib/tftp.c`), except one which is in a debug branch in
`lib/http_aws_sigv4.c`.

What's unexplainable is that this patch seems to mitigate TFTP tests
often hanging or going into an infinite loop on GHA windows workflows
with MSYS2, mingw-w64 and MSVC (Cygwin is unaffected):
  https://github.com/curl/curl/pull/13599#issuecomment-2119372376
TFTP hangs did not entirely disappear though, so could be unrelated.

`time()` docs:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/time-time32-time64
https://manpages.debian.org/bookworm/manpages-dev/time.2.en.html

Follow-up to 58ca0a2f0743a586716ca357c382b29e3f08db69 #13800
Follow-up to d0728c9109629ee82b855b350a4c3f1f52ee61df #13643
Closes #13815

18 months agowinsock: move SO_SNDBUF update into cf-socket
Stefan Eissing [Fri, 24 May 2024 08:09:32 +0000 (10:09 +0200)] 
winsock: move SO_SNDBUF update into cf-socket

- Move the code that updates the SO_SNDBUF size for Windows to
  cf_socket_send.

Prior to this change the code was in readwrite_upload but the socket
filter is the more appropriate place because it applies to all sends.

Background:

For Windows users SO_SNDBUF (the total per-socket buffer size reserved
by Winsock for sends) is updated dynamically by libcurl during the
transfer. This is because Windows does not do it automatically for
non-blocking sockets and without it the performance of large transfers
may suffer.

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

18 months agosectransp: use common code for cipher suite lookup
Jan Venekamp [Wed, 8 May 2024 18:40:29 +0000 (20:40 +0200)] 
sectransp: use common code for cipher suite lookup

Take advantage of the Curl_cipher_suite_walk_str() and
Curl_cipher_suite_get_str() functions introduced in commit fba9afe.

Closes #13521

18 months agoaws-sigv4: url encode the canonical path
Matthias Gatto [Mon, 27 May 2024 12:58:11 +0000 (14:58 +0200)] 
aws-sigv4: url encode the canonical path

Refactors canon_query, so it could use the encoding part of the function
to use it in the path.

As the path doesn't encode '/', but encode '=', I had to add some
conditions to know If I was doing the query or path encoding.

Also, instead of adding a `bool in_path` variable, I use `bool
*found_equals` to know if the function was called for the query or path,
as found_equals is used only in query_encoding.

Test 472 verifies.

Reported-by: Alexander Shtuchkin
Fixes #13754
Closes #13814

Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
18 months agocd2nroff: use an empty "##" to signal end of .IP sequence
Daniel Stenberg [Tue, 28 May 2024 06:32:19 +0000 (08:32 +0200)] 
cd2nroff: use an empty "##" to signal end of .IP sequence

Like when we list a series of options and then want to add "normal" text
again afterwards.

Without this, the indentation level wrongly continues even after the
final "##" header, making following text wrongly appear to belong to the
header above.

Adjusted several curldown files to use this.

Fixes #13803
Reported-by: Jay Satiro
Closes #13806

18 months agoopenssl: fix %-specifier in infof() call
vvb2060 [Tue, 28 May 2024 17:11:44 +0000 (01:11 +0800)] 
openssl: fix %-specifier in infof() call

Closes #13816

18 months agocurl: make warnings and other messages aware of terminal width
Daniel Stenberg [Tue, 28 May 2024 07:44:27 +0000 (09:44 +0200)] 
curl: make warnings and other messages aware of terminal width

This removes unnecessary line wraps when the terminal is wider than 79
columns and it also makes messages look better in narrower terminals.

The get_terminal_columns() function is not split out into its own source
file.

Suggested-by: Elliott Balsley
Fixes #13804
Closes #13808

18 months agoGHA: enable tests 1139, 1177, 1477 on Windows
Viktor Szakats [Tue, 28 May 2024 17:19:43 +0000 (19:19 +0200)] 
GHA: enable tests 1139, 1177, 1477 on Windows

These exclusions came from the AppVeyor CI config, but they do pass now
and they are static tests with no flakiness risk.

Follow-up to 0914d8aadddac0d1459673d5b7f77e8f3378b22b #13759
Closes #13817

18 months agoCI: Improve labeler tag detection
Dan Fandrich [Mon, 13 May 2024 19:58:44 +0000 (12:58 -0700)] 
CI: Improve labeler tag detection

Also, simplify patterns with a single glob.

18 months agoGHA: disable TFTP tests in Windows jobs
Viktor Szakats [Tue, 28 May 2024 11:07:34 +0000 (13:07 +0200)] 
GHA: disable TFTP tests in Windows jobs

Shot in the dark trying to find out which tests are
hanging / going to an infinite loop.

The ones failing after 45 minutes (mingw-w64) or 30 minutes (MSVC).

Ref: https://github.com/curl/curl/pull/13599#issuecomment-2119372376

18 months agoci: update vmactions/omnios-vm digest to a61ca1e
renovate[bot] [Mon, 27 May 2024 20:56:52 +0000 (20:56 +0000)] 
ci: update vmactions/omnios-vm digest to a61ca1e

Closes #13801

18 months agoopenssl/gnutls: rectify the TLS version checks for QUIC
Daniel Stenberg [Mon, 27 May 2024 21:12:27 +0000 (23:12 +0200)] 
openssl/gnutls: rectify the TLS version checks for QUIC

The versions check wrongly complained and return error if the *minimum*
version was set to something less than 1.3. QUIC is always TLS 1.3, but
that means minimum 1.2 is still fine to ask for.

This also renames the local variable to make the mistake harder to make
in the future.

Regression shipped in 8.8.0

Follow-up to 3210101088dfa3d6a125

Reported-by: fds242 on github
Fixes #13799
Closes #13802

18 months agognutls: improve TLS shutdown
Stefan Eissing [Mon, 27 May 2024 09:51:03 +0000 (11:51 +0200)] 
gnutls: improve TLS shutdown

local ftp upload tests sometimes failed with an invalid TLS record being
reported by gnutls. vsftp did log that the shutdown was not regarded as
clean, failing the control connection thereafter.

These changes make test_31_05 work reliable locally.

- on closing the SSL filter, shutdown READ *and* WRITE
- on closing, try a receive after shutdown is sent
- convert to DEBUGF to CURL_TRC_CF

Closes #13790

18 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 28 May 2024 08:29:05 +0000 (10:29 +0200)] 
RELEASE-NOTES: synced

18 months agotests: run with "--trace-config all" to provide even more info
Daniel Stenberg [Mon, 27 May 2024 12:06:37 +0000 (14:06 +0200)] 
tests: run with "--trace-config all" to provide even more info

in case of problems.

Closes #13791

18 months agobuild: untangle `CURLDEBUG` and `DEBUGBUILD` macros
Viktor Szakats [Mon, 20 May 2024 12:21:05 +0000 (14:21 +0200)] 
build: untangle `CURLDEBUG` and `DEBUGBUILD` macros

`CURLDEBUG` is meant to enable memory tracking, but in a bunch of cases,
it was protecting debug features that were supposed to be guarded with
`DEBUGBUILD`.

Replace these uses with `DEBUGBUILD`.

This leaves `CURLDEBUG` uses solely for its intended  purpose: to enable
the memory tracking debug feature.

Also:
- autotools: rely on `DEBUGBUILD` to enable `checksrc`.
  Instead of `CURLDEBUG`, which worked in most cases because debug
  builds enable `CURLDEBUG` by default, but it's not accurate.
- include `lib/easyif.h` instead of keeping a copy of a declaration.
- add CI test jobs for the build issues discovered.

Ref: https://github.com/curl/curl/pull/13694#issuecomment-2120311894
Closes #13718

18 months agoexamples: delete unused includes
Viktor Szakats [Fri, 24 May 2024 17:52:05 +0000 (19:52 +0200)] 
examples: delete unused includes

Delete a bunch of unnecessary-looking headers from some examples. This
is known to be tricky on AIX (perhaps also in other less-tested envs).

Let me know if any of this looks incorrect or outright fails on some
systems.

Follow-up to d4b85890555388bec212b75f47a5c1a48705b156 #13771
Closes #13785

18 months agoappveyor: fixup job name [ci skip]
Viktor Szakats [Mon, 27 May 2024 21:22:39 +0000 (23:22 +0200)] 
appveyor: fixup job name [ci skip]

Follow-up to fc8e0dee3045658f293452121f5290d81ba3aa1e #13694

18 months agocmake: fix `-Wredundant-decls` in unity/mingw-w64/gcc/curldebug/DLL builds
Viktor Szakats [Sun, 19 May 2024 14:55:45 +0000 (16:55 +0200)] 
cmake: fix `-Wredundant-decls` in unity/mingw-w64/gcc/curldebug/DLL builds

It affected cmake-unity shared-curltool curldebug mingw-w64 gcc builds
when building the `testdeps` target.

Apply the solution already used in `lib/base64.c` and `lib/dynbuf.c`
to fix it.

Also update an existing GHA CI job to test the issue fixed.

```
In file included from curl/lib/version_win32.c:35,
                 from curl/_bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:145:
curl/lib/memdebug.h:52:14: error: redundant redeclaration of 'curl_dbg_logfile' [-Werror=redundant-decls]
   52 | extern FILE *curl_dbg_logfile;
      |              ^~~~~~~~~~~~~~~~
In file included from curl/src/slist_wc.c:32,
                 from curl/_bld/src/CMakeFiles/curl.dir/Unity/unity_0_c.c:4:
curl/lib/memdebug.h:52:14: note: previous declaration of 'curl_dbg_logfile' with type 'FILE *' {aka 'struct _iobuf *'}
   52 | extern FILE *curl_dbg_logfile;
      |              ^~~~~~~~~~~~~~~~
curl/lib/memdebug.h:55:44: error: redundant redeclaration of 'curl_dbg_malloc' [-Werror=redundant-decls]
   55 | CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1) void *curl_dbg_malloc(size_t size,
      |                                            ^~~~~~~~~~~~~~~
curl/lib/memdebug.h:55:44: note: previous declaration of 'curl_dbg_malloc' with type 'void *(size_t,  int,  const char *)' {aka 'void *(long long unsigned int,  int,  const char *)'}
   55 | CURL_EXTERN ALLOC_FUNC ALLOC_SIZE(1) void *curl_dbg_malloc(size_t size,
      |                                            ^~~~~~~~~~~~~~~
[...]
curl/lib/memdebug.h:110:17: error: redundant redeclaration of 'curl_dbg_fclose' [-Werror=redundant-decls]
  110 | CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
      |                 ^~~~~~~~~~~~~~~
curl/lib/memdebug.h:110:17: note: previous declaration of 'curl_dbg_fclose' with type 'int(FILE *, int,  const char *)' {aka 'int(struct _iobuf *, int,  const char *)'}
  110 | CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
      |                 ^~~~~~~~~~~~~~~
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/49840554/job/a4aoet17e9qnqx1a#L362

After: https://ci.appveyor.com/project/curlorg/curl/builds/49843735/job/hbo2uah2vj0ns523

Ref: #13689 (CI testing this PR with `DEBUGBUILD`/`CURLDEBUG`/shared-static combinations)
Depends-on: #13694
Depends-on: #13800
Closes #13705

18 months agolib: fix gcc warning in certain debug builds
Viktor Szakats [Mon, 20 May 2024 12:21:05 +0000 (14:21 +0200)] 
lib: fix gcc warning in certain debug builds

```
curl/lib/http_aws_sigv4.c:536:10: error: 'clock' may be used uninitialized [-Werror=maybe-uninitialized]
  536 |   time_t clock;
      |          ^~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9158755123/job/25177765000#step:13:79

Cherry-picked from #13718
Closes #13800

18 months agocmake: always build unit tests with the `testdeps` target
Viktor Szakats [Sat, 18 May 2024 00:15:32 +0000 (02:15 +0200)] 
cmake: always build unit tests with the `testdeps` target

Before this patch, the `testdeps` build target required `-DCURLDEBUG`
be set either via `ENABLE_DEBUG=ON` or `ENABLE_CURLDEBUG=ON` to build
the curl unit tests.

After fixing build issues in #13694, we can drop this requirement and
build unit tests unconditionally.

Depends-on: #13694
Depends-on: #13697 (fix unit test issue revealed by Old Linux CI job)
Follow-up to 39e7c22bb459c2e818f079984989a26a09741860 #11446
Closes #13698

18 months agoCI: disable dependency tracking in most autotools builds
Viktor Szakats [Mon, 27 May 2024 13:19:35 +0000 (15:19 +0200)] 
CI: disable dependency tracking in most autotools builds

For better build performance. Dependency tracking causes a build
overhead while compiling to help a subsequent build, but in CI there is
never one and the extra work is discarded.

Closes #13794

18 months agobuild: untangle `UNITTESTS` and `DEBUGBUILD` macros
Viktor Szakats [Thu, 16 May 2024 11:49:22 +0000 (13:49 +0200)] 
build: untangle `UNITTESTS` and `DEBUGBUILD` macros

- fix `DEBUGBUILD` guards that should be `UNITTESTS`, in libcurl code
  used by unit tests.
- fix guards for libcurl functions used in unit tests only.
- sync `UNITTEST` attribute between declarations and definitions.
- drop `DEBUGBUILD` guard from test `unit2600`.
- fix guards for libcurl HSTS code used by both a unit test (`unit1660`)
  and `test0446`.
- update an existing AppVeyor CI job to test the issues fixed.

This fixes building tests with `CURLDEBUG` enabled but `DEBUGBUILD`
disabled. This can happen when building tests with CMake with
`ENABLE_DEBUG=ON` in Release config, or with `ENABLE_CURLDEBUG=ON`
and _without_ `ENABLE_DEBUG=ON`. Possibly also with autotools
when using `--enable-curldebug` without `--enable-debug`.

Test results:
- before:
  https://ci.appveyor.com/project/curlorg/curl/builds/49835609
  https://ci.appveyor.com/project/curlorg/curl/builds/49898529/job/k8qpbs8idby70smw
  https://github.com/curl/curl/actions/runs/9259078835/job/25470318167?pr=13798#step:13:821
- after: https://ci.appveyor.com/project/curlorg/curl/builds/49839255
  (the two failures are unrelated, subject to PR #13705)

Ref: #13592 (issue discovery)
Ref: #13689 (CI testing this PR with `DEBUGBUILD`/`CURLDEBUG` combinations)
Closes #13694

18 months agoGHA: ignore flaky MQTT and FTP test results [ci skip]
Viktor Szakats [Mon, 27 May 2024 17:55:20 +0000 (19:55 +0200)] 
GHA: ignore flaky MQTT and FTP test results [ci skip]

MQTT / OmniOS:
```
TESTFAIL: These test cases failed: 1190 1198 3017
```
Ref: https://github.com/curl/curl/actions/runs/9258522297/job/25468730731?pr=13694#step:3:10251

MQTT / OmniOS:
```
TESTFAIL: These test cases failed: 1194 2200 2203 2205
```
Ref: https://github.com/curl/curl/actions/runs/9150523540/job/25155409832#step:3:10233

FTP / OmniOS:
```
TESTFAIL: These test cases failed: 1096
```
Ref: https://github.com/curl/curl/actions/runs/9150702711/job/25155793948#step:3:10247

FTP / OmniOS:
```
TESTFAIL: These test cases failed: 381
```
Ref: https://github.com/curl/curl/actions/runs/9163863822/job/25193897640#step:3:10230

FTP / OmniOS:
```
TESTFAIL: These test cases failed: 340
```
Ref: https://github.com/curl/curl/actions/runs/9233804752/job/25406671742?pr=13771#step:3:10245

Ref: https://github.com/curl/curl/pull/13583#issuecomment-2119376898

18 months agoCI: tidy up skipping tests build/run in Windows jobs
Viktor Szakats [Mon, 27 May 2024 16:48:32 +0000 (18:48 +0200)] 
CI: tidy up skipping tests build/run in Windows jobs

Simplify controlling whether to build and/run tests in a CI job.

Apply the TFLAGS='skipall' (do not build nor run tests) or
'skiprun' (build, but do not run) method already used with old-mingw-w64
and msvc jobs to existing Windows jobs in GHA and AppVeyor.

Also:
- add Cygwin/cmake test build and run steps while here.
- replace `DISABLED_TESTS` with `TFLAGS` in AppVeyor.

Closes #13796

18 months agocmake: use `APPLE` instead of `CMAKE_SYSTEM_NAME` string
Viktor Szakats [Sun, 19 May 2024 16:42:11 +0000 (18:42 +0200)] 
cmake: use `APPLE` instead of `CMAKE_SYSTEM_NAME` string

Follow-up to a86254b39307af1a53735b065a382567805cd9b8 #12515
Closes #13713

18 months agocmake: whitespace, formatting/tidy-up in comments
Viktor Szakats [Sun, 19 May 2024 16:49:42 +0000 (18:49 +0200)] 
cmake: whitespace, formatting/tidy-up in comments

Also correct casing in a few option descriptions.

Closes #13711

18 months agocmake: allow `ENABLE_CURLDEBUG=OFF` with `ENABLE_DEBUG=ON`
Viktor Szakats [Mon, 27 May 2024 12:33:54 +0000 (14:33 +0200)] 
cmake: allow `ENABLE_CURLDEBUG=OFF` with `ENABLE_DEBUG=ON`

Before this patch, `ENABLE_CURLDEBUG` (memory tracking) was
unconditionally enabled when `ENABLE_DEBUGBUILD` was set. This made
testing some build configurations complicated. To fix it, this patch
makes `ENABLE_CURLDEBUG` to receive the value of `ENABLE_DEBUG` by
default, while allowing free override by the user.

This allows to use the config:
`ENABLE_DEBUGBUILD=ON ENABLE_CURLDEBUG=OFF`
to enable debug features, without also enabling memory tracking.

This is important because some other build methods allow to set one of
these features but not the other. This patch allows to test any
combination with CMake.

This makes it unnecessary to use the workaround of passing
`-DDEBUGBUILD` via `CMAKE_C_FLAGS`. Which has the disadvantage that our
CMake logic cannot easily detect it, e.g. for disabling symbol hiding on
Windows for `ENABLE_DEBUG`/`DEBUGBUILD` builds.

Cherry-picked from #13718
Closes #13792

18 months agocmake: `ENABLE_DEBUG=ON` to always set `-DDEBUGBUILD`
Viktor Szakats [Sat, 11 May 2024 00:44:10 +0000 (02:44 +0200)] 
cmake: `ENABLE_DEBUG=ON` to always set `-DDEBUGBUILD`

Before this patch `ENABLE_DEBUG=ON` always enabled the TrackMemory
(aka `ENABLE_CURLDEBUG=ON`) feature, but required the `Debug` CMake
configration to actually enable curl debug features
(aka `-DDEBUGBUILD`).

Curl debug features do not require compiling with C debug options. This
also made enabling debug features unintuitive and complicated to use.
Due to other issues (subject to PR #13694) it also caused an error in
default (and `Release`/`MinSizeRel`/`RelWithDebInfo`) configs, when
building the `testdeps` target:
```
ld: CMakeFiles/unit1395.dir/unit1395.c.o: in function `test':
unit1395.c:(.text+0x1a0): undefined reference to `dedotdotify'
```
Ref: https://github.com/curl/curl/actions/runs/9037287098/job/24835990826#step:3:2483

Fix it by always defining `DEBUGBUILD` when setting `ENABLE_DEBUG=ON`.
Decoupling this option from the selected CMake configuration.

Note that after this patch `ENABLE_DEBUG=ON` unconditionally enables
curl debug features. These features are insecure and unsuited for
production. Make sure to omit this option when building for production
in default, `Release` (and other not-`Debug`) modes.

Also delete a workaround no longer necessary in GHA CI jobs.

Ref: 1a62b6e68c08c7e471ff22dd92932aba7e026817 (2015-03-03)
Ref: #13583
Closes #13592

18 months agoGHA: add autotools mingw-64, build-only job
Viktor Szakats [Mon, 27 May 2024 13:07:23 +0000 (15:07 +0200)] 
GHA: add autotools mingw-64, build-only job

Cherry-picked from #13718
Closes #13793