Commit graph

38479 commits

Author SHA1 Message Date
Daniel Stenberg
2e3607034d
parsedate: refactor
- introduce 'struct when' to hold the parser result
- initwhen() initializes a 'struct when'
- datestring() parses strings
- datenum() parses numbers
- datecheck() does some final checks
- tzadjust() adds the time zone offset
- convert math to 64 bit, squeeze into time_t only in the last step,
  mktimet() does the time_t storing

Closes #21394
2026-04-21 14:22:07 +02:00
Viktor Szakats
5ff7f77310
wolfssl: fix -Wmissing-prototypes
Seen with unity, H3, wolfssl with `HAVE_EX_DATA`.

Fixing:
```
lib/vtls/wolfssl.c:412:10: error: no previous prototype for function 'Curl_wssl_cache_session' [-Wmissing-prototypes]
  412 | CURLcode Curl_wssl_cache_session(struct Curl_cfilter *cf,
      |          ^
lib/vtls/wolfssl.c:412:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
  412 | CURLcode Curl_wssl_cache_session(struct Curl_cfilter *cf,
      | ^
      | static
1 error generated.
```

Follow-up to cc5c1553fb #19852

Closes #21392
2026-04-21 10:09:58 +02:00
Daniel Stenberg
19695e815c
tool_operate: split create_single into smaller sub functions
Reduces complexity from 58 => 32.

Closes #21389
2026-04-21 08:35:09 +02:00
Daniel Stenberg
4e0bfd8cf7
mprintf: simplify parsefmt
- split out parse_flags() and parse_conversion() to reduce complexity
  from 57 to 30.

Closes #21391
2026-04-21 08:33:28 +02:00
Daniel Stenberg
0838297ad1
lib: minor comment typos
Closes #21388
2026-04-20 23:48:37 +02:00
Stefan Eissing
809dda3a37
Happy Eyeballs: add resolution time delay
HEv3 describes conditions on when first connect attempts shall be
started.
https://www.ietf.org/archive/id/draft-ietf-happy-happyeyeballs-v3-01.html
Chapter 4.2

libcurl now waits 50ms for AAAA and HTTPS results (when requested) to
return before continuing with the connect.

Added HTTPS-RR to the "was resolved" information info message. Changed
logging of HTTPS-RR to a one-liner with RFC 9460 like formatting. This
way the user can see if/what was resolved and used in connecting.

Closes #21354
2026-04-20 23:47:49 +02:00
Viktor Szakats
70a159527c
build: link bcrypt.lib via vcxproj files
And drop pragma from `rand.c`.

Closes #21386
2026-04-20 16:29:25 +02:00
Daniel Stenberg
db13c08c58
lib: fix typos in comments
Closes #21385
2026-04-20 14:56:31 +02:00
Daniel Stenberg
d087a7e4ec
mime: only allow 40 levels of calls
To avoid problems when doing insane things.

Closes #21384
2026-04-20 14:28:43 +02:00
Stefan Eissing
5448495cfd
vtls_scache: check reentrancy
Track lock status of session cache, add DEBUGASSERT()s for proper
calling sequences. Add check of lock status.

Use lock status check to prevent reentry of import/export calls.
Deny such calls with CURLE_RECURSIVE_API_CALL.

Closes #21383
2026-04-20 11:22:00 +02:00
Viktor Szakats
85e825770a
GHA: bump test minimums (more)
Follow-up to 701a8319ec96c0b73c39e16c5db68dd758419c2 #21353

Closes #21382
2026-04-20 10:47:19 +02:00
Viktor Szakats
1fbffe7f08
GHA: use more OpenSSL 4, enable ECH in more jobs
for Linux and macOS.

Closes #21379
2026-04-20 02:53:24 +02:00
Viktor Szakats
4c548b978f
openssl: fix unused variable warnings in !verbose builds
Also fix clang-tidy `readability-redundant-control-flow`.

```
lib/vtls/openssl.c:4055:46: error: unused parameter 'reason' [-Wunused-parameter]
 4055 |                                          int reason)
      |                                              ^
lib/vtls/openssl.c:4279:19: error: variable 'status' set but not used [-Wunused-but-set-variable]
 4279 |       const char *status = NULL;
      |                   ^
```
Ref: https://github.com/curl/curl/actions/runs/24641388439/job/72045859306?pr=21379

```
lib/vtls/openssl.c:4092:7: error: Value stored to 'rv' is never read [clang-analyzer-deadcode.DeadStores]
 4092 |       rv = SSL_ech_get1_status(ssl, &inner, &outer);
      |       ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/vtls/openssl.c:4092:7: note: Value stored to 'rv' is never read
 4092 |       rv = SSL_ech_get1_status(ssl, &inner, &outer);
      |       ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/vtls/openssl.c:4112:3: error: redundant return statement at the end of a function with a void return type [readability-redundant-control-flow]
 4111 | #endif
      | ~~~~~~
 4112 |   return;
      |   ^~~~~~~
 4113 | }
```
Ref: https://github.com/curl/curl/actions/runs/24642154148/job/72047919525?pr=21379#step:42:186

