Commit graph

39149 commits

Author SHA1 Message Date
Patrick Monnerat
f02c53361e
sasl: fix zero-length response encoding
A sasl zero-length normal response is an empty string, unlike an initial
response. Since the encoding of a zero-length initial response is
protocol dependent, move its handling to the protocol-specific sendauth
procedure. Similarly, do not check for an '=' server message, as this
should normally never occur.

Update the erroneous tests accordingly.

Closes #22218
2026-06-30 08:58:33 +02:00
alhudz
bedeeaa4a7
smtp: reject CR and LF in the envelope address
Verified in test 2110

Closes #22119
2026-06-29 22:28:46 +02:00
Daniel Stenberg
8aeef462e3
config2setopt.c: refactor config2setopts
Introduce sub functions

Closes #22215
2026-06-29 22:24:57 +02:00
Daniel Stenberg
7791b1629b
CURLSHOPT_(UN)SHARE.md: do not modify shares while in use
Reported-by: smaeljaish on hackerone

Closes #22217
2026-06-29 22:23:55 +02:00
Daniel Stenberg
ea71c3b6b6
openldap: handle Curl_sasl_continue() returns better
Similar to how it gets treated already in other protocol handlers.

Follow-up to eeca818b1e

Reported-by: Eunsoo Kim
Closes #22213
2026-06-29 22:22:52 +02:00
HwangRock
df350dd0d8
content_encoding: give a clear error on multi-member gzip
A gzip Content-Encoding response holding more than one gzip member made
curl decode the first member and then fail the transfer with a bare
CURLE_WRITE_ERROR and no hint about the cause. Detect the trailing
member and fail with a message that explains what happened.

Fixes #22156
Closes #22172
2026-06-29 22:21:34 +02:00
Viktor Szakats
2b5911880b
openssl: prefer modern API flavors for EVP_MD_CTX new/free
Available in all supported OpenSSL flavors and versions. They are
functionally identical to the legacy API calls.

Closes #22219
2026-06-29 20:04:57 +02:00
Daniel Stenberg
f3c11692a9
CURLOPT_SSH_*_KEYFILE: used for setting up, then no more
So changing them after the connection is made still allows libcurl to
reuse the existing connections.

Reported-by: Bigtang on hackerone
Closes #22211
2026-06-29 14:34:34 +02:00
Viktor Szakats
c9d8a6bc10
mod_curltest: fix compiler warnings
```
mod_curltest.c:331:25: warning: result of comparison of unsigned expression >= 0 is always true [-Wtautological-unsigned-zero-compare]
  331 |           if(chunk_size >= 0) {
      |              ~~~~~~~~~~ ^  ~
mod_curltest.c:421:9: warning: declaration shadows a local variable [-Wshadow]
  421 |     int i, hd_len = (16 * 1024);
      |         ^
mod_curltest.c:288:7: note: previous declaration is here
  288 |   int i, chunks = 3, error_bucket = 1;
      |       ^
mod_curltest.c:501:40: warning: format specifies type 'int' but the argument has type 'unsigned int' [-Wformat]
  500 |                 "error_handler: request cleanup, r->status=%d, aborted=%d, "
      |                                                                        ~~
      |                                                                        %u
  501 |                 "close=%d", r->status, c->aborted, close_conn);
      |                                        ^~~~~~~~~~
mod_curltest.c:837:1: warning: missing field 'lock' initializer [-Wmissing-field-initializers]
  837 | };
      | ^
mod_curltest.c:914:43: warning: format specifies type 'int' but the argument has type 'apr_time_t' (aka 'long') [-Wformat]
  914 |     char *v = apr_psprintf(r->pool, "%d", limitrec.duration_sec);
      |                                      ~~   ^~~~~~~~~~~~~~~~~~~~~
      |                                      %ld
mod_curltest.c:956:16: warning: unused variable 'rv' [-Wunused-variable]
  956 |   apr_status_t rv;
      |                ^~
```

