Commit Graph

35949 Commits

Author SHA1 Message Date
Harry Sintonen
f138177b92
docs: add FD_ZERO to curl_multi_fdset example
While the examples are not intended to complete applications this is
quite relevant for the correct function of the code.

Closes #16325
2025-02-14 08:21:42 +01:00
Viktor Szakats
92af12a7e0
cmake: drop HAVE_IN_ADDR_T from pre-fill too [ci skip]
Follow-up to 90b72607fa #16318
2025-02-14 02:02:00 +01:00
Daniel Stenberg
074048ae80
asyn-thread: avoid the separate 'struct resdata' alloc
Instead move the only struct field (start) into the thread_data struct.

Closes #16321
2025-02-13 16:21:45 +01:00
Daniel Stenberg
d9fc64d3ab
asyn-thread: do not allocate thread_data separately
Put the full struct into Curl_async since it will be used for every name
resolve anyway.

Closes #16241
2025-02-13 15:35:40 +01:00
Daniel Stenberg
48f6bfa8c7
http: fix NTLM info message typo
Closes #16305
2025-02-13 12:54:03 +01:00
Daniel Stenberg
44deccf907
urlapi: simplify junkscan
Makes it smaller and possibly somewhat faster

Closes #16307
2025-02-13 12:51:47 +01:00
Daniel Stenberg
597ee915c4
cookie: simplify invalid_octets()
should also make it marginally faster and smaller.

Closes #16306
2025-02-13 12:49:13 +01:00
Daniel Stenberg
196e624471
timediff: fix comment for curlx_mstotv()
The max value when explaining the math was wrong.

Closes #16310
2025-02-13 12:47:57 +01:00
Viktor Szakats
90b72607fa
tidy-up: drop unused CURL_INADDR_NONE macro and in_addr_t type
Closes #16318
2025-02-13 12:46:40 +01:00
Viktor Szakats
4aec6cdfd3
tests: fix enum/int confusion (Intel C), fix autotools CFLAGS for servers
By dropping the unused enum wrappers for `AF_*` macros.

Also fix `./configure` to apply `--enable-werror` options to
`tests/servers`, to catch this next time.

Seen with Intel C compiler:
```
socksd.c(184): warning #188: enumerated type mixed with another type
socksd.c(881): warning #188: enumerated type mixed with another type
[...]
sws.c(76): warning #188: enumerated type mixed with another type
sws.c(229): warning #188: enumerated type mixed with another type
[...]
```
Ref: https://github.com/curl/curl/actions/runs/13296520425/job/37129676921#step:40:338

Closes #16314
2025-02-13 12:46:40 +01:00
Viktor Szakats
d550966bf8
cmake: fix HAVE_ATOMIC/HAVE_STDATOMIC pre-fill for clang-cl
`HAVE_ATOMIC` and `HAVE_STDATOMIC` is available in clang-cl builds.
Adjust the pre-filled values accordingly.

Detected by a temporary job comparing pre-filled and actual values
on AppVeyor CI:
https://ci.appveyor.com/project/curlorg/curl/builds/51506692/job/2v8qrytgdnlah348#L416

Closes #16313
2025-02-13 12:46:40 +01:00
Viktor Szakats
de0693f249
addrinfo: add curl macro to avoid redefining foreign symbols
Before this patch curl code was redefining `getaddrinfo` and
`freeaddrinfo` system symbols to plug in its debug wrappers. This was
causing pains to avoid applying the redefinitions to system headers
defining these functions, and to the local debug wrappers. Especially
in unity builds. It also required workarounds for systems where these
symbols are already macros.

Introduce curl-namespaced macros for these functions and use them.
This allows to drop all workarounds and makes it work in all envs,
local targets and unity/bundle combinations.

Also drop GHA/windows workaround and use the same unity batch across
all jobs. Follow-up to 29e4eda631 #16272

Ref: #16272
Ref: 71cf0d1fca #14772
Ref: 3efba94f77 #14765
Ref: f7d5f47059 #14399

Closes #16274
2025-02-13 12:46:39 +01:00
Daniel Stenberg
7241953ba5
RELEASE-NOTES: synced
Bump to 8.12.2 for now
2025-02-13 11:22:47 +01:00
Daniel Stenberg
c561c94ec3
managen: correct the warning for un-escaped '<' and '>'
1. make sure the check is done before the backticks are replaced

2. ignore less-than and greater-than used within backticks

(adjust proxy.md that now showed a two-space warning)

Closes #16315
2025-02-13 11:17:40 +01:00
Daniel Stenberg
92611f2a56
strparse: switch the API to work on 'const char *'
The functions are not meant to touch the input anyway.