Cherry-picked from #21379

Closes #21380
2026-04-20 02:37:35 +02:00
Dag-Erling Smørgrav
759f2e5d97
tests: avoid infinite recursion for make check
The combination of a misspelled directory name and failing to check the
result of cd leads to infinite recursion as `make check` simply invokes
itself over and over.

Follow-up to 00887aee8c #18079
Closes #21378
2026-04-20 00:44:21 +02:00
Dag-Erling Smørgrav
6506693f0b
lib1960: fix test failure
On platforms where struct sockaddr has a length field, the current code
leaves it uninitialized, resulting in a test failure when valgrind is
used.

Closes #21377
2026-04-20 00:44:21 +02:00
Stefan Eissing
ebed4aaf01
ws: fix a blocking curl_ws_send() to report written length correctly
Fixes #21372
Reported-by: Yiwei Hou
Clkoses #21373
2026-04-20 00:06:55 +02:00
Viktor Szakats
9e38e06769
GHA: keep testing 3 as openssl-prev, bump mainline to 4
Ref: #21317
Ref: #21316

Closes #21376
2026-04-19 14:05:46 +02:00
renovate[bot]
23a06e1fb9
GHA: update dependency libressl/portable to v4.3.1
Closes #21365
2026-04-19 11:54:47 +02:00
Viktor Szakats
07e9f73f32
runtests: skip setting ed25519 SSH key format
`ssh-keygen -t ed25519` does not support PEM key format, and it
defaults to `RFC4716` which is what we want.

It affected GHA/windows tests that explicitly used ed25519 keys.

Also:
- GHA/windows: bump minimums to hopefully catch this early next time.
  1701a8319e #21353
- merge two Perl lines.

Reported-by: herbenderbler on github
Fixes #21360
Follow-up to acda4eae5e #21223

Closes #21374
2026-04-19 11:53:18 +02:00
renovate[bot]
fc7bd0704e
GHA: update dependency nghttp2/nghttp2 to v1.69.0
Closes #21375
2026-04-19 11:52:11 +02:00
Daniel Stenberg
54ded66618
docs/libcurl: improve easy setopt examples
- always assign the curl_easy_perform() return code (and declare
  the necessary 'result' variable for it)

- always call curl_easy_cleanup() on the created easy handles

Closes #21364
2026-04-18 23:34:39 +02:00
Daniel Stenberg
1cc683c859
CURLOPT_RTSP_SESSION_ID.md: expand the comment
Enhance the example code

Closes #21363
2026-04-18 23:32:09 +02:00
Daniel Stenberg
d129ff355d
CURLOPT_RTSP_SESSION_ID.md: minor language fix 2026-04-17 22:40:49 +02:00
Stefan Eissing
e0b2ec2400
pytest: check 429 handling
Add a "limit" handler to httpd that responds 429 after 5 requests and
then 429s all requests for 2 seconds. After which another 4 requests are
served before 429 strikes again.

Closes #21357
2026-04-17 22:17:50 +02:00
Daniel Stenberg
6daf4bc7e2
http: clear digest nonce on cross-orgin redirect
Verify in test 1966

Reported-by: Yalguun Tumenkhuu
Closes #21359
2026-04-17 22:16:08 +02:00
Daniel Stenberg
97cf21acd2
CURLOPT_RTSP_SESSION_ID.md: clarify reuse "dangers"
When re-using easy handles the session id stays, unless you do something
about it.

Closes #21358
2026-04-17 17:48:22 +02:00
Viktor Szakats
a06fd64974
unit1658: rename CURLcode to result
Closes #21356
2026-04-17 13:34:44 +02:00
Viktor Szakats
1701a8319e
GHA: bump required test minimums
Ref: https://testclutch.curl.se/static/reports/feature-matrix.html

Closes #21353
2026-04-17 13:10:43 +02:00
Viktor Szakats
5e45e82bc9
lib506: rename CURLcode variable to result
Closes #21352
2026-04-17 12:09:14 +02:00
Viktor Szakats
b515a71356
unit1675: fix -Wformat-signedness
Closes #21351
2026-04-17 12:09:14 +02:00
Stefan Eissing
70281e39be
haproxy: use correct ip version on client supplied address
When a user supplies an IP address to use for the HAPROXY protocol,
the IP version reported must be deduced from the address and has
no relation to the IP version used for the upstream connection.

Add test3220 to verify.

Fixes #21340
Reported-by: Fiona Klute
Closes #21341
2026-04-17 10:01:49 +02:00
Viktor Szakats
021a87cf81
vtls_scache: rename CURLcode variable to result
Closes #21346
2026-04-16 22:57:17 +02:00
Daniel Stenberg
bb771cec34
RELEASE-NOTES: synced 2026-04-16 22:56:46 +02:00
Stefan Eissing
a973377cd7
dnsd: implement HTTPS-RR with alpn pref and no-default-alpn
Support HTTPS records in dnsd that have ALPN preferences.

Add pytest test_22_* to verify that HTTPS record ALPN
preferencces take effect if the HTTPS resolve arrives in time.

