Commit Graph

38400 Commits

Author SHA1 Message Date
Viktor Szakats
c025082967
openssl: fix build with 4.0.0-beta1 no-deprecated
```
lib/vtls/openssl.c:4238:22: error: ‘SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED’ undeclared (first use in this function); did you mean ‘SSL_R_TLS_ALERT_CERTIFICATE_EXPIRED’?
 4238 |           (reason == SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED))) {
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                      SSL_R_TLS_ALERT_CERTIFICATE_EXPIRED
lib/vtls/openssl.c:4238:22: note: each undeclared identifier is reported only once for each function it appears in
```
Ref: https://github.com/curl/curl/actions/runs/23641366299/job/68863072427#step:24:189

Cherry-picked from #21118

Closes #21119
2026-03-27 12:05:51 +01:00
Viktor Szakats
68fefb9f59
GHA/http3-linux: add missing step conditions
To omit unused cache restores. Saving ~7 seconds in jobs not using them.

Closes #21120
2026-03-27 11:53:57 +01:00
Daniel Stenberg
10d5177984
request: reset resp_trailer in new requests
Otherwise the trailer state lingers on into subsequent requests.

Follow-up to 29610e5f3d

Spotted by Codex Security

Closes #21112
2026-03-27 09:51:34 +01:00
Daniel Stenberg
cfc86e4e04
RELEASE-NOTES: synced 2026-03-27 09:38:59 +01:00
Daniel Stenberg
248b92939a
cf-socket: avoid low risk integer overflow on ancient Solaris
Spotted by Codex Security

Closes #21111
2026-03-27 09:34:42 +01:00
Daniel Stenberg
860c57dffd
test1619: download into %LOGDIR
Otherwise it will end up in tests/ which is not wanted.

Follow-up to d63432d1f8

Reported-by: Stefan Eissing

Closes #21114
2026-03-27 09:33:54 +01:00
Daniel Stenberg
916faac3dc
runtests: check for Debug case sensitively
For both TrackMemory and Debug

Closes #21099
2026-03-27 08:10:39 +01:00
Daniel Stenberg
b71973c115
tool: fix memory mixups
memory allocated by libcurl must be freed with curl_free() and vice versa,
memory allocated by the tool itself must be freed with curlx_free().

- dynbuf: free libcurl data with curl_free()
- tool_operate: make sure we get URL using the right memory
- tool_operhlp: free libcurl memory with curl_free()
- tool_operate: free curl_maprintf() pointer with curl_free
- var: data from curlx_base64_decode needs curlx_free
- tool_operate: fix memory juggling in etag handling
- tool_cb_hdr: fix memory area mixups
- tool_operate: another mixup in etag management
- tool_cb_hdr: more memory mixup fixes
- tool_cfgable.c: document some details
- tool_help: show global-mem-debug in -V output

Closes #21099
2026-03-27 08:10:32 +01:00
Daniel Stenberg
46d0ade086
GHA: add a 'curl_global_init_mem debug' job
Closes #21099
2026-03-27 08:10:29 +01:00
Daniel Stenberg
59c11074cf
src: add curl_global_init_mem testing
Build with "configure --enable-init-mem-debug" to make the tool use
curl_global_init_mem() and a set of private memory funtion callbacks for
libcurl's memory management.

Using this setup, memory mixups in tool code is more likely to cause
crashes and thus get discovered while running tests.

This curl_global_init_mem debug mode can only be done when building
libcurl shared (not static) and without debugging enabled - since it
needs to use the custom memory funtion callbacks.

Closes #21099
2026-03-27 08:10:14 +01:00
Daniel Stenberg
6041b9b11b
src: use ftruncate() unconditionally
Systems without it need to provide a custom alternative just like we
have have for Windows. This adds an MSDOS version that fails if trying
to truncate a too large file.

Closes #21109
2026-03-27 08:05:48 +01:00
Daniel Stenberg
d63432d1f8
tool_cb_hdr: only truncate etags output when regular file
When sending the output to stdout it cannot truncate.

Add test1619 to verify --etag-save to stdout

Spotted by Codex Security

Closes #21103
2026-03-26 23:39:28 +01:00
Daniel Stenberg
e1fdbdd16f
hsts: when a dupe host adds subdomains, use that
Otherwise a weaker earlier entry is allowed to override a later more
restrictive one.