Closes #22214
2026-06-29 14:27:56 +02:00
Stefan Eissing
d647b84d53
CREDENTIALS.md: remove comment about emtpy user/pass
Closes #22212
2026-06-29 11:17:00 +02:00
Viktor Szakats
1671ebd975
build: drop superfluous STDC_HEADERS macro
It is traditionally defined by autotools to detect the presence of set
of standard C89 headers. autoconf 2.70 (2020-12-08) reduced the headers
covered to `stdlib.h`, `string.h`. After 2.59d (2006-06-05) obsoleting
it earlier. CMake replicated this detection, and curl included
`curl/stdcheaders.h` if standard headers were missing. However, such
condition could never happen because curl sources already assume all
checked standard headers (`stdarg.h`, `stdlib.h`, `string.h`) and
include them unconditionally.

Since this is an unused feature detection and an impossible fallback
path, drop them from CMake and curl's source. autotools continues to do
the detection by default, but its result is unused after this patch.

This leaves public `curl/stdcheaders.h` unused from within the codebase.

Refs:
f0c7c42553
86c213d0e3

Follow-up to 65dae4ad80 #22191
Follow-up to 4c5307b456
Ref: ae1912cb0d

Closes #22206
2026-06-29 11:11:16 +02:00
Viktor Szakats
99859ecca8
cf-ngtcp2-cmn: initialize new callback ptr for ngtcp2 1.24.0+, bump in CI
Fixes #22205

Closes #22207
2026-06-28 13:57:31 +02:00
renovate[bot]
c253a96296
GHA: update dependency ngtcp2/nghttp3 to v1.17.0
Closes #22202
2026-06-28 13:57:08 +02:00
Viktor Szakats
88d85916f2
cmake: minor improvements to cmake_uninstall.in.cmake
- reduce log noise by showing 'Uninstalling' message only if the file
  exists. (and a different message otherwise)
- replace cmake `rm` command with `file(REMOVE)`. For efficiency.
  Show manual message if the file could not be deleted.
  Ref: https://cmake.org/cmake/help/v3.18/command/file.html#remove
  Follow-up to 6d008352c6 #22193
- reduce log noise by showing 'Uninstalled' only if the deletion was
  successful. (and a different message otherwise)
- display `DESTDIR` env value if set.
- drop checking, setting and showing `CMAKE_INSTALL_PREFIX`.
  The value was never predefined, also not used, besides showing it,
  and showing it is misleading because `--prefix` may override the
  configure-time value, and also superfluous because the filenames
  are showing the actual prefix anyway.

Follow-up to 27e2a4733c

Closes #22201
2026-06-27 13:53:53 +02:00
Viktor Szakats
0a6c74a802
cmake: minor tidy-ups
- INSTALL-CMAKE.md: document that `CMAKE_INSTALL_PREFIX`
  may be set as environment (with CMake 3.29+)
  Ref: https://cmake.org/cmake/help/v3.29/variable/CMAKE_INSTALL_PREFIX.html
- CurlTests: fix copy-paste typo in comment.
  Spotted by GitHub Code Quality
- optimized out `_generated_dir` local variable.
- unfold a `@ONLY` to match rest of code.

Closes #22203
2026-06-27 11:56:18 +02:00
Viktor Szakats
39dec13ec0
build: always use local inet_pton()/inet_ntop() implementations
Also repurpose existing build-time feature checks into unit test 1961,
to verify.

Prior to this patch these functions were auto-detected with both
autotools and cmake. In case of autotools there was an extra
verification phase ensuring the functions work as expected. This step
required running the function, thus was limited to non-cross-builds. For
cross-builds and CMake it always used the system implementation if
present. On Windows it always used the local implementation, because
availability/use is complicated there.

After this patch all platforms, always use the local implementation,
which is known to be accurate. This makes curl behave more consistently,
and simplifies the build process, a fixes cross-builds and CMake
auto-detection differences.

Also:
- test1960: enable unconditionally.
- checksrc: disallow globally, allowlist in `block_ip.c` example.
- dnsd: verify ntop result for NULL before passing to printf.

