Commit Graph

35949 Commits

Author SHA1 Message Date
Viktor Szakats
3a8920e5ed
GHA/windows: drop handle64.exe
To test its effect on stability/flakiness of Windows jobs.

Ref: https://github.com/curl/curl/pull/16484#issuecomment-2705016375
Cherry-picked from #16484
Closes #16600
2025-03-06 23:47:27 +01:00
Viktor Szakats
2d94439eaa
sectransp: add support for HTTP/2 in gcc builds
Before this patch `--http2` did not work in gcc builds with Secure
Transport, because ALPN relied on a compiler supporting the
`HAVE_BUILTIN_AVAILABLE` aka `__builtin_available()` feature. This
is clang-specific and missing from gcc (as of gcc v14).

Add support for ALPN and HTTP/2 when this compiler feature is missing.

Also drop test exceptions from GHA/macos in CI.

Follow-up to 092f6815c8
Ref: c349bd668c #14097 (issue 15.)
Ref: #4314

Closes #16581
2025-03-06 20:33:43 +01:00
Viktor Szakats
9463769f2e
tests: reformat error messages to avoid tripping MSBuild
Change the format of error messages sent to stderr from tests and test
servers. As a workaround to avoid triggering Visual Studio's MSBuild
tool's built-in regexp matcher, and making it mark builds failed for
reasons we don't want them to hard fail.

Roughly, the pattern to avoid is the word "error" (case-insensitive)
in the same line with a colon `:`.

It affected GHA/windows MSVC CI jobs, causing flakiness:
```
CUSTOMBUILD : fopen() failed with error : 13 Permission denied [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
  Error opening file: log/4/smtp_sockfilt.log
[...]
CUSTOMBUILD : fopen() failed with error : 13 Permission denied [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
  Error opening file: log/8/imap_sockfilt.log
  Msg not logged: 00:18:10.656000 > 178 bytes data, server => client
[...]
  TESTDONE: 1629 tests out of 1634 reported OK: 99%
  Building Custom Rule D:/a/curl/curl/tests/CMakeLists.txt
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\a\curl\curl\bld\CMakeFiles\621f80ddbb0fa48179f056ca77842ff0\test-ci.rule;D:\a\curl\curl\tests\CMakeLists.txt' exited with code -1. [D:\a\curl\curl\bld\tests\test-ci.vcxproj]
Error: Process completed with exit code 1.
```
Ref: https://github.com/curl/curl/actions/runs/13643149623/job/38137076210?pr=16490#step:14:3125
Ref: https://github.com/curl/curl/actions/runs/13688765792/job/38277961720?pr=16582#step:14:1717

The `IgnoreStandardErrorWarningFormat="true"` MSBuild Exec option
controls this behavior:
https://learn.microsoft.com/visualstudio/msbuild/exec-task#parameters
I couldn't figure out a way to apply it to CMake builds.

MSBuid pattern matching rules:
353c0f3d37/src/Shared/CanonicalError.cs
https://learn.microsoft.com/visualstudio/msbuild/msbuild-diagnostic-format-for-tasks

Note: There may be further error messages output from runtests scripts,
that use this format, which are not explicitly fatal. They may need
future fixes.

Thanks-to: Dion Williams
Ref: https://github.com/curl/curl/discussions/14854#discussioncomment-12382190
Ref: https://github.com/curl/curl/discussions/14854#discussioncomment-12395224

Closes #16583
2025-03-06 20:09:29 +01:00
Viktor Szakats
8537a5b0bc
windows: do not use winsock2 inet_ntop()/inet_pton()
Disable these winsock2 functions on Windows to use the curl wrappers
and preserve `WSAGetLastError()` aka `SOCKERRNO` error codes.

curl sources uses `inet_pton()` and `inet_ntop()` via its own `Curl_`
prefixed wrappers. These wrappers promise to not overwrite
`WSAGetLastError()` aka `SOCKERRNO` error codes when calling them.
But, for Windows builds with these built-in winsock2 functions detected
(meaning all supported Windows versions, except Windows CE),
the wrappers were 1-to-1 mapped to the winsock2 functions, which broke
this promise.

b06c12b724/lib/inet_ntop.c (L188-L190)
b06c12b724/lib/inet_pton.c (L66-L70)