Add test 1638 to verify.

Closes #21108
2026-03-26 23:27:24 +01:00
Viktor Szakats
5172ba5475
GHA: try workaround for slow Azure Ubuntu distro server
It's been going on for almost a year, chances seem slim to have this
fixed upstream.

The observed issue is that on GitHub-supplied CI runner images,
sometimes, `apt-get install` using the stock distro server
`http://azure.archive.ubuntu.com/ubuntu` sees extreme slowness while
downloading data, then reaching the job timeout and aborting, making CI
red and necessitating a manual restart of the failed job(s).

In majority of cases the install step takes no longer than 8-40 seconds
(download + install), while in the failing case it takes 10-20+ minutes
just to download.

Earlier I slimmed down installs to avoid unnecessary packages, which
mitigated, but did not completely fix the issue.

Example:
https://github.com/curl/curl/actions/runs/23599596928/job/68725576899?pr=21105

Follow-up to 0455d8772a #18509

Closes #21107
2026-03-26 23:05:59 +01:00
Viktor Szakats
128c252975
GHA/curl-for-win: pass GH token to the containers
To avoid rate limits when accessing GH APIs during the build.

Aiming to avoid (while trying to retrieve a file timestamp):
```
++ [[ 2026-02-11-1a84aee6387d2f9c9531c655edeea4a80aa0fcfa =~ (.+)-([a-f0-9]{40,}) ]]
++ ver=2026-02-11
++ commit=1a84aee6387d2f9c9531c655edeea4a80aa0fcfa
++ set +x
curl: (22) The requested URL returned error: 403
curl: (22) The requested URL returned error: 403
curl: (22) The requested URL returned error: 403
curl: (22) The requested URL returned error: 403
[...]
```
Ref: https://github.com/curl/curl/actions/runs/23598912140/job/68723120977?pr=21104

Follow-up to:
a26898fe48
17f2fb3ead
6dd6e47e98
b461404b5a

Closes #21105
2026-03-26 16:08:37 +01:00
Viktor Szakats
20914e3753
perl: harden external command invocations
In `adddocsref.pl`, `checksrc-all.pl`, `singleuse.pl` and tests 307, 1013,
1022, 1275, 1707, 1708, 1710.

Closes #21097
2026-03-26 14:20:07 +01:00
Viktor Szakats
a56ab9dbc8
cmake: add CMake Config-based dependency detection for c-ares, wolfSSL
For wolfSSL it requires v5.2.1+, and with 5.9.0+ it's also supported when
wolfSSL was built with autotools.

Follow-up to 8fce3e17e6 #20814

Closes #21098
2026-03-26 11:20:03 +01:00
Daniel Stenberg
f660b77f74
DEPRECATE.md: fix copy-and-paste mistaken subtitles
Closes #21102
2026-03-26 11:06:25 +01:00
Daniel Stenberg
897f7143c5
docs/VERIFY.md: verify curl
Don't trust, verify!

Closes #21085
2026-03-26 07:57:25 +01:00
Daniel Stenberg
970f0a8cec
cleancmd.pl: remove markdown links before spellcheck
Closes #21085
2026-03-26 07:57:19 +01:00
Daniel Stenberg
0c14ed62c4
location/follow: mention netrc
Closes #21091
2026-03-26 07:56:42 +01:00
Viktor Szakats
bf6a34d8eb
md4, md5: switch to wolfCrypt API in wolfSSL builds
Replacing the OpenSSL-like compatibility interface, and syncing with other
hashes, when building with wolfSSL.

Also: stop stomping on OpenSSL public MD4 symbols. This makes the wolfSSL
coexist workaround unnecessary, while also syncing up with MD5 sources.

After this patch the only remaining reference to wolfSSL's OpenSSL
compatibility layer is in `lib/curl_ntlm_core.c`.

Closes #21093
2026-03-25 18:56:40 +01:00
Viktor Szakats
486334509f
curl_ntlm_core: drop redundant PP condition
`LIBWOLFSSL_VERSION_HEX` is always present in supported wolfSSL
versions.