Ref: https://github.com/curl/curl/pull/22137#issuecomment-4797440983
Ref: #22137
Ref: 8537a5b0bc #16577

Closes #22170
2026-06-27 01:24:39 +02:00
Viktor Szakats
a62e08c5eb
lib: fix 'ns' -> 'us' in trace messages
Closes #22200
2026-06-27 00:26:36 +02:00
Daniel Stenberg
996696621f
curl_trc: store callback info in a uint8, not a bool
The state is no longer just a bool so make sure to use a proper uint8_t
so that it gets restored properly.

Follow-up to a6af50c484

Closes #22199
2026-06-26 23:19:51 +02:00
Daniel Stenberg
334164cd80
RELEASE-NOTES: synced
Add entry to .mailmap
2026-06-26 23:17:26 +02:00
alhudz
65d8eaeaa2
gopher: reject CR and LF in the selector
Verifed in test 1609

Closes #22116
2026-06-26 23:09:43 +02:00
Stefan Eissing
d786a85f19
lib: hostname related cleanups
* format `data->state.aptr.host` without crlf, so signatures do not need
  to strip it again. Add the crlf when adding the header to the request
  dynbuf
* check `connect-to` strings on normalized hostname and user supplied
  hostname (when those differ)
* libssh: always use the peer for setting ssh option SSH_OPTIONS_HOST,
  preserve ipv6 [] enclosure, use IDN converted hostname otherwise. This
  is the libssh documented expectation.
  Do NOT use strings from URL parsing.

Closes #22128
2026-06-26 22:50:38 +02:00
Daniel Stenberg
58771cf4f3
VULN-DISCLOSURE-POLICY.md: issues that should be found by tests are LOW
Closes #22190
2026-06-26 22:46:31 +02:00
Viktor Szakats
9f9d2d10d9
lib1587: fix gcc -Wconversion with LibreSSL on Windows, test in CI
By exposing and reusing existing custom type via `vtls/openss.h`.

Also:
- GHA/curl-for-win: test in CI by enabling building tests.
  Cost is 45s per job, so limit it to the gcc job.

Seen with Windows x64 gcc (not tested in CI prior to this patch):
```
tests/libtest/lib1587.c:50:7: error: conversion from 'opt1587' {aka 'long long unsigned int'} to 'long int' may change value [-Werror=conversion]
   50 |       SSL_CTX_set_options(info->internals, opts);
      |       ^~~~~~~~~~~~~~~~~~~
tests/libtest/lib1587.c:59:7: error: conversion from 'opt1587' {aka 'long long unsigned int'} to 'long int' may change value [-Werror=conversion]
   59 |       SSL_set_options(info->internals, opts);
      |       ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/28258372229/job/83727170184?pr=22195#step:3:4884

Ref: da2f05e6f6 #22198
Ref: 6163566461 #22197
Follow-up to 3e40ccb875 #21290
Follow-up to 2db8ae480f #17809 #17801

Closes #22195
2026-06-26 22:44:53 +02:00
Viktor Szakats
da2f05e6f6
cmake: fix not to build tunits when BUILD_CURL_EXE=OFF
It fails as expected, with a list of errors:
```
In file included from _x64-win-ucrt-for-trurl-bld/tests/tunit/tunits.c:5:
tests/tunit/tool1394.c:76:11: error: call to undeclared function 'parse_cert_parameter'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   76 |     err = parse_cert_parameter(p->param, &certname, &passphrase);
      |           ^
[...]
tests/tunit/tool1622.c:68:5: error: call to undeclared function 'timebuf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |     timebuf(buffer, sizeof(buffer), secs);
      |     ^
[...]
tests/tunit/tool1623.c:104:26: error: call to undeclared function 'GetSizeParameter'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  104 |     ParameterError err = GetSizeParameter(check[i].input, &output);
      |                          ^