Closes #16316
2025-02-13 11:16:04 +01:00
Sergey
c1341813bd
lib: better optimized casecompare() and ncasecompare()
Less 'jne` or `je` CPU instructions.

Closes #16311
2025-02-13 11:14:52 +01:00
Daniel Stenberg
57495c6487
RELEASE-NOTES: synced 2025-02-13 08:14:17 +01:00
Daniel Stenberg
e93514e9b3
THANKS: add contributors from 8.12.1 2025-02-13 08:14:17 +01:00
Jay Satiro
42960ebec0 write-out.md: add 'header' and 'output' to the variable list
Prior to this change %header{} and %output{} were explained in remarks
but not listed in the --write-out variable list.

Closes https://github.com/curl/curl/pull/16299
2025-02-12 17:49:37 -05:00
Viktor Szakats
0005f91259
GHA/linux: drop Linux arm job for runner image flakiness with stunnel4
Since last week the Ubuntu arm runner became flaky while installing `stunnel`.

```
08:07:26 Setting up stunnel4 (3:5.72-1build2) ...
08:07:26 Failed to check if group stunnel4 already exists: Connection refused
08:07:26 Group stunnel4 not found.
08:07:28 Reload daemon failed: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
08:07:28 Created symlink /etc/systemd/system/multi-user.target.wants/stunnel.target -> /usr/lib/systemd/system/stunnel.target.
08:08:18 Failed to get unit file state for stunnel.target: Connection timed out
08:08:43 Failed to retrieve unit state: Connection timed out
08:08:43 stunnel.target is a disabled or a static unit, not starting it.
08:08:43 /bin/chown: invalid user: ‘stunnel4:stunnel4’
08:08:43 dpkg: error processing package stunnel4 (--configure):
08:08:43  installed stunnel4 package post-installation script subprocess returned error exit status 1
08:08:43 [...]
08:08:47 Errors were encountered while processing:
08:08:47 stunnel4
08:08:54 Error: Timeout was reached
08:08:55 E: Sub-process /usr/bin/dpkg returned an error code (1)
08:08:55 Error: Process completed with exit code 100.
```
Ref: https://github.com/curl/curl/actions/runs/13280736653/job/37078440398?pr=16300#step:2:94

Closes #16303
2025-02-12 16:28:44 +01:00
Viktor Szakats
be5f20202c
GHA/non-native: drop cmake Xcode generator iOS job for poor performance
The Xcode configure phase is slow. In most cases it's >10x slower than
the GNU Makefile configuration. This is after days of attempts to make
it faster. With GNU Makefile it takes 20-30 seconds, while Xcode can
take 3 to 10 minutes, which sometimes makes the job run out of its time
limit and fail.

CMake recommends this generator, but with such poor, and inconsistent
performance, it isn't practical. It helped detecting an Xcode-specific
CMake script issue, but aside from that it's not adding much value.

9m33s: https://github.com/curl/curl/actions/runs/13280738423/job/37078441164
8m18s: https://github.com/curl/curl/actions/runs/13281140850/job/37079589779
2m50s: https://github.com/curl/curl/actions/runs/13280725335/job/37078375179

Follow-up to 12a6de2f66 #16043

Closes #16302
2025-02-12 16:28:44 +01:00
renovate[bot]
d87969770f
GHA: update openssl/openssl to v3.4.1
Closes #16301
2025-02-12 10:56:02 +01:00
Viktor Szakats
eebb1c1c15
libssh2: drop obsolete macros and version checks
Follow-up to 553248f501 #16199

Closes #16292
2025-02-12 09:04:13 +01:00
Viktor Szakats
6ab1fa423b
cmake: fix/add missing feature detections for Windows/MS-DOS
Almost all feature detection results are pre-filled on Windows
for performance, so none of the issues fixed here affected builds.

For good measure, this patch add missing detections and fixes others
to make sure they work even when omitting the pre-fill.

It also fixes detecting IPv6 for MS-DOS.

- fix `HAVE_STRUCT_TIMEVAL` detection for MSVC.
  Follow-up to c1bc090d65 #12495
- add `HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` detection for Windows.
- fix `HAVE_STRDUP` detection for MSVC.
- fix `HAVE_SNPRINTF` detection for Windows.
  Regression from 8e34505776 #15164
- fix `HAVE_IOCTLSOCKET` detection for non-UWP MSVC.
- exclude `if_nametoindex` detection for Windows.
  Although it exists on Windows, detection, usage and availability is
  complicated, and curl doesn't use it on this platform.
  Regression from 8e34505776 #15164
