Commit Graph

34784 Commits

Author SHA1 Message Date
Viktor Szakats
7fd15b4a82
schannel: enable ALPN support under WINE 6.0+
ALPN support was announced in 5.6 (2020-04-10). It likely needs a WINE
built against GnuTLS 3.2.0 (2013-05-10) or upper (for macOS, GnuTLS was
made default in WINE 6.0.2). I could confirm ALPN working under 6.0.2
(2021-10-26).

https://www.winehq.org/announce/5.6
0527cf89fb
https://gitlab.winehq.org/wine/wine/-/blob/wine-5.6/dlls/secur32/schannel_gnutls.c
https://gitlab.winehq.org/wine/wine/-/blob/wine-5.6/dlls/secur32/tests/schannel.c

If you run into problems, open and Issue and disable ALPN manually with
`--no-alpn` or the equivalent for libcurl.

Ref: #983
Closes #16393
2025-02-21 12:16:41 +01:00
Viktor Szakats
4d01de3529
eventfd: allow for all CPUs
After fixing support for x32, unlock eventfd support for all CPUs.
Before this patch, it was explicitly limited to 64-bit ones.

You can disable eventfs manually on systems where it's auto-detected:
- cmake: `-DHAVE_EVENTFD=0`
- configure: `export ac_cv_func_eventfd=0`