Fix HTTPS eyeballing use of timeouts for second attempt. Also,
make an initial HTTP/1.1 attempt switch off HTTP/2.

Closes #21329
2026-04-16 22:53:20 +02:00
Stefan Eissing
1bf1f8ed6a
pytest_05_09: increase reliability
Test has been flaky due to not waiting for the test server to be
listening. On slow CI systems, the started thread is late and the curl
command gets a refused connection.

Closes #21337
2026-04-16 22:52:13 +02:00
Daniel Stenberg
885b553545
lib: rename more CURLcode variables to 'result'
Closes #21348
2026-04-16 22:50:52 +02:00
Daniel Stenberg
b4024bf808
http: clear credentials better on redirect
Verify with test 2506: netrc with redirect using proxy

Updated test 998 which was wrong.

Reported-by: Muhamad Arga Reksapati

Closes #21345
2026-04-16 21:51:41 +02:00
Viktor Szakats
3e0e2cc1ab
GHA: drop 3rd-party apt source docker.list
Seen on `ubuntu-slim` runners.

Also:
- extend to two jobs to `ls -l` package sources on both ubuntu-latest,
  ubuntu-24.04-arm, and ubuntu-slim.
- drop former stray apt source `ondrej-ubuntu-php-noble.sources`.
  It's no longer present on the image.

Closes #21344
2026-04-16 15:37:13 +02:00
renovate[bot]
0a6f815ff7
GHA/http3-linux: update dependency ngtcp2/ngtcp2 to v1.22.1
Closes #21343
2026-04-16 15:08:16 +02:00
Stefan Eissing
32a513e180
urlapi: same origin tests
Add new internal `curl_url_same_origin()` to check if a href has the
same origin as a base URL. Add test cases in test1675 and use this in
http2 push handling.

Closes #21328
2026-04-16 15:00:43 +02:00
Viktor Szakats
ce7174555d
build: adjust/add casts to fix -Wformat-signedness
Also adjust a mask in `mqttd.c`.

Follow-up to 548c16a824 #21335
Cherry-picked from #20848

Closes #21339
2026-04-16 11:38:14 +02:00
Daniel Stenberg
7e450cb80a
libssh2: allocate libssh2-friendly memory in kbd_callback
The function libssh2_userauth_keyboard_interactive_ex() calls the
callback and is documented to call free() on the memory returned to
libssh2 from the callback. libcurl can therefore not use the regular
curlx_strdup() for this, as that is not compatible in debug builds or
when curl_global_init_mem() is used.

Fixes #21336
Closes #21338
2026-04-16 10:35:32 +02:00
Viktor Szakats
548c16a824
build: fix -Wformat-signedness by adjusting printf masks
- sync printf masks with the passed value.
- fix a couple of casts.

Cherry-picked from #20848

Closes #21335
2026-04-16 10:32:50 +02:00
Daniel McCarney
54cc65595d
ci: update RUSTLS_VERSION 0.15.1 -> 0.15.2
Closes #21333
2026-04-15 23:34:33 +02:00
Daniel Stenberg
7fd35f4c34
unittests: cleanups
- make sure all UNITTEST prototypes mark in which unit test they are used,
  with "@unittest" markup

- make sure all UNITTEST functions do not use Curl_ prefix, as that is a
  prefix we use for global private functions and these functions are static
  and therefore not global and the prefix is wrong

- drop UNITTEST for functions not used in unit tests

- make the extract-unit-protos script highlight the above issues if found

- extract-unit-protos now also outputs the unit test number for all the
  generated protos in lib/unitprotos.h to aid readers. It also adds the source
  file and line number where the proto originates from.

- extract-unit-protos now exits with a non-zero value if any of the above
  warnings are triggered

- cf-dns: Curl_cf_dns_result => static cf_dns_result
- hostip: Curl_ipv6works => static ipv6works
- url: remove Curl_setup_conn() - not used anymore
- connect: Curl_timeleft_now_ms => UNITTEST timeleft_now_ms

Closes #21330
2026-04-15 23:32:38 +02:00
Viktor Szakats
94f14c54b0
renovate: use standard bump formula for OpenSSL
Cherry-picked from #21317

Closes #21323
2026-04-15 10:17:33 +02:00
Viktor Szakats
ce2f65c415
pytest: fix dnsd pid filename
Spotted by GitHub Code Quality

Follow-up to a5542c23e7 #21289

Closes #21321
2026-04-15 10:17:33 +02:00
Daniel Stenberg
fa057ea3de
transfer: clear the old autoreferer
Verify in test 2505

Closes #21322
2026-04-15 10:15:25 +02:00
Daniel Stenberg
c60d90cd65
urlapi: make parse_file() return zero data on error
This fixes the torture failures in 1675

Also, make it allocate the scheme *after* the path has been verified, so
that it is avoided in the common error cases.

Fixes #21326
Closes #21324
2026-04-15 10:14:09 +02:00
Viktor Szakats
36295347bc
GHA/linux: tidy up and extend address-sanitizer job options
Also tried `integer` which has hits, but too slow to be practical to run on
every commit.

Closes #20785
2026-04-14 23:39:42 +02:00