Commit graph

7470 commits

Author SHA1 Message Date
Dan Fandrich
478e280278 tests: fix unit1636 with --disable-progress-meter
Closes #21500
2026-05-06 21:46:40 -07:00
Daniel Stenberg
2cb6ba672d
hsts: rename Curl_hsts() to hsts_check() and make it static
It is no longer used outside of hsts.c

Closes #21507
2026-05-05 17:46:51 +02:00
Daniel Stenberg
117d50b4bf
thrdqueue: make thrdq_await_done only for unit tests
It is not used for anything else, so drop Curl_ and make it conditional
accordingly.

Closes #21499
2026-05-05 08:55:49 +02:00
Daniel Stenberg
f59733be23
setopt: changing the proxy port is also a proxy change
Test 1589 verifies.

Closes #21485
2026-05-04 00:14:06 +02:00
dependabot[bot]
47755c4e69
GHA: bump actions and pips
- update action `actions/cache` from 5.0.4 to 5.0.5
- update action `actions/upload-artifact` from 7.0.0 to 7.0.1
- update action `github/codeql-action` from 4.32.4 to 4.35.2
- update action `msys2/setup-msys2` from 2.31.0 to 2.31.1

- update pip `filelock` from 3.25.2 to 3.29.0
- update pip `impacket` to 0.13.0
- update pip `ruff` from 0.15.10 to 0.15.12

Closes #21483
Closes #21482
2026-05-01 21:19:22 +02:00
Viktor Szakats
91232fc2a2
tidy-up: miscellaneous
- sha256: fix backend priority in comment.
- URLs: link to IETF URLs to the HTML document, to match others.
- VERSIONS.md: use unified date format for recent entries too.
  Ref: ce5d32032f
- GHA/labeler.yml: alpha-sort file masks in a label block.
- tests/server/mqttd: fix call arg list in a disabled function.
- tests/server/mqttd: fix comment.

Closes #21473
2026-04-30 20:22:23 +02:00
Raymond Steen
2bb5c9b555
mqtt: validate PINGRESP and DISCONNECT have remaining_length == 0
Per MQTT 3.1.1 sections 3.13.1 and 3.14.1, PINGRESP and DISCONNECT fixed
headers must have remaining_length set to zero. The previous code
dispatched to mqtt->nextstate based on the queued state alone without
validating remaining_length for these no-payload packet types, allowing
a malicious broker to send a PINGRESP with non-zero remaining_length
whose trailing bytes would be interpreted as the payload of whatever
message type was queued (CONNACK, SUBACK, etc.).

The exploitation path turned out to be narrow — curl sends data to the
server the user chose to talk to — but the spec violation and the
resulting protocol-state error are real. Reject the malformed packets
with CURLE_WEIRD_SERVER_REPLY before state dispatch.

Reported-by: Raymond Steen <raymond@vortiqxconsilium.com>
Found by VORTIQ-X VXF Framework
Bug: https://hackerone.com/reports/3702718

Signed-off-by: Raymond Steen <raymond@vortiqxconsilium.com>
Closes #21465
2026-04-30 14:14:44 +02:00
Viktor Szakats
377ed81ab7
tidy-up: a cmake warning message and a variable name
Spotted by GitHub Code Quality

Closes #21462
2026-04-28 09:07:27 +02:00
Viktor Szakats
0f47ddc0a9
build: stop building and installing runtests.1 and testcurl.1
The corresponding tools are never installed, and both are dev tools.
Refer to their `.md` originals instead.

Also markdownify text in lines nearby.

Ref: https://github.com/curl/curl/pull/21460#issuecomment-4328258450

Closes #21461
2026-04-28 09:07:27 +02:00
Viktor Szakats
032ea65ff2
tidy-up: whitespace
Closes #21456
2026-04-27 13:34:27 +02:00
Viktor Szakats
13b6a6036c
tool_dirhie: fix to create drive-relative directory
Fix to create the top directory `foo` when specified as
`X:foo\bar\filename`, on Windows and MS-DOS. Add test to verify.

Caught by Codex Security

Follow-up to 787ee935ac #16566

Closes #21449
2026-04-27 12:09:09 +02:00
Viktor Szakats
e2f84e6ba9
tunits: initialize global tool_stderr
To avoid difficult to track down crashes when a tested function ends up
outputing a message via `errorf()`, `warnf()` or siblings.

Cherry-picked from #21449

Closes #21454
2026-04-27 11:53:47 +02:00
Viktor Szakats
4d89043fbc
runtests: fix linefeeds in log messages
Cherry-picked from #21449