[...]
```
Ref: https://github.com/curl/curl/actions/runs/28256499057/job/83720797064?pr=22195

Ref: #22195
Ref: 640fed88b6

Closes #22198
2026-06-26 21:12:35 +02:00
Viktor Szakats
6163566461
openssl: drop unused pre-OpenSSL3 ctx_option_t typedef
Follow-up to 69c89bf3d3 #18330

Closes #22197
2026-06-26 21:12:35 +02:00
Viktor Szakats
b8fa725df3
cmake: dedupe expressions into local vars in cmake_uninstall.in.cmake
Also: use `IN LISTS` syntax.

Follow-up to 27e2a4733c

Closes #22194
2026-06-26 19:42:16 +02:00
Viktor Szakats
65dae4ad80
cmake: stop probing unused float.h for STDC_HEADERS
Also to sync up with current autotools, which stopped testing for it at
one point.

Follow-up to 4c5307b456

Closes #22191
2026-06-26 19:02:30 +02:00
Viktor Szakats
6d008352c6
cmake: replace deprecated remove command with rm and pass arg safely
All curl-supported CMake versions support the modern method, along with
the `--` marker.

Also:
- make sure to pass `-f` to not fail if the file is missing, as before
  this patch.
- drop now redundant `OUTPUT_QUIET`, `ERROR_QUIET` and error handling
  in `cmake_uninstall`.
- move filename to end of the error message for readability.
- GHA/linux: test these two 'clean' targets in the aws-lc job.

Refs:
https://cmake.org/cmake/help/v4.4/manual/cmake.1.html#cmdoption-cmake-E-arg-remove
https://cmake.org/cmake/help/v3.18/manual/cmake.1.html#run-a-command-line-tool

Closes #22193
2026-06-26 19:01:30 +02:00
Viktor Szakats
a7e8016fa2
cmake: flatten build tree, tidy up base dir variables
- drop `generated` subdir, move these files to build root.
  To move them next to CPack and other config files, and to avoid
  a subdirectory for only 2 files.
  Follow-up to 69328490fc #2849

- add 'Consumed variables' comment for `CMake/cmake_uninstall.in.cmake`.

- move generated `cmake_uninstall.cmake` to the build root directory
  (from `CMake/`). To:
  - avoid creating a `CMake` subdirectory within the build directory
    with this single file in it.
  - move it next to its `cmake_install.cmake` counterpart.
  - move it next to `install_manifest.txt` which it relies on.

  Follow-up to 27e2a4733c

- Use `PROJECT_SOURCE_DIR` for these files, replacing
  `CMAKE_CURRENT_SOURCE_DIR`, to make it consistent with rest of CMake
  sources, and to reduce ambiguity in `CMake/cmake_uninstall.in.cmake`
  template.

Follow-up to 8198e388d3 #22188
Follow-up to 4839029645 #22187
Follow-up to 9126eb5a8a #15331

Closes #22192
2026-06-26 18:39:09 +02:00
Viktor Szakats
8be2daae0f
GHA/windows: set VCPKG_APPLOCAL_DEPS=OFF for vcpkg jobs
Add the necessary directory to `PATH` instead.

To disable a vcpkg feature (auto-copying DLL dependencies next to the
build targets) that was causing CI flakiness in the libssh2 repository.
In curl it currently cannot cause flakiness because targets (with DLL
dependencies) reside in separate directories.

AFAIU this vcpkg feature has been present and enabled by default for
a long time, but only a recent update made it visible in the log and
flaky at the same time, due to switching implementation.

This patch removes log noise and potential issues, improves efficiency,
and saves disk space: 74MB -> 71 in UWP, and 69MB -> 65 in the arm64 job.
Time saving is negligible with current jobs.

Refs:
https://github.com/libssh2/libssh2/pull/2114
30a0484cb7
https://github.com/microsoft/vcpkg/pull/52315
https://learn.microsoft.com/vcpkg/reference/installation-tree-layout

Closes #22189
2026-06-26 15:45:24 +02:00
Viktor Szakats
8198e388d3
cmake: tidy-up base directory variable for include/*/CMake/* files
Use `PROJECT_SOURCE_DIR` for these files, replacing
`CMAKE_CURRENT_SOURCE_DIR`, to make it consistent with rest of CMake
sources and to reflect that the locations of these files are fixed and
do not depend on the CMake source location referencing them.

Exception: keep as-is before calling `project()`, which is where
`PROJECT_SOURCE_DIR` is initialized.

Ref: https://cmake.org/cmake/help/v3.18/command/project.html

Follow-up to #22187
Follow-up to 9126eb5a8a #15331

Closes #22188
2026-06-26 15:45:24 +02:00
Viktor Szakats
4839029645
cmake: robustify base path in local file reference
To make the macro find this file also when used elsewhere than the root
`CMakeLists.txt`. Current code only uses it from the root.

Follow-up to 88c17d5587

Closes #22187
2026-06-26 15:45:24 +02:00
Viktor Szakats
84c5dcdb05
tidy-up: syntax and code nits
- cmp-pkg-config.sh: replace `-r -f` with `-rf` to match rest of repo.
- configure.ac: add double quotes for robustness (not a bug).
- curl-openssl.m4: merge nested `if`s.
- CurlTests.c: drop `!= 0`, also to sync with m4.
- CurlTests.c: replace `example.com` with `localhost` in
  `gethostbyname()` feature test code. (compile-only, not a bug)
- GHA/http3-linux: drop literal `true` from bool expression.
- lib650: drop redundant `&`.
- move variable/call to left-hand side of equality checks, where
  missing.
- perl: detach `<`/`>` from filename in `open()`, where missing.
- schannel: apply two nit fixes lost in rebase.
- scripts/verify-release: drop redundant double quotes.
- scripts/verify-release: exit with error code on error.
- synctime: replace magic numbers with `sizeof()`.
- telnet: add missing parentheses to macro value.
- tests/Makefile.am: use single quotes.
- tool_operate: drop redundant `break` after `return` in VMS code.
- unit2413: drop unused NULL pointer + free call.
- unit2413: fix duplicate test case name.
- urlapi: drop redundant parentheses.
- urlapi: drop `CURL_UNCONST()` that became redundant.

Closes #22186
2026-06-26 15:45:24 +02:00
Alhuda Khan
a36384ab94
http: trim custom header name before the Authorization drop
A custom header name padded with blanks (`Authorization :`) missed the
exact-length compare and slipped past the cross-host Authorization and
Cookie drop, forwarding the header to the redirect target. Trim the
parsed name in both the request and proxy CONNECT header builders.

Closes #22178
2026-06-26 14:50:04 +02:00
Stefan Eissing
18475e662c
urlpieces: remove members that live in peers/creds
Remove members of `struct urlpieces` that now live in peers/creds.

Change all remaining uses of those urlpieces.

When comparing schemes, use the protocol constants.

Closes #22171
2026-06-26 14:39:40 +02:00
Stefan Eissing
cfc7922377
altsvc: use Curl_peer in processing
Use `data->state.origin` when processing alt-avc information.

Decomplexify parsing function.

Closes #22184
2026-06-26 14:12:53 +02:00
Stefan Eissing
2f1e94eaed
conncache: connection alive checks intervals
Do not check if a particular connection is alive or not more than once
every second. We did this on every connection reuse which is overkill
when sending many requests to the same host.

Closes #22169
2026-06-26 13:52:26 +02:00
Stefan Eissing
00d5562650
proxy: optimized env lookups
Optimize proxy env var lookups for the commen case of 'https' and 'http'
urls. We do this for every transfer.

Closes #22168
2026-06-26 13:50:20 +02:00
Daniel Stenberg
a6af50c484
multi: forbid curl_easy_pause from within multi socket callback
- there is a risk for a nasty recursive situation

- we avoid certain risks that the pause call changes things so that when
  returning from the callback, the state of some internals is undefined
  and we need to reload which is easy to miss

- we can't think of legitiate use cases for doing this. This is
  basically just the new favorite point for AI and security researchers
  to find hypothetical problems

Closes #22179
2026-06-26 13:43:48 +02:00
Daniel Stenberg
d8f9f0a912
tool_operate: remove call to abort()
Make an assert and return a plain error instead. No abort in release
code.

- also remove from two examples
- add as a banned function in checksrc
- document the banned state

Closes #22182
2026-06-26 13:41:55 +02:00
Viktor Szakats
397b8f0ec6
tidy-up: docs, comments, typos, whitespace
- GHA/windows: mention `IgnoreStandardErrorWarningFormat=true`
  in comment.
- cmake: fix MIT/GNU GSS order in messages.
- drop some exclamation marks from messages.
- drop redundant ending newlines from messages.
- fold/unfold where possible.
- fix indent, whitespace, typos and other nits.

Closes #22185
2026-06-26 11:36:09 +02:00
Viktor Szakats
15bd6c5d4c
cmake: document upstream variable ZLIB_ROOT
Closes #22177
2026-06-26 10:17:00 +02:00
Viktor Szakats
231445df2a
cmake: drop logic for GNU/kFreeBSD systems
Adopting change made in CMake, with description: "kFreeBSD is no longer
maintained or supported and was never an officially-supported release
architecture for Debian."

This system name was also dropped by CMake 4.1+:
https://cmake.org/cmake/help/v4.2/variable/CMAKE_SYSTEM_NAME.html

Credits-to: Roger Leigh
Ref: 99c8abed55
Ref: https://gitlab.kitware.com/cmake/cmake/-/work_items/26742
Ref: https://gitlab.kitware.com/cmake/cmake/-/work_items/26722

Follow-up to 5de6848f10 #10023 #5935

Closes #22176
2026-06-26 10:17:00 +02:00
Daniel Stenberg
fdbc5beed3
urlapi: make two #defines instead of magic values/strings in code
Closes #22181
2026-06-26 09:57:21 +02:00
Daniel Stenberg
cff59ddf4a
docs/INSTALL: minor polish
Closes #22183
2026-06-26 09:56:20 +02:00
Viktor Szakats
2c1e625a6f
INSTALL.md: add building-from-source overview section
Ref: #22098

Closes #22113
2026-06-25 17:43:36 +02:00
Viktor Szakats
27370e9fc7
GHA: bump some jobs to ubuntu-26.04
In jobs that may benefit from newer tool versions (pyspelling, possibly
CodeQL, CM integration, configure-vs-cmake). Also curl-for-win to match
the curl/curl-for-win repo that also bumped. Bump some Linux jobs to add
variation. Also the rest of `check*` jobs for no particular reason other
than using the latest.

Follow-up to 8f5e4f020e #22097
Follow-up to 139ce4d37c #22096
Follow-up to e44f1a1446 #22094

Closes #22092
2026-06-25 17:10:56 +02:00
Stefan Eissing
26c6a4d898
urlapi: do not keep an internal port string
Do not allocated an internal port string, just keep and number and a bit
if it is present. Format the port string in a local buffer when someone
asks for it and copy that.

This avoid the format/alloc penalty when parsing URLs and no one ever
asking for the port string.

(And there will be a method to get the uint16_t value directly in
 another PR)

Closes #22167
2026-06-25 14:07:40 +02:00
Viktor Szakats
d2fe26cfe2
runtests: exit with error on -k option
Ref: https://github.com/curl/curl/pull/22157#discussion_r3473254887
Follow-up to 481e10160f #22157
2026-06-25 11:35:06 +02:00
Viktor Szakats
481e10160f
runtests: restore -k option and actively process as no-op
Restore processing this option to avoid falling it through and
misinterpreted as something else, which in turn disables tests.

Exit with an error instead. We delete completely in December 2026.

Reported-by: Sam James
Bug: https://github.com/curl/curl/pull/22100#issuecomment-4789828929
Follow-up to 04305a3e40 #22100
Follow-up to 6617db6a7e #4035

Closes #22157
2026-06-25 11:32:36 +02:00