- move IPv6 detections so that pre-filling and MS-DOS Watt-32
  configuration applies to them. This fixes
  `HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` detection with MS-DOS.
  Ref: https://github.com/curl/curl/actions/runs/13260511764/job/37015877585#step:7:306
  Follow-up to a3585c9576 #15543

Also:
- add debug option to test without pre-filling.
- replace `NOT LESS` with `GREATER_EQUAL`

Closes #16278
2025-02-11 14:15:40 +01:00
Viktor Szakats
e520493742
cmake: fix to detect HAVE_OPENSSL_SRP in MSVC UWP builds
A deprecation error prevented correct detection in MSVC UWP builds:
```
curl\\bld\\CMakeFiles\\CMakeScratch\\TryCompile-ks2aa4\\CheckSymbolExists.c(8,19):
  error C4996: 'SSL_CTX_set_srp_username': Since OpenSSL 3.0
```
Ref: https://github.com/curl/curl/actions/runs/13242285473/job/36960223663#step:8:898

It seems to be caused by different default warning levels used by
the toolchain (or CMake?): `/W3` for UWP and `/W1` for Windows desktop.

https://github.com/curl/curl/actions/runs/13242285473/job/36960223663#step:8:893 UWP
https://github.com/curl/curl/actions/runs/13242285473/job/36960223262#step:8:445 desktop

Fix by passing the OpenSSL macro suppressing its deprecation warnings.

Cherry-picked from #16287
Closes #16293
2025-02-11 11:38:18 +01:00
Viktor Szakats
6975a0ecda
libssh2: fix to use non-deprecated libssh2_scp_send64()
Seen in curl-for-win daily, building against libssh2 1.11.2_DEV:
```
curl-for-win/curl/lib/vssh/libssh2.c:2644:9: warning: 'libssh2_scp_send_ex' is deprecated:
  since libssh2 1.2.6. Use libssh2_scp_send64() [-Wdeprecated-declarations]
 2644 |         SCP_SEND(sshc->ssh_session, sshp->path, data->set.new_file_perms,
```
Ref: https://github.com/curl/curl-for-win/actions/runs/13229370277/job/36924363438#step:3:5805

Follow-up to 553248f501 #16199

Closes #16291
2025-02-11 11:38:18 +01:00
renovate[bot]
160c0ffc17
ci: update dependency gnutls/gnutls to v3.8.9
Closes #16257
2025-02-11 11:12:04 +01:00
Daniel Stenberg
c89871fa87
vquic: make the "disable GSO" use infof, not failf
... because it is not actually a fail.

Closes #16294
2025-02-11 09:48:45 +01:00
Daniel Stenberg
383c030d52
KNOWN_BUGS: --interface with link-scoped IPv6 address
Reported-by: Aaron Deadman
Closes #14782
Closes #16295
2025-02-11 09:37:47 +01:00
Daniel Stenberg
81d253365c
verbose.md: mention how carriage-return might occur in headers
Fixes #16285
Reported-by: Andrei Korshikov
Closes #16286
2025-02-11 07:44:36 +01:00
Viktor Szakats
e156c7f8ee
runtests.pl: reapply accidental revert
Reapply an accidental, and unrelated, change committed in
3c128966ed which unwantedly reverted
the preceding commit fcd5c2baff.

Caused by doing a local rebase when `git am` did not apply cleanly,
and most likely using a local base behind master.
2025-02-11 01:45:03 +01:00
Viktor Szakats
e9be5ff61d
tests: fix test 558, 1330 for MSVC, allow TrackMemory with MSVC in cmake
Extend output filter to pick up backslashes. This makes them pass in CI
when run in the vcpkg MSVC job, for example.

Also:
- cmake: allow TrackMemory, aka `ENABLE_CURLDEBUG` again. Drop FIXME.
- cmake: drop stale TODO.
- runtests: include the word 'TrackMemory' in the message disabling it.

Follow-up to 9f23c8f201 #14541
Follow-up to 94c596bbc5 #16283

Closes #16289
2025-02-10 22:35:15 +01:00
Daniel Stenberg
71ace9f3c1
checksrc.pl: warn on FIXME/TODO comments 2025-02-10 14:44:12 +01:00
Daniel Stenberg
94c596bbc5
all: remove FIXME and TODO comments
We can always improve. These comments tend to linger and go misleading
or plain wrong over time.

Closes #16283
2025-02-10 14:44:06 +01:00
Viktor Szakats
f1d1c98b7f
cmake: fix HAVE_GETHOSTBYNAME_R_* detections with CURL_WERROR=ON
Fix `HAVE_GETHOSTBYNAME_R_*` feature detections always failing with
`CURL_WERROR=ON` due to stripping a const.