Closes #21096
2026-03-25 18:56:40 +01:00
Viktor Szakats
afa71f1a22
spacecheck: verify filename lengths and characters
Maximum filename length 64, of which 48 maximum for the filename part.
Allowed characters: `A-Za-z0-9/._-`.

Also:
- rename a file to pass the check.
- init max constants outside the loop.
- minor fix to an error message.
  Follow-up to 62d77b12fc #21087

Closes #21095
2026-03-25 18:56:40 +01:00
Stefan Eissing
dc9a03e855
multi: multi_wait fixes after #20832
The refactoring in #20832 introduced some inconsistencies between
windows and posix handling, pointed out by reviews. Fix them:

- rename `wait_on_nop` back to `extrawait` as it was called before
- use multi_timeout() to shorten the user supplied timeout for
  both windows/posix in the same way
- remove the extra multi_timeout() check in the posix function
- Add the multi's wakeup socket for monitoring only when there
  are other sockets to poll on or when the caller wants the
  extra waiting time.

Closes #21072
2026-03-25 12:17:58 +01:00
Stefan Eissing
a186ecf4bf
proxy: chunked response, error code
Add test1715 to check proper handling of chunked transfer
encoding in CONNECT responses. Change proxy error code from
56 (RECV_ERROR) for everything to 7 (COULDNT_CONNECT) when
the server response could be read successfully, but establishing
the connection is not possible (http status code wrong).

Adapt several test expectations from 56 to 7.

Closes #21084
2026-03-25 12:16:21 +01:00
Stefan Eissing
39036c9021
async-thrdd: use thread queue for resolving
Use a thread queue and pool for asnyc threaded DNS resolves.
Add pytest test_21_* for verification.

Add `CURLMOPT_RESOLVE_THREADS_MAX` to allow applications to
resize the thread pool used.

Add `CURLMOPT_QUICK_EXIT` to allow applications to skip thread
joins when cleaning up a multi handle. Multi handles in
`curl_easy_perform()` inherit this from `CURLOPT_QUICK_EXIT`.

Add several debug environment variables for testing.

Closes #20936
2026-03-25 12:14:21 +01:00
Daniel Stenberg
507e7be573
url: do not reuse a non-tls starttls connection if new requires TLS
Reported-by: Arkadi Vainbrand

Closes #21082
2026-03-25 11:23:37 +01:00
Viktor Szakats
62d77b12fc
spacecheck: check long lines and repeat spaces, fix fallouts
Verify if lines are not longer than 192 characters. Also verify if lines
have less than 79 repeat spaces (and fix one fallout).

To improve readability by avoiding long lines and to prevent adding
overly long lines with text that may go unnoticed in an editor or diff
viewer.

In addition to pre-existing line length limits: 79 for C, 132 for CMake
sources.

Also:
- spacecheck: fix/harden allowlist regexes.
- spacecheck: tidy-up quotes and simplify escaping.
- spacecheck: allow folding strings with repeat spaces.
- GHA: fix a suppressed shellcheck warning.
- GHA/macos: simplify by dropping brew bundle.
- test1119.pl: precompile a regex.
- FAQ.md: delete very long link to a Windows 7/2008 support article
  that's lost it relevance.

Closes #21087
2026-03-25 11:02:08 +01:00
Viktor Szakats
ff3251a538
sha256, sha512_256: switch to wolfCrypt API
Replacing the OpenSSL-like compatibility interface, and syncing with
existing API use within lib/wolfssl.c for SHA-256.

Ref: https://www.wolfssl.com/documentation/manuals/wolfssl/group__SHA.html

Follow-up to 28f0932073 #21077
Follow-up to 988b352f91 #21078

Closes #21090
2026-03-25 11:02:08 +01:00
Viktor Szakats
988b352f91
sha256: support delegating to wolfSSL API
Offered by wolfSSL v3.11.0+ (2017-05-04).

Closes #21078
2026-03-24 19:29:21 +01:00
Viktor Szakats
28f0932073
curl_sha512_256: support delegating to wolfSSL API
Offered by wolfSSL v5.0.0+ (2021-11-01).

Closes #21077
2026-03-24 19:29:21 +01:00
Stefan Eissing
797bc316bf
ratelimit: reset on start
On any `Curl_rlimit_start()` the rate limit needs to reset its
values before calculating the effective step duration and adjust
the tokens/burst per step.