Ref: c2aa504ab9 #16239
Closes #16277
2025-02-21 12:07:24 +01:00
Viktor Szakats
bf823397ba
cmake: drop CURL_DISABLE_TESTS option
curl builds tests with CMake when explicitly building the `testdeps`
target. It's not built by default. It seems overkill to have
a curl-specific variant of this (over CMake's `BUILD_TESTING`)
to disable generating this target.

Its history also doesn't make it obvious why this was necessary,
and there was a long debate how to do it, by the time the original
submitter abandoned CMake. The option also remained uninitialized
and thus undocumented.

Let me know if I missed something.

Ref: #6036
Ref: 3a1e798009 #6072
Closes #16134
2025-02-21 12:05:54 +01:00
Viktor Szakats
2cc90a679a
openssl: drop support for old OpenSSL/LibreSSL versions
Require OpenSSL 1.0.2a (2015-03-19) or LibreSSL 2.9.1 (2019-04-13).

Closes #16104
2025-02-21 12:02:35 +01:00
Viktor Szakats
e0fd5790d9
msvc: drop support for VS2005 and older
- cmake: assume large file support (VS2005+ / `_fseeki64()`)
- config-win32.h: assume large file support (VS2005+ / `_fseeki64()`)
- config-win32.h: assume `HAVE_LONGLONG` (VS2003+)
- config-win32.h: assume 64-bit `time_t` (VS2005+)
- config-win32.h: assume VS2008+
- cmake: use multi-threaded/parallel compilation (VS2008+)
- curl_setup.h: require multi-threading MSVC CRT (~VS2005+)
- curl_setup.h: hard fail for unsupported MSVC versions.
  Authored-by: Jay Satiro
- winbuild: bump minimum version

Follow-up to 308437ac53 #15992
Ref: #15972
Closes #16004
2025-02-21 12:01:00 +01:00
Viktor Szakats
4842f22bfa
tidy-up: align MSYS2/Cygwin codepaths, follow Cygwin MAX_PID bump
MSYS/MSYS2 and Cygwin are the same platform. Adjust code where they were
treated differently.

- drop separate `MSYS` from buildinfo flags. Our code is using the
  `CYGWIN` variable and CMake (since v3.21) sets it also for `MSYS`.
- fix test1158 and test1186 to exclude them for all Win32 targets,
  instead of just MSYS test envs. To align behavior between MSYS and
  Cygwin envs. Required for recent MSYS2 releases which reports itself
  as Cygwin, and no longer MSYS, which broke the previous exclusion
  logic.
- follow Cygwin bumping its `MAX_PID` value, to avoid PID collisions.
  https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=363357c023ce01e936bdaedf0f479292a8fa4e0f

Reported-by: Jeremy Drake
Bug: https://github.com/curl/curl/pull/16217#issuecomment-2672768233
Ref: https://www.msys2.org/news/#2025-02-14-moving-msys2-closer-to-cygwin
Closes #16411
2025-02-21 11:58:05 +01:00
Viktor Szakats
540d341b38
schannel: deduplicate Windows Vista detection
curl detects Vista as part of its global initialization. Use that result
instead of detecting it again in Schannel, to save some cycles and API
calls.

Follow-up to 46e97b10ba #16400
Closes #16408
2025-02-21 11:48:56 +01:00
Daniel Stenberg
5693e3fa88
curlver.h: bump to 8.13.0 2025-02-21 11:07:56 +01:00
Daniel Stenberg
ecb382eca2
RELEASE-NOTES: synced 2025-02-21 10:36:53 +01:00
Jay Satiro
46e97b10ba cf-socket: deduplicate Windows Vista detection
- Remove Vista detection logic from Curl_sndbuf_init and evaluate global
  init variable Curl_isVistaOrGreater instead.

This way we don't need a separate initialization in Curl_sndbuf_init.

Ref: https://github.com/curl/curl/pull/16393#discussion_r1962377920

Closes https://github.com/curl/curl/pull/16400
2025-02-21 03:12:32 -05:00
Jay Satiro
210c0c088e wolfssl: fix CA certificate multiple location import
- Do not set x509_store_setup until after all CA certificate imports.

- If CA blob import fails then return error unconditionally.

This is to sync the behavior with OpenSSL and other backends.

Prior to this change, setting CA native and/or CA blob were treated as
mutually exclusive from setting CA file and/or CA path.

CA blob import still overrides CA file import as documented.

Closes https://github.com/curl/curl/pull/16391
2025-02-21 03:11:50 -05:00
Daniel Stenberg
fb61d76580
asyn-ares: fix the port assign
Follow-up to 6bc65a444b
Fixes #16414
Closes #16415
2025-02-21 08:37:24 +01:00
Daniel Stenberg
d1fc1c4a85
http: simplify the check for auth methods
Avoids having to use the correct index into the line. Avoids repeated
use of is_valid_auth_separator.

Require that the following letter is not an alnum instead of checking
explicitly for ch == '\0' || ch == ',' || ISSPACE(ch). After all, the
point is to not erroneously match another auth string using the same
prefix.

Follow-up to b75620b9a0

Closes #16406
2025-02-20 22:50:45 +01:00
Dexter Gerig
6bc65a444b
httpsrr: fix port detection
Closes #16409
2025-02-20 22:46:40 +01:00
Daniel Stenberg
655a4e83b7
GHA: add https-rr (asyn-rr) to the alpine job
Assisted-by: Viktor Szakats
Closes #16402
2025-02-20 22:21:31 +01:00
Stefan Eissing
df5db8afaf
conn: fix connection reuse when SSL is optional
In curl 8.12 I tried to improve the logic on how we handle connections
that "upgrade" to TLS later, e.g. with a STARTTLS. I found the existing
code hard to read in this regard. But of course, the "improvements" blew
up in my face.

We fixed issues with imap, opo3, smtp in 8.12.1, but ftp was no longer
reusing existing, upgraded control connections as before. This PR adds
checks in our pytest FTP tests that verify reuse is happening as
intended.

I rewrote the logic in url.c again, so that the new test checks now pass.

Reported-by: Zenju on github
Fixes #16384
Closes #16392
2025-02-20 16:23:35 +01:00
Stefan Eissing
f78700814d
client writer: handle pause before deocding
Adds a "cw-pause" client writer in the PROTOCOL phase that buffers
output when the client paused the transfer. This prevents content
decoding from blowing the buffer in the "cw-out" writer.

Added test_02_35 that downloads 2 100MB gzip bombs in parallel and
pauses after 1MB of decoded 0's.

This is a solution to issue #16280, with some limitations:
- cw-out still needs buffering of its own, since it can be paused
  "in the middle" of a write that started with some KB of gzipped
  zeros and exploded into several MB of calls to cw-out.
- cw-pause will then start buffering on its own *after* the write
  that caused the pause. cw-pause has no buffer limits, but the
  data it buffers is still content-encoded.
  Protocols like http/1.1 stop receiving, h2/h3 have window sizes,
  so the cw-pause buffer should not grow out of control, at least
  for these protocols.
- the current limit on cw-out's buffer is ~75MB (for whatever
  historical reason). A potential content-encoding that blows 16KB
  (the common h2 chunk size) into > 75MB would still blow the buffer,
  making the transfer fail. A gzip of 0's makes 16KB into ~16MB, so
  that still works.

A better solution would be to allow CURLE_AGAIN handling in the client
writer chain and make all content encoders handle that. This would stop
explosion of encoding on a pause right away. But this is a large change
of the deocoder operations.

Reported-by: lf- on github
Fixes #16280
Closes #16296
2025-02-20 15:53:18 +01:00
Stefan Eissing
279a4772ae
http: negotiation and room for alt-svc/https rr to navigate
Add a 'wanted' major HTTP version bitmask next to the 'allowed' bitmask
in HTTP version negotiation. This will try connections as specified in
'wanted', but enabled Alt-Svc and HTTPS-RR to redirect to other major
HTTP versions, if those are 'allowed'.