These promises are old (a1d5983991) and
may not be valid anymore. In this case, the callers would have to be
updated to use `SOCKERRNO` to retrieve any error, instead of using
`errno` as they do now.

https://learn.microsoft.com/windows/win32/api/ws2tcpip/nf-ws2tcpip-inet_ntop
https://learn.microsoft.com/windows/win32/api/ws2tcpip/nf-ws2tcpip-inet_pton

Closes #16577
2025-03-06 20:09:25 +01:00
Daniel Stenberg
ff86c1951b
RELEASE-NOTES: synced 2025-03-06 16:48:46 +01:00
Ethan Wilkes
fa3d1e7d43
ws: corrected curlws_cont to reflect its documented purpose
Verified in test 2311

Closes #16512
2025-03-06 16:38:05 +01:00
Daniel Stenberg
a66ede5309
multi: start the loop over when handles are removed
Since more than one handle can be removed in a single call to
multi_runsingle(), we cannot easily continue on the next node when a
node has been removed since that node migth ALSO have been removed.

Reported-by: Philippe Antoine
Closes #16588
2025-03-06 16:10:49 +01:00
Daniel Stenberg
a7fda9a8f4
tool_parsecfg: make my_get_line skip comments and newlines
- brings this functionality to all users of this function automatically
  and consistently

- consistently returns every line without trailing \n

Closes #16590
2025-03-06 16:09:37 +01:00
Daniel Stenberg
d398fffae0
docs/HISTORY: add some events from the last year
Closes #16587
2025-03-06 16:06:17 +01:00
Zhang Wen
e51c494ed1
tool_operate: change "1 retries" to "1 retry"
Closes #16586
2025-03-06 16:04:39 +01:00
Stefan Eissing
556f722fe3
tests/certs: cleanup
Keep only the generated files needed for tests. Place generated
intermediaries in `tests/certs/gen` where they are ignored by git. No
longer generated `*.dhp` files.

Have a shorter naming scheme: `test-ca` instead of `EdelCurlRoot-ca` and
`test-localhost` instead of `Server-localhost-sv`, etc.

Remove the `stunnel` certificate as it was nearly a duplicate of
`test-localhost`.

No longer copy a generated certificates to `tests/stunnel.pem`. Let test
server default to `certs/test-localhost.pem` instead.

Closes #16593
2025-03-06 16:02:34 +01:00
Martxel
f5cb83e493
openssl: fix pkcs11 URI checking for key files.
Closes #16591
2025-03-06 16:00:22 +01:00
Viktor Szakats
64ba75ca90
cmake: fix detection pre-fills for iOS
Follow-up to 1ecf2f1113 #16585
Follow-up to e7adf3e837 #15841

Closes #16594
2025-03-06 14:01:28 +01:00
Viktor Szakats
b51672e932
GHA/windows: drop test exclusions from MSYS jobs
Re-enable running tests 19, 504, 704, 705, 1233 in CI MSYS jobs.

We carried over these exceptions from AppVeyor CI, where they have been
present for a long time. Cygwin jobs do not need these exceptions and
Cygwin and MSYS are similar envs. Time to re-evaluate if skipping them
is still necessary on MSYS.

Closes #16592
2025-03-06 13:17:15 +01:00
Viktor Szakats
1ecf2f1113
build: set HAVE_STDINT_H if stdint.h is available
Ref: #15907

Closes #16585
2025-03-06 13:17:15 +01:00
Viktor Szakats
8fbd372e0d
tests: mark tests 1631, 1632 flaky
We already marked them flaky in GHA/macos CI. They are also flaky in
other CI jobs, in other OSes, with multiple TLS backends:
- MSVC/LibreSSL: https://github.com/curl/curl/actions/runs/13683996410/job/38262956317
- MSVC/wolfSSL: https://github.com/curl/curl/actions/runs/13680682695/job/38252047077
- FreeBSD/OpenSSL3: https://github.com/curl/curl/actions/runs/13690910863/job/38283867721#step:3:1

Ref: fa461b4eff #14486

Closes #16584
2025-03-06 13:17:15 +01:00
Viktor Szakats
cfbd46d8b3
GHA/macos: stop ignoring test 2100 with gcc
It runs fine now. Tested in all gcc-12 jobs after temporarly enabling
debug in them all (test 2100 requires debug-enabled).