Also fix the GHA/cmake-vs-configure to enable `CURL_WERROR=ON` to sync
this setting with `./configure` which enables it by default. With that,
CI detects this issue.

```
CMake/CurlTests.c:73:19: error: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   73 |   char *address = "example.com";
      |                   ^~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/13225827821/job/36916564107#step:33:4198

Closes #16282
2025-02-10 12:54:11 +01:00
Viktor Szakats
29e4eda631
GHA/windows: improve build perf with cmake unity batches
Default curl unity builds make a single unit for each target. It means
all target sources are batched together and built in a single compiler
invocation. With multi-core CPUs this doesn't always result in the best
possible performance. This patch enables smaller batches for jobs where
this resulted in shorter build times. These jobs are Cygwin, MSYS2,
MinGW, running on the Windows runners.

Use batch of 30 (meaning 30 sources batched into units), and 32 for
Cygwin/MSYS2 to avoid a unity fallout that's subject to a different PR.

(CMake allows to set the number of sources per unit, not the number
of units, though the latter may be more practical to max out CPU cores.)

Also override to not batch the `curlu` target because batching lost
a little bit of time there, due to the already existing parallelism when
building the `testdeps` targets.

For jobs on the macOS and Linux runners jobs were already mostly single
digit or below teen seconds, and batching didn't improve on them
noticeably. On VM jobs, the virtual CPUs are limited, so I didn't
make a try. In AppVeyor and GHA vcpkg jobs (using msbuild), batching
didn't result in conclusive or any gains.

Build times in seconds (curl + testdeps):
Job                  |          Before | After w curlu=0 | Gain
:--------------------| :-------------- | :-------------- | :---
cygwin, CM           |   19 + 32 =  51 |  12 +  32 =  44 |    7
msys2, CM            |    7 + 15 =  22 |   5 +  14 =  19 |    3
mingw gcc U, CM      |   19 + 30 =  49 |  13 +  32 =  45 |    4
mingw ucrt, CM       |   32 + 42 =  74 |  15 +  43 =  58 |   16
mingw clang, CM      |   15 + 21 =  36 |   8 +  21 =  29 |    7
mingw uwp, CM        |   30 + 40 =  70 |  14 +  40 =  54 |   16
mingw gcc, CM        |   20 + 31 =  51 |  12 +  31 =  43 |    8
mingw x86, CM        |   35 + 40 =  75 |  15 +  38 =  53 |   22
dl-mingw, CM 9.5.0   |   88 + 99 = 187 |  42 + 101 = 143 |   44
dl-mingw, CM 7.3.0 U |   24 + 32 =  56 |  17 +  35 =  52 |    4
Total                |                 |                 |  131

Total gain per GHA/windows workflow runs: 2m11s

Runs:
Before: https://github.com/curl/curl/actions/runs/13220256084/job/36904342259
After: https://github.com/curl/curl/actions/runs/13220383702/job/36904602981
       https://github.com/curl/curl/actions/runs/13220613141/job/36905170104
       https://github.com/curl/curl/actions/runs/13222019443/job/36908358550
With curlu tweak: https://github.com/curl/curl/actions/runs/13222239255/job/36908782462

Ref: 116950a250 #16265

Closes #16272
2025-02-10 12:54:11 +01:00
Daniel Stenberg
48df83a30e
tool_progress: fix percent output of large parallel transfers
When the total transfered amount (upload or download) for parallel
transfers was larger than 2^63/100 bytes (81 petabytes) the progress
percent counter would show wrong.

Closes #16284
2025-02-10 11:12:44 +01:00
jethrogb
cc6b630f13
KNOWN_BUGS: remove 2.5 client cert handling differs between backends
This was resolved in #4958

Closes #16175
2025-02-10 08:52:54 +01:00
Daniel Stenberg
cd8d8caae8
RELEASE-NOTES: synced 2025-02-10 08:43:41 +01:00
Viktor Szakats
c1f81adf48
GHA/linux: hide progress bar in apt remove
Also switch to `apt-get` and drop redundant `--yes` for conistency with
other GHA scripts.

Follow-up to b13e9066b3 #16127
Closes #16281
2025-02-10 05:15:42 +01:00
Jay Satiro
973ffaa83f curl_global_sslset.md: Add SSL backend names
- Add the names that can be used to select an SSL backend by name.

This change syncs the names in 3 places: curl_global_sslset
documentation, the curl tool environment variable documentation for
CURL_SSL_BACKEND and the libcurl environment variable documentation for
CURL_SSL_BACKEND.

Closes https://github.com/curl/curl/pull/16256
2025-02-09 14:56:06 -05:00
Viktor Szakats
e6ea56b9d9
lib: silence LibreSSL collision warning on non-MSVC Windows
LibreSSL headers emit this warning because we included `wincrypt.h`
before them. We have to include `wincrypt.h` before OpenSSL headers
to avoid symbol collisions when using other forks. LibreSSL 3.8.2+
offers a macro to silence its warnings to avoid this issue. This patch
sets it.

This allows to stop setting this macro in curl-for-win builds.

Warnings seen with MinGW with cmake non-unity (also unity batch=30):
```
[156/219] Building C object lib/CMakeFiles/libcurl_object.dir/vtls/openssl.c.obj
In file included from lib/vtls/openssl.h:35,
                 from lib/vtls/openssl.c:53:
dep/libressl-win-x64/include/openssl/ossl_typ.h:90:2: warning: #warning overriding WinCrypt defines [-Wcpp]
   90 | #warning overriding WinCrypt defines
      |  ^~~~~~~
In file included from dep/libressl-win-x64/include/openssl/pem.h:71,
                 from dep/libressl-win-x64/include/openssl/ssl.h:151,
                 from lib/vtls/openssl.h:36:
dep/libressl-win-x64/include/openssl/x509.h:108:2: warning: #warning overriding WinCrypt defines [-Wcpp]
  108 | #warning overriding WinCrypt defines
      |  ^~~~~~~
In file included from dep/libressl-win-x64/include/openssl/x509.h:319:
dep/libressl-win-x64/include/openssl/pkcs7.h:77:2: warning: #warning overriding WinCrypt defines [-Wcpp]
   77 | #warning overriding WinCrypt defines
      |  ^~~~~~~
```

Ref: https://github.com/libressl/portable/issues/910
Ref: https://github.com/libressl/portable/pull/924
Ref: e7fe6caab2
Ref: 760ccfcc91

Closes #16273
2025-02-09 13:50:02 +01:00
Daniel Stenberg
89ed161f56
asyn-thread: survive a c-ares channel set to NULL
When the c-ares setup fails and we get a NULL channel, the resolve still
continues and we just need to survive it and just not get any HTTPS RR.

Reported-by: nono303 on github
Fixes #16216
Closes #16244
2025-02-09 11:30:08 +01:00
Viktor Szakats
17c287854b
GHA/appveyor: tidy up quotes 2025-02-09 03:04:02 +01:00
Viktor Szakats
032447e624
GHA/windows: bump dl-mingw tests to -j8
To match the rest of Windows jobs.

dl-mingw, CM 9.5.0-x86_64 schannel: 4m24s -> 2m56s
dl-mingw, CM 7.3.0-x86_64 schannel U: 4m37s -> 3m10s
(based on a few runs.)

Closes #16271
2025-02-09 00:34:40 +01:00
Terence Eden
a042c67df3
docs: use valid example domain names
Replace .site domains and domain.com with valid example domains.

Fixes #16269
Closes #16270
2025-02-09 00:17:05 +01:00
Viktor Szakats
116950a250
GHA/windows: restore runtests perf with last known good Git for Windows
Use the last known good release of Git for Windows by installing it
manually. It restores `runtests.pl` performance to the levels before
the October 2024 and this week's fallouts which gradually deployed
MSYS2 runtimes with pipe/signal/concurrency issues.

Also:
- restore vcpkg job's test parallelism to `-j8` (from `-j4`).
- keep using the default shell for jobs not running tests.
  To avoid the unnecessary Git for Windows install overhead.

Upsides:
- good performance again.
- easy to experiment with any version.

Downsides:
- installing the Git for Windows package takes 15-30 seconds.
- we're pinned to an old package version.
- no canary to tell when the issue is fixed on the runner images.

Unknown:
- stability. (no MSYS2 runtimes were ever stable and it's difficult
  to quantify if a version improves or worsens stability/flakiness, and
  intermittent env failures.

Follow-up to 1bf774df57 #16217
Follow-up to 5f9411f953 #15380

Closes #16265
2025-02-08 23:59:57 +01:00
Daniel Stenberg
54cd27a50d
libssh2: comparison is always true because rc <= -1
Pointed out by CodeQL

Closes #16268
2025-02-08 23:24:08 +01:00
Viktor Szakats
68555467b1
GHA/http3-linux: fix quictls cache key mismatch
Closes #16266
2025-02-08 19:11:37 +01:00
Daniel Stenberg
5963f83176
lib3208: add a final easy_perform as well
Make the test also verify using the handle in the other order.

Closes #16262
2025-02-08 14:12:40 +01:00