Changes libcurl internal default to `CURL_HTTP_VERSION_NONE` and removes
the code in curl that sets `CURL_HTTP_VERSION_2TLS` if the command line
does not say anything else.

Closes #16117
2025-02-20 15:45:46 +01:00
Stefan Eissing
a1850ad7de
cfilter: remove 'blocking' connect handling
Remove `blocking` argument from cfilter's connect method.

Implement blocking behaviour in Curl_conn_connect() instead for all
filter chains.

Update filters implementations. Several of which did never use the
paramter (QUIC for example). Simplifies connect handling in TLS filters
that no longer need to loop

Fixed a blocking connect call in FTP when waiting on a socket accept()
which only worked because the filter did not implement it.

Closes #16397
2025-02-20 11:13:51 +01:00
Daniel Stenberg
654f8cb5f3
tool_getparam: clear sensitive arguments better
curl attempts to clear some flags to hide them from snooping neighbors
(on platforms where it works). For example the credentials provided with
-u. Previously it would only do that if there was a space between the
option and the credentials as in "-u joe:s3cr3t" but not when done
without a separating space as in "-ujoe:s3cr3t".

This addresses that previous shortcoming.

Reported-by: kayrus on github
Fixes #16396
Closes #16401
2025-02-20 09:56:09 +01:00
Daniel Stenberg
c64304e111
httpsrr: fix the HTTPS-RR threaded-resolver build combo
Reported-by: Viktor Szakats
Fixes #16399
Closes #16404
2025-02-20 09:40:53 +01:00
Viktor Szakats
ee3f657607
build: silence bogus -Wconversion warnings with gcc 5.1-5.4
It's fixed in gcc 5.5.0.

Example: https://godbolt.org/z/x6Th8q844

Seen in gcc 5.1.0, 5.4.0 (both 32/64-bit) with dl-mingw:
```
lib/rtsp.c: In function 'rtsp_parse_transport':
lib/rtsp.c:1025:36: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
           rtp_channel_mask[idx] |= (unsigned char)(1 << off);
                                    ^
lib/mprintf.c: In function 'parsefmt':
lib/mprintf.c:526:31: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[width/8] |= (unsigned char)(1 << (width&7));
                               ^
lib/mprintf.c:544:35: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
         usedinput[precision/8] |= (unsigned char)(1 << (precision&7));
                                   ^
lib/mprintf.c:559:29: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       usedinput[param/8] |= (unsigned char)(1 << (param&7));
                             ^
lib/cfilters.c: In function 'Curl_pollset_change':
lib/cfilters.c:935:25: error: conversion to 'unsigned char' from 'int' may alter its value [-Werror=conversion]
       ps->actions[i] |= (unsigned char)add_flags;
                         ^
```
gcc 5.1.0: https://github.com/curl/curl/actions/runs/13413103492/job/37467698381#step:9:21
gcc 5.4.0: https://github.com/curl/curl/actions/runs/13413103492/job/37467694479#step:9:19

Closes #16398
2025-02-19 18:03:23 +01:00
Daniel Stenberg
f0d7318193
strparse: provide access functions
To access the string and the length without having to directly use the
struct field names. Gives more freedom, flexbility and keeps
implementation specifics out of users' code.

Closes #16386
2025-02-19 12:17:32 +01:00
Daniel Stenberg
1aea05a6c2
cookie: convert to using strparse
- using strparse cleans up the code and makes it easier to read and follow
- remove ? handling never used - since the path is provided without queries nowadays
- simplify sanitize_cookie_path
- avoid the strdup in pathmatch()

Closes #16386
2025-02-19 12:17:32 +01:00
Viktor Szakats
397088e8f4
schannel: enable ALPN with MinGW, fix ALPN for UWP builds
ALPN requires mingw-w64 9.0 or newer.

Also fix ALPN-enabled builds for UWP. This assumes that WINE doesn't
support UWP, which seems to be the case when writing this.

Closes #16385
2025-02-19 11:27:01 +01:00
Jay Satiro
2335cbaa21 ca-native.md: sync with CURLSSLOPT_NATIVE_CA
- Add that the native CA store is used to verify certs in addition to
  the other certificate location settings.

Basically clarify that --ca-native does not override --cacert etc.

Prior to this change that behavior was only documented in
CURLSSLOPT_NATIVE_CA which is what --ca-native maps to.

Ref: https://github.com/curl/curl/pull/16181#issuecomment-2663998865