Ref: c349bd668c #14097 (issue 15.)

Closes #16582
2025-03-06 13:17:14 +01:00
Viktor Szakats
c38f9089f3
lib1156: pass longs to curl_easy_setopt()
To fix this test on macOS with the gcc compiler.

Also unignore test 1156 in GHA/macos.

Ref: c349bd668c #14097 (issue 15.)
Ref: 7b0240c077 #16539
Ref: 2ec00372a1 #16482

Closes #16579
2025-03-06 01:35:30 +01:00
Viktor Szakats
fd54bed51a
curl.h: switch CURL_HTTP_VERSION* enums to long constants
It fixes tests 1539, and 2402, 2404 (for non-Secure Transport), on macOS
with the gcc compiler.

Also unignore these tests in GHA/macos for non-secure transport.

Ref: c349bd668c #14097 (issue 15.)
Ref: 7b0240c077 #16539
Ref: 2ec00372a1 #16482

Closes #16580
2025-03-06 01:01:24 +01:00
Daniel Stenberg
f9ec5d89cb
tests/certs: drop the empty .dhp files
They are not used for anything.

Closes #16576
2025-03-05 23:41:57 +01:00
Viktor Szakats
05c0a6e270
GHA/macos: restore nghttp2 package for runtests HTTP/2 tests
Regression from e7751571eb #16517
2025-03-05 22:57:49 +01:00
Viktor Szakats
2485d3edaa
runtests: check and report if diff tool is missing
To make it apparent which CI jobs are missing this tool, so we can
install it to improve the runtests log.

Correction to the followed-up commit: `diff` is not installed via the
`gcc` package but via `automake`. Meaning it needs be installed manually
for MSYS cmake jobs.

Follow-up to e6c78e18da #16571
Closes #16578
2025-03-05 20:28:15 +01:00
Viktor Szakats
b06c12b724
GHA/windows: bump msys2 action, downgrade runtime for mingw tests
Bump msys2/setup-msys2 from 2.26.0 to 2.27.0. It brings the perf
regression experienced earlier with GfW and the pre-installed
MSYS2 on the GHA runner. Apply the runtime downgrade trick as
a workaround.

Fixes #16440
Fixes #16547
Closes #16574
2025-03-05 17:26:12 +01:00
Viktor Szakats
1bd5ac998b
GHA/windows: stop ignoring most ignored test results
These tests seem to be running no less stable now than others.
Stop ignoring their results to catch real issues.

These are consistently failing and remain on the ignore list:

in MSVC / vcpkg jobs:
```
FAIL-IGNORED 2302: 'WebSockets via callback (frame mode) + curl_ws_send()' WebSockets
FAIL-IGNORED 2303: 'WebSockets but gets a 200 back' WebSockets
FAIL-IGNORED 2307: 'WebSockets, overlong PING payload' WebSockets
```
https://github.com/curl/curl/actions/runs/13674664461/job/38233949942?pr=16570#step:14:4089
- Likely curl issues either in tests, server, or in WebSockets support.

in tests running under MSYS, affecting native mingw Windows builds only:
```
FAIL-IGNORED 612: 'SFTP post-quote remove file' SFTP, post-quote
[...]
 curl: (21) rm command failed: Operation failed
```
https://github.com/curl/curl/actions/runs/13674664461/job/38233952699?pr=16570#step:14:1378

in tests running under MSYS, affecting both MSYS and native mingw Windows builds:
```diff
FAIL-IGNORED 613: 'SFTP directory retrieval' SFTP, directory
[...]
 --- log/7/check-expected	2025-03-05 11:19:54.119658000 +0000
 +++ log/7/check-generated	2025-03-05 11:19:54.119658000 +0000
@@ -1,3 +1,3 @@
 d?????????    N U         U               N ???  N NN:NN asubdir[LF]
--rw?rw?rw?    1 U         U              37 Jan  1  2000 plainfile.txt[LF]
+-rw?r-?r-?    1 U         U              37 Jan  1  2000 plainfile.txt[LF]
 -r-?r-?r-?    1 U         U              47 Dec 31  2000 rofile.txt[LF]
```
https://github.com/curl/curl/actions/runs/13674664461/job/38233950866?pr=16570#step:14:1316
- Possibly a curl test portabibility, Perl or MSYS issue.

