Commit Graph

35528 Commits

Author SHA1 Message Date
Marcel Raad
2a9dfe275d
http: fix build with cookies and HSTS disabled
All arguments and local variables in `http_header_s` were unused when
both `CURL_DISABLE_COOKIES` and `CURL_DISABLE_HSTS` were defined.

Closes https://github.com/curl/curl/pull/17753
2025-06-26 12:19:16 +02:00
Viktor Szakats
f37d5f42f2
tests: fix BUNDLE variable references in Makefile.am
Bug: https://github.com/curl/curl/pull/17750/files#diff-0c866a04cf144e1595f64820c652daaa923358d4de1b30ca8baf85c70ec12a2dR83

Closes #17751
2025-06-26 10:55:47 +02:00
Viktor Szakats
1679802b3a
tests: use %b64[] to base64 data in 2056, 2057
Follow-up to 63011ac638 #17721

Closes #17748
2025-06-26 10:20:43 +02:00
Viktor Szakats
73c548e101
autotools: drop redundant Makefile.inc from EXTRA_DIST in src
Closes #17747
2025-06-26 10:20:43 +02:00
Viktor Szakats
53c88435d8
build: split .c and .h file lists in tests
It allows to pass `.h` files only where they are really needed, which is
`EXTRA_DIST` (or `*SOURCES`) for autotools.

Also:
- rename variables to be shorter and consistent.
- drop references to non-local headers. We don't need to pass them as
  dist sources.
- drop empty variables and references, after the above.
- server: add placeholder `UTIL_H`.

Closes #17745
2025-06-26 10:20:41 +02:00
Dan Fandrich
f547bca4b6 DISTROS: update NixOS link 2025-06-25 23:01:58 -07:00
DoI
83baac43a8
curl: improve non-blocking STDIN performance
Using a select() call on supported platforms to check for data with a
given timeout

Closes #17566
2025-06-25 22:58:53 +02:00
Viktor Szakats
4914c2177e
autotools: detect and link brotlicommon library for brotli
`brotlicommon` is necessary when linking brotli statically.
E.g. on Alpine Linux with `PKG_CONFIG='pkg-config --static'`.

It also syncs brotli libs listed in `libcurl.pc` and `curl-config` with
those generated by cmake, which already listed `brotlicommon` there.

Also:
- remove workaround from GHA/configure-vs-cmake CI jobs.

Ref: 69cda1b704
Follow-up to f2adb3b6d7 #15431
Reported-by: Christopher Boyd
Fixes #17678
Closes #17723
2025-06-25 19:45:35 +02:00
SC404
6c85579c84
cmake: enable soversion by default for OpenHarmony OS
Closes #17743
2025-06-25 15:49:17 +02:00
Daniel Stenberg
d22057d78b
lib: address singleuse issues
- markup some functions UNITTEST, so that they are static unless in a
  unit test build

- make some functions #ifdef UNITTESTS as they are only used from unit
  tests

- adjusted unit tests accordingly to use local prototypes for functions
  not global in the library

Closes #17734
2025-06-25 11:46:26 +02:00
Daniel Stenberg
b5593a6fe0
urlapi: use uppercase hex encoding
For consistency. RFC 3986 section 2.1 says:

  "URI producers and normalizers should use uppercase hexadecimal digits
  for all percent-encodings."

Reported-by: Jeroen Ooms
Fixes #17685
Closes #17739
2025-06-25 11:44:13 +02:00
Daniel Stenberg
4c5672774f
runtests.pl: fix sprintf() using one too many %s
Closes #17740
2025-06-25 11:27:32 +02:00
Keno Fischer
40dcf5567c
docs: reflect that delimiter-separated capath is only OpenSSL
curl passes down the capath directly to the backends. OpenSSL will then
delimiter-separate this path internally to support multiple directories
(using its certificate hash scheme). However, the other backends
(wolfSSL, mbedTLS, gnutls) only expect a single directory (and do not
use the hash scheme, preferring to iterate the directory and load all
files). This adjusts the `--capath` documentation to reflect that
multiple paths is an OpenSSL-specific feature. Alternatively, curl could
delimiter-separate these itself, but I'm not sure it's worth it.

Ref https://github.com/JuliaLang/NetworkOptions.jl/issues/41

Closes #17737
2025-06-25 11:23:56 +02:00
Viktor Szakats
7ba58cf89c
autotools: drop headers from src mk-unity rules (fixup)
Unnecessarily added in f4649425f2.

Follow-up to f4649425f2 #17727