Add two fields to the struct to remember the original values.

Closes #21086
2026-03-24 16:25:53 +01:00
Viktor Szakats
372d721e92
wolfssl: document v5.0.0 (2021-11-01) as minimum required
The previously documented version was based on version checks made in
the source. In practice though, curl doesn't build with <5.0.0.

Also:
- bump main internal version check.
- drop superfluous internal version checks.

Closes #21080
2026-03-24 11:08:23 +01:00
Daniel Stenberg
18f88739ff
tool_setopt: return error on OOM correctly
When generating mime code for the --libcurl option.

Follow-up to acdb48272a

Spotted by Codex Security

Closes #21083
2026-03-24 10:48:03 +01:00
Patrick Monnerat
54f4937729
OS400: add new definitions to the ILE/RPG binding.
Also update supported protocols list in README.OS400.

Fixes #20672
Closes #21066
2026-03-24 09:27:48 +01:00
Daniel Stenberg
949b1ff34e
RELEASE-NOTES: synced 2026-03-24 09:09:30 +01:00
Daniel Stenberg
5023d2fe27
DEPRECATE: remove NTLM, SMB and local crypto implementations
Closes #21079
2026-03-24 08:52:54 +01:00
Daniel Stenberg
29dfc0238c
tool_getparam: use correct free function for libcurl memory
Memory returned from curl_easy_escape() should be fred with curl_free()
to avoid surprises.

Follow-up to f37840a46e

Spotted by Codex Security
Closes #21075
2026-03-24 08:49:20 +01:00
Daniel Stenberg
14712fa513
curl_version_info.md: clarify age details
The argument is not used.

Fixes #21052
Reported-by: Dan Fandrich
Closes #21059
2026-03-24 08:17:29 +01:00
Stefan Eissing
6f9f4b3cb7
lib: add thread pool and queue
- new source files for thread pool and queue
- test cases 3217 and 3218 for them
- internal documentation

Closes #20916
2026-03-23 23:03:58 +01:00
Daniel Stenberg
664db28d29
test2405: require wakeup
To get the correct file descriptor count

Reported-by: Marcel Raad
Fixes #21069
Closes #21074
2026-03-23 23:01:01 +01:00
Daniel Stenberg
3ef422e128
lib1560: verify more URLs
- control codes at various places in URL, even when URL encoding
  is requested

- verify zone id extraction more

Closes #21071
2026-03-23 14:35:02 +01:00
Daniel Stenberg
d3fa54a243
config2setopts: make --capath work in proxy disabled builds
Follow-up to 95e8515ca0

Spotted by Codex Security

Closes #21063
2026-03-23 14:33:59 +01:00
Daniel Stenberg
07d109b7c6
test1714: verify telnet download with --max-filesize
(disabled on Windows because of hangs)

Closes #21023
2026-03-23 14:32:46 +01:00
Viktor Szakats
806fd7a0e1
genserv.pl: make external calls safe
By passing command-line as separate arguments instead of using a single
string. This needs skipping the shell, so rework redirections to use
Perl `open3()`.

Also explored to use `-out` to avoid redirections, but it makes the
command-line incompatible with some OpenSSL implementations/versions
(e.g. on default macOS), and would still need a solution for
`2>/dev/null`.

Ref: https://perldoc.perl.org/IPC::Open3

Closes #20971
2026-03-23 12:39:38 +01:00
Daniel Stenberg
8f0e0f9dc7
urldata: make hstslist only present in HSTS builds
Closes #21068
2026-03-23 10:19:45 +01:00
Daniel Stenberg
e0327b2ebb
netrc: remove unused parsenetrc() macro for netrc-disabled
When netrc is disabled, this macro is unused (and wrong).

Closes #21067
2026-03-23 10:19:08 +01:00
Daniel Stenberg
e0be05cbab
urlapi: fix handling of "file:///"
When the path is exactly one byte, a single slash.

Extended test 1560 to verify.

Found by Codex Security

Closes #21070
2026-03-23 10:17:59 +01:00
Daniel Stenberg
0c475b5df7
urlapi: remove redundant condition in dedotdotify
Bonus: remove two variables, clear up some comments.

Poined out by CodeSonar

Closes #21065
2026-03-23 08:26:02 +01:00