in Cygwin tests:
```
FAIL-IGNORED 615: 'SFTP put remote failure' SFTP, SFTP put, FAILURE
```
https://github.com/curl/curl/actions/runs/13674664461/job/38233949428?pr=16570#step:12:3817

Follow-up to adcfd4fb3e #16553
Ref: #14854
Closes #16570
2025-03-05 17:26:11 +01:00
Daniel Stenberg
f79195e7ef
tool_getparam: parse_header() without strtok
Read a provided header file line-by-line instead. Avoids strtok(),
avoids a possibly quite large malloc for the entire file.

Closes #16572
2025-03-05 14:55:55 +01:00
Ondřej Hlavatý
5a3fe980c5
request: clear sendbuf_hds_len when resetting request bufq
Without this, any usage of sendbuf_hds_len on a retried request is
wrong. We noticed by getting debug callbacks with incorrect header len.
We did not figure out how to trigger the retries in a test environment
though.

Closes #16573
2025-03-05 14:54:33 +01:00
Stefan Eissing
9bfa64f850
gnutls: set priority via --ciphers
No longer ignore the `--ciphers` argument in gnutls curl builds, but use
it to set the gnutls priority string.

When the set ciphers start with '+', '-' or '!', it is *appended* to the
curl generated priority string. Otherwise it replaces the curl one
completely.

Add test_17_18 to check various combinations.

Closes #16557
2025-03-05 13:51:56 +01:00
Viktor Szakats
e6c78e18da
GHA/windows: always install diffutils for MSYS/mingw, required by runtests
To include the expected/generated diffs in the error log.

Also make it explicit for pure MSYS, though it was installed by `gcc`
before this patch.

Closes #16571
2025-03-05 13:34:16 +01:00
Daniel Stenberg
787ee935ac
tool_dirhie: create dir hierarchy without strtok
And use dynbuf

Closes #16566
2025-03-05 13:26:33 +01:00
Daniel Stenberg
86ac471dc6
tool_paramhlp: do --proto parsing without strtok
Saves a strdup. Avoids a banned function.

Closes #16567
2025-03-05 13:24:45 +01:00
Daniel Stenberg
c4cd0ae9ba
http_aws_sigv4: cannot be used for proxy
Make sure it is never attempted.

Reported-by: Philippe Antoine
Closes #16569
2025-03-05 11:50:06 +01:00
Daniel Stenberg
34cbf95267
tests: make sure 'commands.log' is generated in the correct logdir
Closes #16568
2025-03-05 11:37:38 +01:00
Stefan Eissing
e542fd9da1
http2: detect session being closed on ingress handling
nghttp2 will on its own send GOAWAY frames, closing the connection, when
internal processing of frames runs into errors. This may not become
visible in a direct error code from a call to nghttp2.

Check for session being closed on ingress processing (on sending, we
already did that) and report an error if so. In addition, monitor
outgoing GOAWAY not initiated by us so that the user will get a fail
message when that happens.

Add some more long response header tests.

Closes #16544
2025-03-05 10:59:27 +01:00
Stefan Eissing
aa042210d9
http2: add on_invalid_frame callback for error detection
When the server sends HEADER/CONTINUATION frames that exceed nghttp2's
size, this error is being reported via the on_invalid_frame_recv
callback. Without registering there, it will go unnoticed.

RST the stream when such a frame is encountered.

Closes #16544
2025-03-05 10:59:19 +01:00
Stefan Eissing
e7de83aa29
http2: reset stream on response header error
We send a GOAWAY, but some servers ignore that and happily continue
sending the stream response. RST the stream when response header errors
are encountered.

Fixes #16535
Reported-by: Peng-Yu Chen
Closes #16544
2025-03-05 10:58:52 +01:00
Daniel Stenberg
ed15fce1fd
src: avoid strdup on platforms not doing UTF8 conversions
... and use more const strings.

Closes #16560
2025-03-05 09:19:09 +01:00
Orgad Shaneh
7298c4320b
docs: adapt to removed --with-random
Amends 269fdd4c6e.