Closes #17742
2025-06-25 11:02:25 +02:00
Viktor Szakats
26326c5297
build: stubgss tidy-ups (in tests)
- cmake: avoid running clang-tidy twice.
- autotools: do not pass curl/libtest-specific macros.

Also:
- autotools: drop `CFLAG_CURL_SYMBOL_HIDING` from libtests.
   Unused since 09437d8cd4 #14695

Closes #17738
2025-06-25 09:57:06 +02:00
Viktor Szakats
f4649425f2
build: fix libcurltool with cmake and tunits, related tidy-ups
Sync how libcurltool is built in different modes and build systems.

cmake:
- build libcurltool with curlx when building shared libcurl.
  To make it possible to use standard libcurl when linking tunits.
  Also syncing this with autotools.
  The remaining difference is that cmake allows to select shared or
  static for curl tool and tests/examples independently.
- fix to link with libcurl instead of libcurlu.
  To sync with autotools and to link with the standard libcurl for
  tool unit tests.
- fix `source_group()` to always include curlx sources.
- add missing 'curlx header files' source group.

autotools:
- build libcurltool without curlx when building static libcurl in
  non-unity builds.
  To avoid double compilation, just to be thrown away at link time.
  Also to sync with unity builds.

both:
- sync source order between autotools and cmake.
- make sure to pass all headers with both autotools and cmake.
  This is a no-op with cmake. Maybe a future patch should make sure
  to not pass those to remove that noise.

Ref: #17696

Closes #17727
2025-06-25 09:57:06 +02:00
Viktor Szakats
1ec0da0149
tests: constify, make consts static
- lib509: constify an input string.
- add `static` to const data, where missing.
- tool1394: fix indentation.

Closes #17736
2025-06-25 09:57:06 +02:00
Viktor Szakats
db512ee267
tests/server: move memory init to memptr.c
To sync with tests/libtest.

Closes #17735
2025-06-25 01:37:56 +02:00
Viktor Szakats
04e90d4814
mk-lib1521: replace printf with curl_mprintf
Ref: #17731

Closes #17732
2025-06-25 01:37:56 +02:00
Stefan Eissing
e80c893254
multi: xfer table/bitset, handle limits
* calculate capacity growth on multi's xfer table and bitsets to
  work correctly when approaching UINT_MAX
* uint-bset: track the first 64bit slot used. This avoids slot scans
  on empty sets.
* uint-tbl: remove restriction to grow ot UINT_MAX, it is multi's
  job to enforce limits suitable for its use
* test751: use curl_mfprintf() for error messages

Closes #17731
2025-06-24 15:02:52 +02:00
Daniel Stenberg
65f8253336
bufq: remove the unused Curl_bufq_unwrite function
Follow-up to 02edae54e8

Closes #17730
2025-06-24 10:56:54 +02:00
Joel Depooter
c153d9eadf
cmake: check USE_WINDOWS_SSPI when adding secur32 to CURL_LIBS
Instead of CURL_WINDOWS_SSPI.

When running CMake on Windows with no additional parameters (ie default
build configuration), the generated project files do not include the
`secur32.lib` library in the linker settings. This is because
the relevant check was looking at `CURL_WINDOWS_SSPI` instead of
`USE_WINDOWS_SSPI`.

`USE_WINDOWS_SSPI` is enabled when building with SChannel (the default
on Windows), or if `CURL_WINDOWS_SSPI` is specified on the command line.

Follow-up to 0d71b18153 #17413

Closes #17728
2025-06-24 09:57:42 +02:00
Viktor Szakats
8c9a9b87c2
appveyor: move old cmake from VS2008 to VS2010
In preparation of dropping the VS2008 job. To keep testing old cmake
(3.12.2) after that.

Closes #17725
2025-06-24 09:44:28 +02:00
Viktor Szakats
3ea0f71ffa
build: stop checking for sys/stat.h
It has been used unconditionally in `src` and `tests` since at least
2011-09-19 via fdecb56cbf. There are
earlier unguarded references in `tests`.

Also de-duplicate to include it just once.

Ref: https://github.com/curl/curl/pull/17717#issuecomment-2996631026

Closes #17724
2025-06-24 09:44:28 +02:00
Viktor Szakats
c4f9487089
tidy-up: replace <memdebug.h> with "memdebug.h" (src, units)
Closes #17722
2025-06-24 09:44:28 +02:00
Daniel Stenberg
c0cb3485fe
unit1302: expand the base64 encode/decode tests
Closes #17726
2025-06-24 07:55:16 +02:00
Viktor Szakats
bb50dee510
tests/server: de-dupe/merge three sockdaemon() clones into one
Also: tidy up `if()` expressions here and there.