Closes #21452
2026-04-27 11:53:47 +02:00
Viktor Szakats
aab8d47227
units: tidy up dynbuf init
Init dynbuf after global init to bring closer to use, improve
readability and sync test sources.

Closes #21451
2026-04-27 11:53:47 +02:00
Daniel Stenberg
c1cfdf59ac
setopt: clear proxy auth properties when switching
Verify with test 1588

Closes #21453
2026-04-27 10:27:01 +02:00
Viktor Szakats
024c73dfa1
test_22_httpsrr: avoid class name clash with test_21_resolve
Spotted by GitHub Code Quality

Closes #21448
2026-04-25 14:20:42 +02:00
Viktor Szakats
c6b1c49be0
test_22_httpsrr: drop duplicate skipif conditions
Already set at class-level.

Spotted by GitHub Code Quality

Closes #21446
2026-04-25 13:59:20 +02:00
Viktor Szakats
05905b1207
pytest: drop unused imports
Spotted by GitHub Code Quality

Closes #21445
2026-04-25 12:38:07 +02:00
Viktor Szakats
4449110561
sshserver.pl: tidy up around AllowUsers setup
- drop redundant space-to-`?` replacement.
- add parentheses to silence code checker.
- tidy up comments.

Follow-up to e53523fef0 #14859

Closes #21442
2026-04-25 08:42:54 +02:00
Viktor Szakats
41f3f94d91
sshserver.pl: add option to enable KEX algorithms in sshd
Necessary when the libssh2/libssh client library does not support KEX
algos offered by default by the OpenSSH server. E.g. libssh2 with WinCNG
combined with OpenSSH 10+.

Also: use this option in GHA/windows.

Follow-up to 3b8bb1a86a #21219
Follow-up to c98d0a2e9a #21220

Closes #21438
2026-04-24 17:09:21 +02:00
Viktor Szakats
0d3d9f2222
checksrc: add missing semicolon, fix IFDEFSINGLE capture group
Pointed out by GitHub Code Quality

Closes #21435
2026-04-24 11:08:56 +02:00
Daniel Stenberg
2f37943406
tests: drop support for the hex="yes" option in getpart
The remaining datacheck sections using this for MQTT tests were not
actually used anyway!

Closes #21428
2026-04-24 10:42:34 +02:00
Viktor Szakats
ee65f19e2a
checksrc: fix code quality findings
- fix counting errors. Update test1185 results accordingly.
- fix an error message.
- tidy up regexp syntax.

Pointed out by GitHub Code Quality

Closes #21429
2026-04-24 09:46:35 +02:00
Daniel Stenberg
b16be8e244
tool_operate: reset the upload glob counter for next URL
Fixes #21402

Adjust test 2012 and 2013 accordingly

Closes #21403
2026-04-22 07:50:59 +02:00
Daniel Stenberg
dcf535629b
tool_operate: keep the filename for upload globbing
Follow-up to 19695e815c

Verify with test 2012 and 2013

Closes #21401
2026-04-21 23:11:42 +02:00
Daniel Stenberg
779bba2f3f
runtests: allow %EMPTY in <stdout> to verify no output 2026-04-21 17:22:11 +02:00
Daniel Stenberg
4daf483b5b
lib557: add tests with flags AND conversion specifier
Remove superfluous and never-built test code for systems with 16-bit and
64-bit ints and 16-bit longs, as we don't know any such.
2026-04-21 15:21:16 +02:00
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
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
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
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
Viktor Szakats
a06fd64974
unit1658: rename CURLcode to result
Closes #21356
2026-04-17 13:34:44 +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
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
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
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
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 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
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
3a19987a87
urldata: move cookiehost to struct SingleRequest
To make it scoped for the single request appropriately.

Reported-by: Muhamad Arga Reksapati

Verify with libtest 2504: a custom Host *disabled* on reused handle

Closes #21312
2026-04-14 16:59:11 +02:00
Stefan Eissing
86f1e5b3f6
test dnsd: implement delayed responses
Add "Delay-A: ms", "Delay-AAAA: ms" and "Delay-HTTPS: ms" to the test
dnsd config and implement delayed response handling.

Add test_21_09 and test_21_10 to check that delayed responses connect
using the undelayed address family.

Closes #21299
2026-04-14 16:49:07 +02:00
Daniel Stenberg
0567e72168
tests: use %b64[] instead of "raw" base64
Closes #21313
2026-04-14 16:18:14 +02:00
Daniel Stenberg
188c2f166a
http: clear the proxy credentials as well on port or scheme change
Add tests 2009-2011 to verify switching between proxies with credentials
when the switch is driven by a redirect

Reported-by: Dwij Mehta

Closes #21304
2026-04-14 16:14:51 +02:00