Closes #16565
2025-03-05 08:19:15 +01:00
Daniel Stenberg
d121bc9884
tool_getparam: parse --trace-config without strdup()/free()
Closes #16559
2025-03-05 07:44:43 +01:00
Viktor Szakats
0825cf42f0
GHA/windows: drop running tests with dl-mingw 7.3.0 due to flakiness
This job was never stable. Bumping to -j8 (from -j4) possibly made it
flakier: 032447e624 #16271

Keep this job for build tests and drop running tests to improve the CI
experience and save CI time.

It's also a simple build with no dependencies. CI continues to build
a similar job with 9.5.0, which is more stable.

It remains a puzzle why builds with this toolchain (7.3.0 win32 threads
mingw-builds) is flakier and requires more test exceptions than the
indentical build with a slightly different build/version of
the toolchain (9.5.0 posix threads winlibs_mingw).

Ref: #14854
Closes #16564
2025-03-05 03:10:45 +01:00
Viktor Szakats
aa0d70fef7
build: tidy-ups around inet_pton
- cmake: make the `inet_pton`/`inet_ntop` detection codepath explicit
  for WinCE. To not rely on an empty `HAVE_WIN32_WINNT`.

- tests/server/mqttd: drop `inet_pton` header and lib source.

- tests/server: move `inet_pton` lib source to a variable.

Closes #16563
2025-03-05 03:10:45 +01:00
Daniel Stenberg
e4e8f1226f
tool_getparam: do parse_upload_flags without the alloc/free
Follow-up to 6758aa722d

Closes #16552
2025-03-04 23:44:12 +01:00
Viktor Szakats
0e0db0e385
GHA: brew --no-lock an invalid option now, drop
```
Error: invalid option: --no-lock
```
Ref: https://github.com/curl/curl/actions/runs/13659344413/job/38186577572#step:2:655

Closes #16561
2025-03-04 19:33:50 +01:00
Viktor Szakats
6f1031e9d5
tests/server: replace strerror with sstrerror in socksd
To follow the `errno` -> `SOCKERRNO` update.

Missed from the previous commit.

Follow-up to adcfd4fb3e #16553
2025-03-04 18:32:51 +01:00
Viktor Szakats
adcfd4fb3e
tests/server: replace errno with SOCKERRNO in sockfilt, socksd, sws
To correctly read the winsock2 result code on Windows.

Follow-up to de2126b182 #5241
Ref: 5e855bbd18 (r38507132)
Ref: #14854
Closes #16553
2025-03-04 18:23:40 +01:00
Daniel Stenberg
d251ecb5c8
RELEASE-NOTES: synced 2025-03-04 17:27:28 +01:00
Michał Antoniak
8e07429e43
cf-socket: remove empty switch
Closes #16555
2025-03-04 17:21:27 +01:00
Daniel Stenberg
57ac8aed3f
tests/data/Makefile.am: fix trailing slash issue
Follow-up from 6758aa722d

Fixes #16556
Closes #16558
2025-03-04 16:43:39 +01:00
tiymat
6758aa722d
IMAP: add CURLOPT_UPLOAD_FLAGS and --upload-flags
Set properties on the uploaded resource.

Test 3209 and 3210 verify.

Closes #15970
2025-03-04 15:21:16 +01:00
Samuel Dionne-Riel
0cd2670afb
libssh2: print user with verbose flag
This change:

 - Breaks out the existing print out of the LIBSSH2_DEBUG compile-time
   flag
 - Adds (single) quotation marks around the string to better expose the
   actual value
 - Adds a NULL print if not set, mirroring other verbose prints in
   libssh2

Why was this done?

I was trying out the `sftp` option in `curl`, and found myself hitting
an issue where I was not able to get curl to tell me which username it
was using to connect to a host.

With this change, the `User: ` line is printed with `-v`, just like
other SSH verbose prints.

Instead of using the pattern used with *SSH MD5 public key*, where a
ternary is used to print `NULL` on NULL values, it is using a different
branch to add quotes around the string value.

The quotes around the string value are used to better expose to the user
an empty string value, compared to "no-value".

Closes #16430
2025-03-04 14:47:52 +01:00
Daniel Stenberg
18c6d5512f
lib: fix two curlx_strtoofft invokes
- cf-h1-proxy: check return code and return error if the parser fails

- http: make the Retry-After parser check for a date string first then
  number to avoid mis-parsing the begining of a date as a number

Closes #16548
2025-03-04 14:40:38 +01:00