Follow-up to f4f25505df #15000

Closes #17719
2025-06-23 17:02:43 +02:00
Viktor Szakats
1a70977a83
build: drop explicit curlx from hdr paths, refer headers with curlx/ prefix
To make all src and test code refer to curlx headers the same way.

Also:
- src: move `curlx.h` include to `tool_setup.h`.
- src/tool_setup.h: drop stray `curlx/timeval.h`.
- servers: de-duplicate `curlx.h` and `curl_setup.h` includes.
- libtests, units: drop stray curlx sub-headers in favor of
  `<curlx/curlx.h>`.
- tests: include `curlx.h` with `<>` instead of `""`. To match
  other parts of the codebase.

Closes #17680
2025-06-23 17:02:43 +02:00
Daniel Stenberg
63011ac638
tests: use %b64[] to base64 data
... instead of storing the data base64 encoded.

Closes #17721
2025-06-23 16:47:14 +02:00
NINIKA
05382f3e78
asyn-ares: remove redundant NULL check
Closes #17720
2025-06-23 16:34:43 +02:00
Viktor Szakats
2636828eee
tests: drop unused or redundant includes
Closes #17717
2025-06-23 13:49:03 +02:00
Daniel Stenberg
36a3cd5374
RELEASE-NOTES: synced 2025-06-23 13:41:12 +02:00
Stefan Eissing
c7a6319698
multi: clear the dirty set of transfers no longer processing
When a transfer is no longer processed, it might still apear in the
dirty bitset. Clear the dirty bit when this condition is encountered.

Closes #17718
2025-06-23 13:36:33 +02:00
Viktor Szakats
6425ce47df
tests/libtest: use curltime from curlx
Replacing the local implementation.

Closes #17716
2025-06-23 11:29:41 +02:00
Viktor Szakats
a2de3f08e3
tests/libtest: call curlx_now_init() for unit 1399, 2600 (Windows)
Follow-up to 35d0c047ce #17641

Closes #17714
2025-06-23 10:55:31 +02:00
Daniel Stenberg
aed828cc51
tests/dnsd: read config from file
Make the <dns> tag in a test case control what is stored there. Also
documented. Make test 2102 and 2103 use the new tag.

Lets the test case config the A and AAAA contents the server replies
with. Initial work for the HTTPS RR exists, but does not yet work.

Closes #17543
2025-06-23 08:24:09 +02:00
Daniel Stenberg
2cdc02f49f
libcurl-env.md: drop LOGNAME, USER and NTLMUSER
They were used for NTLM-WB, which support was removed for back in 8.8.0

Closes #17713
2025-06-23 08:21:05 +02:00
Viktor Szakats
85bf8b19ac
cmake: sync tests scripts with each other and autotools (more)
Closes #17711
2025-06-22 23:42:14 +02:00
Viktor Szakats
e088e10454
cmake: replace the way clang-tidy verifies tests, fix issues found
Replace existing `mk-unity.pl` `--embed` workaround with running
`clang-tidy` manually on individual test source instead. This aligns
with how clang-tidy works and removes `mk-unity.pl` from the solution.

Also:
- mqttd: fix potentially uninitialized buffer by zero filling it.
  ```
  tests/server/mqttd.c:484:41: error: The left operand of '<<' is a garbage value
    [clang-analyzer-core.UndefinedBinaryOperatorResult,-warnings-as-errors]
    484 |       payload_len = (size_t)(buffer[10] << 8) | buffer[11];
        |                                         ^
  [...]
  tests/server/mqttd.c:606:45: error: The left operand of '<<' is a garbage value
    [clang-analyzer-core.UndefinedBinaryOperatorResult,-warnings-as-errors]
    606 |       topiclen = (size_t)(buffer[1 + bytes] << 8) | buffer[2 + bytes];
        |                                             ^
  ```
- sockfilt: fix potential out-of-bound pointer:
  ```
  tests/server/sockfilt.c:1128:33: error: The 2nd argument to 'send' is a buffer
     with size 17010 but should be a buffer with size equal to or greater than
     the value of the 3rd argument (which is 18446744073709551615)
     [clang-analyzer-unix.StdCLibraryFunctions,-warnings-as-errors]
   1128 |         ssize_t bytes_written = swrite(sockfd, buffer, buffer_len);
        |                                 ^
  ```
- clang-tidy: suppress bogus `bzero()` warnings that happens
  inside the notorious `FD_ZERO()` macros, on macOS.

Ref: https://github.com/curl/curl/pull/17680#issuecomment-2991730158