Closes https://github.com/curl/curl/pull/16373
2025-02-19 03:39:52 -05:00
Daniel Stenberg
3100fb45b7
RELEASE-NOTES: synced 2025-02-19 08:11:43 +01:00
John Bampton
8633b10a41
KNOWN_BUGS: fix typo
Closes #16383
2025-02-19 07:54:03 +01:00
Daniel Stenberg
a867314f4f
ssh: consider sftp quote commands case sensitive
They have always been documented in lowercase. They have never been
claimed to be case insensitive. They mostly map to unix counterparts
that are always lowercase. Switch to case sensitive checks: lowercase.

Closes #16382
2025-02-19 07:52:11 +01:00
Daniel Stenberg
ad700a0917
strparse: speed up the hex parser somewhat
Around 2.3x speed-up parsing many large hexadecimal numbers. The decimal and
octal parser get marginally faster.

Still very readable, compact and easy to follow code.

Tweaks

- combine the max and the overflow check, gains 3ns/num (use a separate
  check outside of the loop instead for max < base)
- one less indirection in the pointer, gains 3ns/num
- using the table lookup for hex nums, gains 5ns/num
- unfold the num_digit() macro, gains 3s/num
- use the hexasciitable unconditionally, gains 2ns/num
- use post-increment pointer in the table lookup, gains 1ns/num
- improved valid_digit() using the table for the hex case,
  gains 26 ns/num
- use "max char" in valid_digit(), gains 3ns/num

Behavior changes:

- no longer returns STRE_TOO_BIG - only STRE_OVERFLOW
- does not move the char ** on error, which is probably better

Updated and extended test 1664 (significantly).

Closes #16374
2025-02-19 07:49:06 +01:00
Viktor Szakats
3fd1dfc829
tidy-up: use CURL_ARRAYSIZE()
Follow-up to 13b2ea68f0 #16111

Closes #16381
2025-02-19 00:59:45 +01:00
Stefan Eissing
1b710381ca
https-rr: implementation improvements
- fold DoH and async HTTPS-RR handling into common code.
  have common cleanups, etc. Have a CURLcode result in async
  handling to allow HTTPS RR parsing to fail.
- keep target, ipv4hints, ipv6hints, port and echconfig also
  when resolving via cares. We need to know `target` and `port`
  when evaluating possible ALPN candidates to not go astray.
- add CURL_TRC_DNS for tracing DNS operations
- replace DoH specific tracing with DNS, use doh as alias
  for dns in curl_global_tracea()

Closes #16132
2025-02-18 16:12:26 +01:00
Stefan Eissing
db72b8d4d0
http: version negotiation
Translate the `data->set.httpwant` which is one of the consts from the
public API (CURL_HTTP_VERSION_*) into a major version mask plus
additional flags for internal handling.

`Curl_http_neg_init()` does the translation and flags setting in http.c,
using new internal consts CURL_HTTP_V1x, CURL_HTTP_V2x and CURL_HTTP_V3x
for the major versions. The flags are

- only_10: when the application explicity asked fro HTTP/1.0
- h2_upgrade: when the application asks for upgrading 1.1 to 2.
- h2_prior_knowledge: when directly talking h2 without ALPN
- accept_09: when a HTTP/0.9 response is acceptable.

The Alt-Svc and HTTPS RR redirections from one ALPN to another obey the
allowed major versions. If a transfer has only h3 enabled, Alt-Svc
redirection to h2 is ignored.

This is the current implementation. It can be debated if Alt-Svc should
be able to override the allowed major versions. Added test_12_06 to
verify the current restriction.

Closes #16100
2025-02-18 16:10:12 +01:00
Viktor Szakats
f7fcbb8127
cmake: SHARE_LIB_OBJECT=ON requires CMake 3.12 or newer
This feature requires Object Libraries which is supported by CMake 3.12
or newer: https://cmake.org/cmake/help/latest/release/3.12.html

Keep it permanently disabled for older CMake versions.
Also document it in `docs/INSTALL-CMAKE.md`.

Ref: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#object-libraries

Follow-up to fc9bfb1452 #11627
Follow-up to 2ebc74c36a #11546

Reported-by: Mark Phillips
Fixes #16375
Closes #16376
2025-02-18 15:05:39 +01:00
Daniel Stenberg
2f4dc6525c
hostip: make CURLOPT_RESOLVE support replacing IPv6 addresses
This also applies to --resolve of course.

Applied strparse functions on the function.

Fixes #16357
Reported-by: rmg-x on github
Closes #16358
Assisted-by: Jay Satiro
2025-02-18 08:55:56 +01:00
Viktor Szakats
61f85bf967
GHA/windows: drop no-op -DCMAKE_BUILD_TYPE= from MSVC jobs
They use Visual Studio generators, which are multi-target.
The build command does the Release/Debug selection via `--config`.