Closes #17705
2025-06-22 23:08:46 +02:00
Viktor Szakats
9837dd429a
GHA/windows: drop MSYS2 runtime downgrades
No longer necessary after bumping the default runtime to a version
fixing the previously experienced performance drop.

Thanks to MSYS2/Cygwin teams for the help and fix.

Follow-up to 9a26be1e6a #17708
Follow-up to d4896d94f2 #16424

Closes #17710
2025-06-22 23:08:46 +02:00
renovate[bot]
9a26be1e6a
GHA: update msys2/setup-msys2 digest to 40677d3
After:
MINGW64_NT-10.0-20348 runnervmdy573 3.6.3-1f8def9f.x86_64 2025-06-18 07:19 UTC x86_64 Msys

Before:
MINGW64_NT-10.0-20348 runnervmdy573 3.5.7-2644508f.x86_64 2025-02-06 19:32 UTC x86_64 Msys

Closes #17708
2025-06-22 22:43:15 +02:00
Yedaya Katsman
8128a17e71
rustls: don't try printing the not provided file
Caught by gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0:
```
vtls/rustls.c: In function ‘cr_connect’:
vtls/rustls.c:857:61: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
  857 |     failf(data, "rustls: must provide certificate with key '%s'",
      |                                                             ^~
```

Closes #17704
2025-06-22 22:31:11 +02:00
Viktor Szakats
83a8818cfe
h2_serverpush: fix file handle leaks reported by clang-tidy
clang-tidy (20.1.6) found it locally consistently. Missed in CI.

Closes #17706
2025-06-22 21:42:53 +02:00
Viktor Szakats
d1f036c424
cmake: configure c-ares header directory in project root (was: lib)
The c-ares header directory was added to the header path within `lib`,
as opposed to every other dependency which added them in the root
`CMakeLists.txt`. Such exception is no longer necessary. This patch
aligns c-ares header setup with the rest of dependencies. And also with
autotools, which also makes no exception here.

Cherry-picked from #17705
Cherry-picked from #16973

Closes #17707
2025-06-22 21:41:03 +02:00
Viktor Szakats
6a0cd4feb7
tests: make individual test sources compile cleanly
Tidy up headers and includes to ensure all individual test source
compile cleanly (but not link). To allow running clang-tidy (and
possibly other static analyzers) on them. It also improves readability
and allows to verify them locally, without the bundle logic.

clang-tidy ignores #included C files, so it's blind to bundle C files
the include these tests. The current workaround of embedding has
a couple of downsides:. meaningless filenames and line numbers,
missing issues, messing up self header paths. Thus, running it on
individual sources would be beneficial.

Also:
- de-duplicate includes.
- untangle some includes.
- formatting/indentation fixes.
- merge `getpart.h` into `first.h`.

Ref: https://github.com/curl/curl/pull/17680#issuecomment-2991730158

Closes #17703
2025-06-22 15:58:15 +02:00
Viktor Szakats
4d4d09eb7f
cmake: drop reference to future variable [ci skip]
Follow-up to 855acb3bb0 #17701
2025-06-22 13:19:15 +02:00
Viktor Szakats
855ae76513
tests/libtest: drop TEST_HANG_TIMEOUT redefinition hack
Before this patch the code relied on re-initializing `TEST_HANG_TIMEOUT`
macro before compiling each test, to allow them each to override it to
a custom value for single tests. Thie required re-including `test.h`
into each test.

After this patch this macro becomes a global, immutable, default. Tests
which want to override it can now use alternate macros that do accept
a custom timeout. The only test currently affected is lib1501.

Follow-up to 2c27a67daa #17590

Closes #17702
2025-06-22 13:15:13 +02:00
Viktor Szakats
855acb3bb0
cmake: add target property dumper helper function
It's pretty rough and a giant hack, but helps debugging and findind ways
while navigating the CMake maze. I find it sad CMake doesn't have
a built-in function for this that works correctly in all situations.
It's invaluable to be able to see what properties and values an object
has.

It's also possible there is a better solution to this, but I could not
find it.

Cherry-picked from #16973

Closes #17701
2025-06-22 13:15:13 +02:00
Daniel Stenberg
52f58ebb10
curl_get_line: make sure lines end with newline
Verify with test 792 and 793

Reported-by: z2_
Closes #17697
2025-06-22 12:58:53 +02:00
Viktor Szakats
e29f11f2d6
tests/server: drop memdebug.h
It's no longer used in any build configuration.

Follow-up to fffec3d7e9 #17629

Closes #17700
2025-06-22 09:00:53 +02:00