Also:
- appveyor: drop unnecessary conditional for 3 options.
  To sync with GHA.
- appveyor: drop unused `-DCMAKE_INSTALL_PREFIX=`.
  To sync with GHA.
- sync cmake option order between GHA and appveyor.

Closes #16372
2025-02-18 01:06:21 +01:00
Viktor Szakats
24ffcbad5f
cmake: sync OpenSSL(-fork) feature checks with ./configure
`./configure` uses `AC_CHECK_FUNC` for these checks, with one exception
(`SSL_CTX_set_srp_username`). It's slightly less precise but simpler as
it doesn't need headers and/or macros. Do the same in CMake.

It also allows merging ECH detections across OpenSSL forks in CMake too.

Closes #16352
2025-02-17 17:04:17 +01:00
Viktor Szakats
80d93799a6
asyn-thread: fix mutex refs and unused variable in no-HAVE_GETADDRINFO builds
Follow-up to 074048ae80 #16321
Follow-up to 2ee754d830 #16323
Closes #16370
2025-02-17 16:59:57 +01:00
Viktor Szakats
67559aa8ce
CI: dump non-pre-fill configure log on pre-fill check fail
To help debugging builds where the actual feature check is broken.

Follow-up to e7adf3e837 #15841
Closes #16369
2025-02-17 16:59:56 +01:00
dependabot[bot]
a74dd9f330
GHA: bump rojopolis/spellcheck-github-actions
Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 9e0a5fb25a80b89c84899657949cbd6e17eb376c to ed0756273a1658136c36d26e3d0353de35b98c8b.
- [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
- [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
- [Commits](9e0a5fb25a...ed0756273a)

---
updated-dependencies:
- dependency-name: rojopolis/spellcheck-github-actions
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Closes #16368
2025-02-17 16:47:10 +01:00
Daniel Stenberg
448caab0df
timediff: remove unnecessary double typecast
Closes #16367
2025-02-17 16:10:34 +01:00
Daniel Stenberg
bd15d8beb3
STRPARSE.md: sync with recent changes
New functions and Curl_str_number() changed number return type.

Closes #16365
2025-02-17 14:40:52 +01:00
Daniel Stenberg
bc6a404061
http_aws_sigv4: use strparse more for parsing
Closes #16366
2025-02-17 14:40:07 +01:00
Stefan Eissing
43012cb3af
ssl session cache: add exportable flag
Give peers and `exportable` flag, set TRUE when sessions for this peer
should not be exported. This evalualtes if the peer uses confidential
information (like srp username/password), a client certificate OR if the
"ssl_peer_key" contains relative paths.

When SSL is configured with paths for relevant components, like CA trust
anchors, an attempt is made to make this path absolute. When that does
not work or the infrstructure is not available, the peer key is marked
as *local*.

Exporting sessions based on relative paths may lead to confusion when
later imported in another execution context.

Closes #16322
2025-02-17 14:25:30 +01:00
Stefan Eissing
069f9d066e
hash: use single linked list for entries
Curl's double linked list is proven code, but it comes with some
additional memory overhead. Since hash's internal list of elements needs
only forward traversals, it seems worthwhile to use a single linked list
internally.

This saves 3 pointers per entry plus 3 pointers per slot.

Closes #16351
2025-02-17 14:23:23 +01:00
Daniel Stenberg
0064708f3f
cookie: minor parser simplification
- parse whitespace before the value is handled
- remove superflous checks from some ISBLANK() loops

Closes #16362
2025-02-17 13:22:14 +01:00
Daniel Stenberg
676de7f580
lib: use Curl_str_* instead of strtok_r()
Helps avoid extra mallocs. Gets rid of the private strtok_r
implementation.

Closes #16360
2025-02-17 13:18:28 +01:00
Daniel Stenberg
076444ec46
lib: simplify more white space loops
Since the ISBLANK() and ISSPACE() macros check for specific matches,
there is no point in using while(*ptr && ISSPACE(*ptr)) etc, as the
'*ptr' check is then superfluous.

Closes #16363
2025-02-17 13:17:18 +01:00
Daniel Stenberg
9d5563b535
build: even more strtoll cleanups
Follow-up to b4538ec522

Closes #16359
2025-02-17 11:40:17 +01:00
Marcel Raad
db4d617c1c
build: enable -Wjump-misses-init for GCC 4.5+
This should have caught https://github.com/curl/curl/issues/16246.

Closes https://github.com/curl/curl/pull/16252
2025-02-17 08:48:36 +01:00