]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
19 months agocmake: fix generation for system name iOS
Mark Sinkovics [Thu, 14 Dec 2023 00:49:55 +0000 (19:49 -0500)] 
cmake: fix generation for system name iOS

This PR fixes a problem that happens during CMake configuration when
the `CMAKE_SYSTEM_NAME` set to `iOS` and not `Darwin`. This value is
available (as far as I remember) version 3.14. The final solution
(thanks to @vszakats) is to use `APPLE` which contains all the Apple
platforms https://cmake.org/cmake/help/latest/variable/APPLE.html.

This issue was found when during vcpkg installation. Running command
`vcpkg install curl:arm64-ios` and `vcpkg install curl:x64-ios` failed
with message:
```
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HAVE_H_ERRNO_ASSIGNABLE_EXITCODE (advanced)
```
After this fix, I was able to compile the compile the binary without
any issue.

In addition to that fix, this PR also contains an simplification to
check if the platform is not APPLE.

Co-authored-by: Viktor Szakats
Closes #12515

19 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 16 Dec 2023 21:17:06 +0000 (22:17 +0100)] 
RELEASE-NOTES: synced

19 months agognutls: fix build with --disable-verbose
Baruch Siach [Mon, 11 Dec 2023 18:45:01 +0000 (20:45 +0200)] 
gnutls: fix build with --disable-verbose

infof() parameters must be defined event with --disable-verbose since
commit dac293cfb702 ("lib: apache style infof and trace
macros/functions").

Move also 'ptr' definition under !CURL_DISABLE_VERBOSE_STRINGS.

Fixes the following build failure:

In file included from ../lib/sendf.h:29,
                 from vtls/gtls.c:44:
vtls/gtls.c: In function 'Curl_gtls_verifyserver':
vtls/gtls.c:841:34: error: 'version' undeclared (first use in this function); did you mean 'session'?
  841 |         gnutls_protocol_get_name(version), ptr);
      |                                  ^~~~~~~

Closes #12505

19 months agobuild: delete unused `HAVE_{GSSHEIMDAL,GSSMIT,HEIMDAL}`
Viktor Szakats [Tue, 7 Nov 2023 00:25:18 +0000 (00:25 +0000)] 
build: delete unused `HAVE_{GSSHEIMDAL,GSSMIT,HEIMDAL}`

Stop setting `HAVE_GSSHEIMDAL`, `HAVE_GSSMIT` and `HAVE_HEIMDAL`.
There was no place in the build system or source code that used them.

Reviewed-by: Daniel Stenberg
Closes #12506

19 months agobuild: remove redundant `CURL_PULL_*` settings
Viktor Szakats [Mon, 11 Dec 2023 17:28:35 +0000 (17:28 +0000)] 
build: remove redundant `CURL_PULL_*` settings

These macros were not propagated to the source code from CMake.

autotools set only one of them (`CURL_PULL_SYS_POLL_H`), initially to
address an AIX issue [1]. This later broke when introducing `system.h`
[2] without the logic it enabled. A subsequent fix [3] re-added the
logic, and also enabled it for AIX before its use, directly in
`system.h`.

[1] 2012-11-23: 665adcd4b7bcdb7deb638cdc499fbe71f8d777f2
[2] 2017-03-29: 9506d01ee50d5908138ebad0fd9fbd39b66bd64d #1373
[3] 2017-08-25: 8a84fcc4b59e8b78d2acc6febf44a43d6bc81b59 #1828 #1833

Reviewed-by: Daniel Stenberg
Closes #12502

19 months agosystem.h: sync mingw `CURL_TYPEOF_CURL_SOCKLEN_T` with other compilers
Viktor Szakats [Sun, 10 Dec 2023 02:19:32 +0000 (02:19 +0000)] 
system.h: sync mingw `CURL_TYPEOF_CURL_SOCKLEN_T` with other compilers

Align mingw with the other Windows compilers and use the `int` type for
`CURL_TYPEOF_CURL_SOCKLEN_T` (and thus for `curl_socklent_t`). This
makes it unnecessary to make a mingw-specific trick and pull all Windows
headers early just for this type definition. This type is specific to
Windows, not to the compiler. mingw-w64's Windows header maps it to
`int` too.

With this we also delete all remaining uses of `CURL_PULL_WS2TCPIP_H`.

[ The official solution is to use `socklen_t` for all Windows compilers.
In this case we may want to update `curl/curl.h` to pull in Windows
headers before `system.h`. ]

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro
Closes #12501

19 months agowindows: simplify detecting and using system headers
Viktor Szakats [Sat, 9 Dec 2023 20:37:11 +0000 (20:37 +0000)] 
windows: simplify detecting and using system headers

- autotools, cmake: assume that if we detect Windows, `windows.h`,
  `winsock2.h` and `ws2tcpip.h` do exist.
- lib: fix 3 outlier `#if` conditions to use `USE_WINSOCK` instead of
  looking for `winsock2.h`.
- autotools: merge 3 Windows check methods into one.
- move Watt-32 and lwIP socket support to `setup-win32.h` from
  `config-win32.h`. It opens up using these with all build tools. Also
  merge logic with Windows Sockets.
- fix to assume Windows sockets with the mingw32ce toolchain.
  Follow-up to: 2748c64d605b19fb419ae56810ad8da36487a2d4
- cmake: delete unused variable `signature_call_conv` since
  eb33ccd5332435fa50f1758e5debb869c6942b7f.
- autotools: simplify `CURL_CHECK_WIN32_LARGEFILE` detection.
- examples/externalsocket: fix header order.
- cmake/OtherTests.cmake: delete Windows-specific `_source_epilogue`
  that wasn't used anymore.
- cmake/OtherTests.cmake: set `WIN32_LEAN_AND_MEAN` for test
  `SIZEOF_STRUCT_SOCKADDR_STORAGE`.

After this patch curl universally uses `_WIN32` to guard
Windows-specific logic. It guards Windows Sockets-specific logic with
`USE_WINSOCK` (this might need further work).

Reviewed-by: Jay Satiro
Closes #12495

19 months agobuild: enable missing OpenSSF-recommended warnings, with fixes
Viktor Szakats [Fri, 8 Dec 2023 13:05:09 +0000 (13:05 +0000)] 
build: enable missing OpenSSF-recommended warnings, with fixes

https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html
as of 2023-11-29 [1].

Enable new recommended warnings (except `-Wsign-conversion`):

- enable `-Wformat=2` for clang (in both cmake and autotools).
- add `CURL_PRINTF()` internal attribute and mark functions accepting
  printf arguments with it. This is a copy of existing
  `CURL_TEMP_PRINTF()` but using `__printf__` to make it compatible
  with redefinting the `printf` symbol:
  https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC94
- fix `CURL_PRINTF()` and existing `CURL_TEMP_PRINTF()` for
  mingw-w64 and enable it on this platform.
- enable `-Wimplicit-fallthrough`.
- enable `-Wtrampolines`.
- add `-Wsign-conversion` commented with a FIXME.
- cmake: enable `-pedantic-errors` the way we do it with autotools.
  Follow-up to d5c0351055d5709da8f3e16c91348092fdb481aa #2747
- lib/curl_trc.h: use `CURL_FORMAT()`, this also fixes it to enable format
  checks. Previously it was always disabled due to the internal `printf`
  macro.

Fix them:

- fix bug where an `set_ipv6_v6only()` call was missed in builds with
  `--disable-verbose` / `CURL_DISABLE_VERBOSE_STRINGS=ON`.
- add internal `FALLTHROUGH()` macro.
- replace obsolete fall-through comments with `FALLTHROUGH()`.
- fix fallthrough markups: Delete redundant ones (showing up as
  warnings in most cases). Add missing ones. Fix indentation.
- silence `-Wformat-nonliteral` warnings with llvm/clang.
- fix one `-Wformat-nonliteral` warning.
- fix new `-Wformat` and `-Wformat-security` warnings.
- fix `CURL_FORMAT_SOCKET_T` value for mingw-w64. Also move its
  definition to `lib/curl_setup.h` allowing use in `tests/server`.
- lib: fix two wrongly passed string arguments in log outputs.
Co-authored-by: Jay Satiro
- fix new `-Wformat` warnings on mingw-w64.

[1] https://github.com/ossf/wg-best-practices-os-developers/blob/56c0fde3895bfc55c8a973ef49a2572c507b2ae1/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C%2B%2B.md

Closes #12489

19 months agoMakefile.mk: drop Windows support
Viktor Szakats [Sat, 28 Oct 2023 09:48:19 +0000 (09:48 +0000)] 
Makefile.mk: drop Windows support

And DLL-support with it. This leaves `Makefile.mk` for MS-DOS and Amiga.

We recommend CMake instead. With unity mode it's much faster, and about
the same without.

Ref: https://github.com/curl/curl/pull/12221#issuecomment-1783761806
Reviewed-by: Daniel Stenberg
Closes #12224

19 months agocmdline-docs: use .IP consistently
Daniel Stenberg [Sat, 16 Dec 2023 10:46:31 +0000 (11:46 +0100)] 
cmdline-docs: use .IP consistently

Remove use of .TP and some .B. The idea is to reduce nroff syntax as
much as possible and to use it consistently. Ultimately, we should be
able to introduce our own easier-to-use-and-read syntax/formatting and
convert on generation time.

Closes #12535

19 months agohttp: fix off-by-one error in request method length check
Tatsuhiko Miyagawa [Sat, 16 Dec 2023 09:28:55 +0000 (01:28 -0800)] 
http: fix off-by-one error in request method length check

It should allow one more byte.

Closes #12534

19 months agocurl: show ipfs and ipns as supported "protocols"
Daniel Stenberg [Tue, 12 Dec 2023 16:48:22 +0000 (17:48 +0100)] 
curl: show ipfs and ipns as supported "protocols"

They are accepted schemes in URLs passed to curl (the tool, not the
library).

Also makes curl-config show the same list.

Co-Authored-by: Jay Satiro
Reported-by: Chara White
Bug: https://curl.se/mail/archive-2023-12/0026.html
Closes #12508

19 months agoRevert "urldata: move async resolver state from easy handle to connectdata"
Daniel Stenberg [Thu, 14 Dec 2023 22:25:09 +0000 (23:25 +0100)] 
Revert "urldata: move async resolver state from easy handle to connectdata"

This reverts commit 56a4db2e4e2bcb9a0dcb75b83560a78ef231fcc8 (#12198)

We want the c-ares channel to be held in the easy handle, not per
connection - for performance.

Closes #12524

19 months agoopenssl: re-match LibreSSL deinit with init
Viktor Szakats [Fri, 15 Dec 2023 01:50:06 +0000 (01:50 +0000)] 
openssl: re-match LibreSSL deinit with init

Earlier we switched to use modern initialization with LibreSSL v2.7.0
and up, but did not touch deinitialization [1]. Fix it in this patch.

Regression from bec0c5bbf34369920598678161d2df8bea0e243b #11611

[1] https://github.com/curl/curl/pull/11611#issuecomment-1668654014

Reported-by: Mike Hommey
Reviewed-by: Daniel Stenberg
Fixes #12525
Closes #12526

19 months agolibssh: supress warnings without version check
Daniel Stenberg [Thu, 14 Dec 2023 22:07:24 +0000 (23:07 +0100)] 
libssh: supress warnings without version check

Define unconditionally.

Follow-up from d21bd2190c46ad7fa

Closes #12523

19 months agohostip: return error immediately when Curl_ip2addr() fails
Daniel Stenberg [Thu, 14 Dec 2023 15:34:25 +0000 (16:34 +0100)] 
hostip: return error immediately when Curl_ip2addr() fails

Closes #12522

19 months agolibssh: improve the deprecation warning dismissal
Theo [Thu, 14 Dec 2023 12:53:23 +0000 (13:53 +0100)] 
libssh: improve the deprecation warning dismissal

Previous code was compiler dependant, and dismissed all deprecation warnings
indiscriminately.

libssh provides a way to disable the deprecation warnings for libssh only, and
naturally this is the preferred way.

This commit uses that, to prevent the erroneous hiding of potential, unrelated
deprecation warnings.

Fixes #12519
Closes #12520

19 months agotest1474: removed
Daniel Stenberg [Mon, 11 Dec 2023 22:17:26 +0000 (23:17 +0100)] 
test1474: removed

The test was already somewhat flaky and disabled on several platforms,
and after 1da640abb688 even more unstable.

19 months agoreadwrite_data: loop less
Daniel Stenberg [Mon, 11 Dec 2023 18:36:27 +0000 (19:36 +0100)] 
readwrite_data: loop less

This function is made to loop in order to drain incoming data
faster. Completely removing the loop has a measerably negative impact on
transfer speeds.

Downsides with the looping include

- it might call the progress callback much more seldom. Especially if
  the write callback is slow.

- rate limiting becomes less exact

- a single transfer might "starve out" other parallel transfers

- QUIC timers for other connections can't be maintained correctly

The long term fix should be to remove the loop and optimize coming back
to avoid the transfer speed penalty.

This fix lower the max loop count to reduce the starvation problem, and
avoids the loop completely for when rate-limiting is in progress.

Ref: #12488
Ref: https://curl.se/mail/lib-2023-12/0012.html
Closes #12504

19 months agolib: eliminate `conn->cselect_bits`
Stefan Eissing [Wed, 13 Dec 2023 10:25:20 +0000 (11:25 +0100)] 
lib: eliminate `conn->cselect_bits`

- use `data->state.dselect_bits` everywhere instead
- remove `bool *comeback` parameter as non-zero
  `data->state.dselect_bits` will indicate that IO is
  incomplete.

Closes #12512

19 months agoconnect: refactor `Curl_timeleft()`
Stefan Eissing [Thu, 14 Dec 2023 11:59:19 +0000 (12:59 +0100)] 
connect: refactor `Curl_timeleft()`

- less local vars, "better" readability
- added documentation

Closes #12518

19 months agocookie: avoid fopen with empty file name
Dmitry Karpov [Wed, 13 Dec 2023 22:32:53 +0000 (14:32 -0800)] 
cookie: avoid fopen with empty file name

Closes #12514

19 months agotests/server: delete workaround for old-mingw
Viktor Szakats [Tue, 12 Dec 2023 20:38:08 +0000 (20:38 +0000)] 
tests/server: delete workaround for old-mingw

mingw-w64 1.0 comes with w32api v3.12, thus doesn't need this.

Follow-up to 38029101e2d78ba125732b3bab6ec267b80a0e72 #11625

Reviewed-by: Jay Satiro
Closes #12510

19 months agocmake: delete obsolete TODOs more [ci skip]
Viktor Szakats [Tue, 12 Dec 2023 16:37:28 +0000 (16:37 +0000)] 
cmake: delete obsolete TODOs more [ci skip]

- manual completed: 898b012a9bf388590c4be7f526815b5ab74feca1 #1288
- soname completed: 5de6848f104d7cb0017080e31216265ac19d0dde #10023
- bunch of others that are completed
- `NTLM_WB_ENABLED` is implemented in a basic form, and now also
  scheduled for removal, so a TODO at this point isn't useful.

And this 'to-check' item:

Q: "The cmake build selected to run gcc with -fPIC on my box while the
   plain configure script did not."

A: With CMake, since 2ebc74c36a19a1700af394c16855ce144d9878e3 #11546
   and fc9bfb14520712672b4784e8b48256fb29204011 #11627, we explicitly
   enable PIC for libcurl shared lib. Or when building libcurl for
   shared and static lib in a single pass. We do this by default for
   Windows or when enabled by the user via `SHARE_LIB_OBJECT`.
   Otherwise we don't touch this setting. Meaning the default set by
   CMake (if any) or the toolchain is used. On Debian Bookworm, this
   means that PIC is disabled for static libs by default. Some platforms
   (like macOS), has PIC enabled by default.
   autotools supports the double-pass mode only, and in that case
   CMake seems to match PIC behaviour now (as tested on Linux with gcc.)

Follow-up to 5d5dfdbd1a6c40bd75e982b66f49e1fa3a7eeae7 #12500

Reviewed-by: Jay Satiro
Closes #12509

20 months agoCLIENT-WRITERS: design and use documentation
Stefan Eissing [Tue, 12 Dec 2023 11:36:07 +0000 (12:36 +0100)] 
CLIENT-WRITERS: design and use documentation

Closes #12507

20 months agocmake: delete obsolete TODO items [ci skip]
Viktor Szakats [Sun, 10 Dec 2023 03:33:17 +0000 (03:33 +0000)] 
cmake: delete obsolete TODO items [ci skip]

There is always room for improvement, but CMake is up to par now with
autotools, so there is no longer a good reason to keep around these
inline TODO items.

Answering one of questions:

Q: "The gcc command line use neither -g nor any -O options. As a
   developer, I also treasure our configure scripts's --enable-debug
   option that sets a long range of "picky" compiler options."

A: CMake offers the `CMAKE_BUILD_TYPE` variable to control debug info
   and optimization level. E.g.:
   - `Release`    = `-O3` + no debug info
   - `MinSizeRel` = `-Os` + no debug info
   - `Debug`      = `-O0` + debug info

   https://stackoverflow.com/questions/48754619/what-are-cmake-build-type-debug-release-relwithdebinfo-and-minsizerel/59314670#59314670
   https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#default-and-custom-configurations

   For picky warnings we have the `PICKY_COMPILER` options, enabled by
   default.

Closes #12500

20 months agoCONNECTION-FILTERS: update documentation
Stefan Eissing [Mon, 11 Dec 2023 10:52:26 +0000 (11:52 +0100)] 
CONNECTION-FILTERS: update documentation

Closes #12497

20 months agolib: reduce use of strncpy
Daniel Stenberg [Mon, 11 Dec 2023 15:15:57 +0000 (16:15 +0100)] 
lib: reduce use of strncpy

- bearssl: select cipher without buffer copies
- http_aws_sigv4: avoid strncpy, require exact timestamp length
- http_aws_sigv4: use memcpy isntead of strncpy
- openssl: avoid strncpy calls
- schannel: check for 1.3 algos without buffer copies
- strerror: avoid strncpy calls
- telnet: avoid strncpy, return error on too long inputs
- vtls: avoid strncpy in multissl_version()

Closes #12499

20 months agoCI/distcheck: run full tests
Daniel Stenberg [Mon, 11 Dec 2023 17:57:48 +0000 (18:57 +0100)] 
CI/distcheck: run full tests

To be able to detect missing files better, this now runs the full CI
test suite. If done before, it would have detected #12462 before
release.

Closes #12503

20 months agodocs: clean up Protocols: for cmdline options
Daniel Stenberg [Mon, 11 Dec 2023 07:52:19 +0000 (08:52 +0100)] 
docs: clean up Protocols: for cmdline options

... and some other minor polish.

Closes #12496

20 months agocmdline/gen: fix the sorting of the man page options
Daniel Stenberg [Sat, 9 Dec 2023 23:05:04 +0000 (00:05 +0100)] 
cmdline/gen: fix the sorting of the man page options

They were previously sorted based on the file names, which use a .d
extension, making "data" get placed after "data-binary" etc. Making the
sort ignore the extention fixes the ordering.

Reported-by: Boris Verkhovskiy
Bug: https://curl.se/mail/archive-2023-12/0014.html
Closes #12494

20 months agodoh: remove unused local variable
Daniel Gustafsson [Fri, 8 Dec 2023 20:12:06 +0000 (21:12 +0100)] 
doh: remove unused local variable

The nurl variable is no longer used during probing following
a refactoring, so remove.

Closes #12491

20 months agobuild: fix Windows ADDRESS_FAMILY detection
Jay Satiro [Fri, 1 Dec 2023 23:06:12 +0000 (18:06 -0500)] 
build: fix Windows ADDRESS_FAMILY detection

- Include winsock2.h for Windows ADDRESS_FAMILY detection.

Prior to this change cmake detection didn't work because it included
ws2def.h by itself, which is missing needed types from winsock2.h.

Prior to this change autotools detection didn't work because it did not
include any Windows header.

In both cases libcurl would fall back on unsigned short as the address
family type, which is the same as ADDRESS_FAMILY.

Co-authored-by: Viktor Szakats
Closes https://github.com/curl/curl/pull/12441

20 months agolib: rename Curl_strndup to Curl_memdup0 to avoid misunderstanding
Daniel Stenberg [Fri, 8 Dec 2023 13:27:29 +0000 (14:27 +0100)] 
lib: rename Curl_strndup to Curl_memdup0 to avoid misunderstanding

Since the copy does not stop at a null byte, let's not call it anything
that makes you think it works like the common strndup() function.

Based on feedback from Jay Satiro, Stefan Eissing and Patrick Monnerat

Closes #12490

20 months agoconvsrctest.pl: removed: not used, not shipped in tarballs
Daniel Stenberg [Fri, 8 Dec 2023 09:28:46 +0000 (10:28 +0100)] 
convsrctest.pl: removed: not used, not shipped in tarballs

20 months agotests: rename tests scripts to the test number
Daniel Stenberg [Fri, 8 Dec 2023 08:34:05 +0000 (09:34 +0100)] 
tests: rename tests scripts to the test number

It is hard to name the scripts sensibly. Lots of them are similarly
named and the name did not tell which test that used them.

The new approach is rather to name them based on the test number that
runs them. Also helps us see which scripts are for individual tests
rather than for general test infra.

 - badsymbols.pl -> test1167.pl
 - check-deprecated.pl -> test1222.pl
 - check-translatable-options.pl -> test1544.pl
 - disable-scan.pl -> test1165.pl
 - error-codes.pl -> test1175.pl
 - errorcodes.pl -> test1477.pl
 - extern-scan.pl -> test1135.pl
 - manpage-scan.pl -> test1139.pl
 - manpage-syntax.pl -> test1173.pl
 - markdown-uppercase.pl -> test1275.pl
 - mem-include-scan.pl -> test1132.pl
 - nroff-scan.pl -> test1140.pl
 - option-check.pl -> test1276.pl
 - options-scan.pl -> test971.pl
 - symbol-scan.pl -> test1119.pl
 - version-scan.pl -> test1177.pl

Closes #12487

20 months agosendf: fix compiler warning with CURL_DISABLE_HEADERS_API
MAntoniak [Fri, 8 Dec 2023 00:07:38 +0000 (01:07 +0100)] 
sendf: fix compiler warning with CURL_DISABLE_HEADERS_API

fix MSVC warning C4189: 'htype': local variable is initialized but not
referenced - when CURL_DISABLE_HEADERS_API is defined.

Closes #12485

20 months agotidy-up: whitespace
Viktor Szakats [Thu, 7 Dec 2023 19:06:02 +0000 (19:06 +0000)] 
tidy-up: whitespace

Closes #12484

20 months agotest_02_download: fix paramters to test_02_27
Stefan Eissing [Wed, 6 Dec 2023 11:08:20 +0000 (12:08 +0100)] 
test_02_download: fix paramters to test_02_27

- it is a special client that only ever uses http/2

Closes #12467

20 months agovtls: remove the Curl_cft_ssl_proxy object if CURL_DISABLE_PROXY
MAntoniak [Tue, 5 Dec 2023 22:49:12 +0000 (23:49 +0100)] 
vtls: remove the Curl_cft_ssl_proxy object if CURL_DISABLE_PROXY

Closes #12459

20 months agolib: strndup/memdup instead of malloc, memcpy and null-terminate
Daniel Stenberg [Tue, 5 Dec 2023 14:55:35 +0000 (15:55 +0100)] 
lib: strndup/memdup instead of malloc, memcpy and null-terminate

 - bufref: use strndup
 - cookie: use strndup
 - formdata: use strndup
 - ftp: use strndup
 - gtls: use aprintf instead of malloc + strcpy * 2
 - http: use strndup
 - mbedtls: use strndup
 - md4: use memdup
 - ntlm: use memdup
 - ntlm_sspi: use strndup
 - pingpong: use memdup
 - rtsp: use strndup instead of malloc, memcpy and null-terminate
 - sectransp: use strndup
 - socks_gssapi.c: use memdup
 - vtls: use dynbuf instead of malloc, snprintf and memcpy
 - vtls: use strdup instead of malloc + memcpy
 - wolfssh: use strndup

Closes #12453

20 months agostrdup: remove the memchr check from Curl_strndup
Daniel Stenberg [Tue, 5 Dec 2023 14:55:35 +0000 (15:55 +0100)] 
strdup: remove the memchr check from Curl_strndup

It makes it possible to clone a binary chunk of data.

Closes #12453

20 months agoftp: handle the PORT parsing without allocation
Daniel Stenberg [Tue, 5 Dec 2023 11:15:01 +0000 (12:15 +0100)] 
ftp: handle the PORT parsing without allocation

Also reduces amount of *cpy() calls.

Closes #12456

20 months agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 6 Dec 2023 22:23:06 +0000 (23:23 +0100)] 
RELEASE-NOTES: synced

Bumped to 8.5.1

20 months agourl: for disabled protocols, mention if found in redirect
Daniel Stenberg [Wed, 6 Dec 2023 13:13:17 +0000 (14:13 +0100)] 
url: for disabled protocols, mention if found in redirect

To help users better understand where the URL (and denied scheme) comes
from. Also removed "in libcurl" from the message, since the disabling
can be done by the application.

The error message now says "not supported" or "disabled" depending on
why it was denied:

 Protocol "hej" not supported
 Protocol "http" disabled

And in redirects:

 Protocol "hej" not supported (in redirect)
 Protocol "http" disabled (in redirect)

Reported-by: Mauricio Scheffer
Fixes #12465
Closes #12469

20 months agosectransp_ make TLSCipherNameForNumber() available in non-verbose config
Stefan Eissing [Wed, 6 Dec 2023 18:03:42 +0000 (19:03 +0100)] 
sectransp_ make TLSCipherNameForNumber() available in non-verbose config

Reported-by: Cajus Pollmeier
Closes #12476
Fixes #12474

20 months agolib: fix variable undeclared error caused by `infof` changes
YX Hao [Wed, 6 Dec 2023 14:42:00 +0000 (22:42 +0800)] 
lib: fix variable undeclared error caused by `infof` changes

`--disable-verbose` yields `CURL_DISABLE_VERBOSE_STRINGS` defined.
`infof` isn't `Curl_nop_stmt` anymore: dac293c.

Follow-up to dac293c

Closes #12470

20 months agotidy-up: fix yamllint whitespace issues in labeler.yml
Viktor Szakats [Wed, 6 Dec 2023 17:54:08 +0000 (17:54 +0000)] 
tidy-up: fix yamllint whitespace issues in labeler.yml

Follow-up to bda212911457c6fadfbba50be61afc4ca513fa56 #12466

Reviewed-by: Dan Fandrich
Closes #12475

20 months agotidy-up: fix yamllint whitespace issues
Viktor Szakats [Wed, 6 Dec 2023 10:05:20 +0000 (10:05 +0000)] 
tidy-up: fix yamllint whitespace issues

Closes #12466

20 months agocmake: fix typo
Chris Sauer [Wed, 6 Dec 2023 09:16:36 +0000 (01:16 -0800)] 
cmake: fix typo

Follow-up to aace27b
Closes #12464

20 months agodist: add tests/errorcodes.pl to the tarball
Daniel Stenberg [Wed, 6 Dec 2023 08:40:30 +0000 (09:40 +0100)] 
dist: add tests/errorcodes.pl to the tarball

Used by test 1477

Reported-by: Xi Ruoyao
Follow-up to 0ca3a4ec9a7
Fixes #12462
Closes #12463

20 months agogithub/labeler: update a missed key in the v5 upgrade
Dan Fandrich [Wed, 6 Dec 2023 08:58:59 +0000 (00:58 -0800)] 
github/labeler: update a missed key in the v5 upgrade

Follow-up to ce03fe3ba

20 months agoRELEASE-NOTES: synced curl-8_5_0
Daniel Stenberg [Wed, 6 Dec 2023 07:11:44 +0000 (08:11 +0100)] 
RELEASE-NOTES: synced

The curl 8.5.0 release.

20 months agogithub/labeler: switch from the beta to labeler v5 12458/head
Dan Fandrich [Tue, 5 Dec 2023 21:17:09 +0000 (13:17 -0800)] 
github/labeler: switch from the beta to labeler v5

Some keys were renamed and the dot option was made default.

Closes #12458

20 months agoDEPRECATE: remove NTLM_WB in June 2024
Daniel Stenberg [Tue, 5 Dec 2023 07:02:57 +0000 (08:02 +0100)] 
DEPRECATE: remove NTLM_WB in June 2024

Ref: https://curl.se/mail/lib-2023-12/0010.html

Closes #12451

20 months agorustls: implement connect_blocking
Jacob Hoffman-Andrews [Fri, 23 Jun 2023 23:58:54 +0000 (16:58 -0700)] 
rustls: implement connect_blocking

Closes #11647

20 months agoexamples/rtsp-options.c: add
Daniel Stenberg [Mon, 4 Dec 2023 16:14:56 +0000 (17:14 +0100)] 
examples/rtsp-options.c: add

Just a bare bones RTSP example using CURLOPT_RTSP_SESSION_ID and
CURLOPT_RTSP_REQUEST set to CURL_RTSPREQ_OPTIONS.

Closes #12452

20 months agongtcp2: ignore errors on unknown streams
Stefan Eissing [Mon, 4 Dec 2023 11:13:25 +0000 (12:13 +0100)] 
ngtcp2: ignore errors on unknown streams

- expecially in is_alive checks on connections, we might
  see incoming packets on streams already forgotten and closed,
  leading to errors reported by nghttp3. Ignore those.

Closes #12449

20 months agodocs: make all examples in all libcurl man pages compile
Daniel Stenberg [Mon, 4 Dec 2023 09:50:42 +0000 (10:50 +0100)] 
docs: make all examples in all libcurl man pages compile

Closes #12448

20 months agochecksrc.pl: support #line instructions
Daniel Stenberg [Mon, 4 Dec 2023 09:50:42 +0000 (10:50 +0100)] 
checksrc.pl: support #line instructions

makes it identify the correct source file and line

20 months agoGHA/man-examples: verify libcurl man page examples
Daniel Stenberg [Mon, 4 Dec 2023 09:50:42 +0000 (10:50 +0100)] 
GHA/man-examples: verify libcurl man page examples

20 months agoverify-examples.pl: verify that all man page examples compile clean
Daniel Stenberg [Mon, 4 Dec 2023 09:50:42 +0000 (10:50 +0100)] 
verify-examples.pl: verify that all man page examples compile clean

20 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 2 Dec 2023 22:21:21 +0000 (23:21 +0100)] 
RELEASE-NOTES: synced

20 months agohttp3: bump ngtcp2 and nghttp3 versions
Graham Campbell [Sat, 2 Dec 2023 18:17:35 +0000 (18:17 +0000)] 
http3: bump ngtcp2 and nghttp3 versions

nghttp3 v1.1.0
ngtcp2 v1.1.0

In docs and CI

Closes #12446

20 months agoCI/quiche: use `3.1.4+quic` consistently in CI workflows
Graham Campbell [Sat, 2 Dec 2023 18:24:19 +0000 (18:24 +0000)] 
CI/quiche: use `3.1.4+quic` consistently in CI workflows

Closes #12447

20 months agotest1545: disable deprecation warnings
Viktor Szakats [Sat, 2 Dec 2023 15:59:21 +0000 (15:59 +0000)] 
test1545: disable deprecation warnings

Fixes:
https://ci.appveyor.com/project/curlorg/curl/builds/48631551/job/bhx74e0i66yrp6pk#L1205

Same with details:
https://ci.appveyor.com/project/curlorg/curl/builds/48662893/job/ol8a78q9gmilb6wt#L1263
```
tests/libtest/lib1545.c:38:3: error: 'curl_formadd' is deprecated: since 7.56.0. Use curl_mime_init() [-Werror=deprecated-declarations]
   38 |   curl_formadd(&m_formpost, &lastptr, CURLFORM_COPYNAME, "file",
      |   ^~~~~~~~~~~~
[...]
```

Follow-up to 07a3cd83e0456ca17dfd8c3104af7cf45b7a1ff5 #12421

Fixes #12445
Closes #12444

20 months agoINSTALL: update list of ports and CPU archs
Daniel Stenberg [Sat, 2 Dec 2023 16:40:48 +0000 (17:40 +0100)] 
INSTALL: update list of ports and CPU archs

20 months agosymbols-in-versions: the CLOSEPOLICY options are deprecated
Daniel Stenberg [Sat, 2 Dec 2023 16:07:34 +0000 (17:07 +0100)] 
symbols-in-versions: the CLOSEPOLICY options are deprecated

The were used with the CURLOPT_CLOSEPOLICY option, which *never* worked.

20 months agobuild: fix builds that disable protocols but not digest auth
z2_ [Sat, 2 Dec 2023 00:09:29 +0000 (01:09 +0100)] 
build: fix builds that disable protocols but not digest auth

- Build base64 functions if digest auth is not disabled.

Prior to this change if some protocols were disabled but not digest auth
then a build error would occur due to missing base64 functions.

Fixes https://github.com/curl/curl/issues/12440
Closes https://github.com/curl/curl/pull/12442

20 months agoconnect: reduce number of transportation providers
MAntoniak [Fri, 1 Dec 2023 17:48:09 +0000 (18:48 +0100)] 
connect: reduce number of transportation providers

Use only the ones necessary - the ones that are built-in. Saves a few
bytes in the resulting code.

Closes #12438

20 months agovtls: consistently use typedef names for OpenSSL structs
David Benjamin [Fri, 1 Dec 2023 19:40:32 +0000 (14:40 -0500)] 
vtls: consistently use typedef names for OpenSSL structs

The foo_st names don't appear in OpenSSL public API documentation. The
FOO typedefs are more common. This header was already referencing
SSL_CTX via <openssl/ssl.h>. There is a comment about avoiding
<openssl/x509v3.h>, but OpenSSL actually declares all the typedefs in
<openssl/ossl_typ.h>, which is already included by <openssl/ssl.h> (and
every other OpenSSL header), so just use that. Though I've included it
just to be explicit.

(I'm also fairly sure including <openssl/ssl.h> already triggers the
Schannel conflicts anyway. The comment was probably just out of date.)

Closes #12439

20 months agolibcurl-security.3: fix typo
Lau [Fri, 1 Dec 2023 14:44:03 +0000 (15:44 +0100)] 
libcurl-security.3: fix typo

Fixed minimal typo.

Closes #12437

20 months agongtcp2: fix races in stream handling
Stefan Eissing [Fri, 1 Dec 2023 13:00:15 +0000 (14:00 +0100)] 
ngtcp2: fix races in stream handling

- fix cases where ngtcp2 invokes callbacks on streams that
  nghttp3 has already forgotten. Ignore the NGHTTP3_ERR_STREAM_NOT_FOUND
  in these cases as it is normal behaviour.

Closes #12435

20 months agotool_writeout_json: fix JSON encoding of non-ascii bytes
Emanuele Torre [Fri, 1 Dec 2023 00:51:47 +0000 (01:51 +0100)] 
tool_writeout_json: fix JSON encoding of non-ascii bytes

char variables if unspecified can be either signed or unsigned depending
on the platform according to the C standard; in most platforms, they are
signed.

This meant that the  *i<32  waas always true for bytes with the top bit
set. So they were always getting encoded as \uXXXX, and then since they
were also signed negative, they were getting extended with 1s causing
'\xe2' to be expanded to \uffffffe2, for example:

  $ curl --variable 'v=“' --expand-write-out '{{v:json}}\n' file:///dev/null
  \uffffffe2\uffffff80\uffffff9c

I fixed this bug by making the code use explicitly unsigned char*
variables instead of char* variables.

Test 268 verifies

Reported-by: iconoclasthero
Closes #12434

20 months agocf-socket: TCP trace output local address used in connect
Stefan Eissing [Wed, 29 Nov 2023 14:17:30 +0000 (15:17 +0100)] 
cf-socket: TCP trace output local address used in connect

Closes #12427

20 months agoCURLINFO_PRETRANSFER_TIME_T.3: fix time explanation
Jay Satiro [Thu, 30 Nov 2023 20:18:57 +0000 (15:18 -0500)] 
CURLINFO_PRETRANSFER_TIME_T.3: fix time explanation

- Change CURLINFO_PRETRANSFER_TIME_T explanation to say that it
  includes protocol-specific instructions that trigger a transfer.

Prior to this change it explicitly said that it did not include those
instructions in the time, but that is incorrect.

The change is a copy of the fixed explanation already in
CURLINFO_PRETRANSFER_TIME, fixed by ec8dcd7b.

Reported-by: eeverettrbx@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/12431
Closes https://github.com/curl/curl/pull/12432

20 months agomulti: during ratelimit multi_getsock should return no sockets
Daniel Stenberg [Thu, 30 Nov 2023 09:32:16 +0000 (10:32 +0100)] 
multi: during ratelimit multi_getsock should return no sockets

... as there is nothing to wait for then, it just waits. Otherwise, this
causes much more CPU work and updates than necessary during ratelimit
periods.

Ref: https://curl.se/mail/lib-2023-11/0056.html
Closes #12430

20 months agotransfer: abort pause send when connection is marked for closing
Dmitry Karpov [Wed, 29 Nov 2023 20:49:06 +0000 (12:49 -0800)] 
transfer: abort pause send when connection is marked for closing

This handles cases of some bi-directional "upgrade" scenarios
(i.e. WebSockets) where sending is paused until some "upgrade" handshake
is completed, but server rejects the handshake and closes the
connection.

Closes #12428

20 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 28 Nov 2023 22:04:09 +0000 (23:04 +0100)] 
RELEASE-NOTES: synced

20 months agoopenssl: when a session-ID is reused, skip OCSP stapling
Daniel Stenberg [Mon, 27 Nov 2023 22:50:45 +0000 (23:50 +0100)] 
openssl: when a session-ID is reused, skip OCSP stapling

Fixes #12399
Reported-by: Alexey Larikov
Closes #12418

20 months agotest1545: test doing curl_formadd twice with missing file
Daniel Stenberg [Tue, 28 Nov 2023 10:01:54 +0000 (11:01 +0100)] 
test1545: test doing curl_formadd twice with missing file

Reproduces #12410
Verifies the fix
Closes #12421

20 months agoCurl_http_body: cleanup properly when Curl_getformdata errors
Daniel Stenberg [Tue, 28 Nov 2023 07:49:49 +0000 (15:49 +0800)] 
Curl_http_body: cleanup properly when Curl_getformdata errors

Reported-by: yushicheng7788 on github
Based-on-work-by: yushicheng7788 on github
Fixes #12410
Closes #12421

20 months agotest1477: verify that libcurl-errors.3 and public headers are synced
Daniel Stenberg [Tue, 28 Nov 2023 16:07:44 +0000 (17:07 +0100)] 
test1477: verify that libcurl-errors.3 and public headers are synced

The script errorcodes.pl extracts all error codes from all headers and
checks that they are all documented, then checks that all documented
error codes are also specified in a header file.

Closes #12424

20 months agolibcurl-errors.3: sync with current public headers
Daniel Stenberg [Tue, 28 Nov 2023 16:07:27 +0000 (17:07 +0100)] 
libcurl-errors.3: sync with current public headers

Closes #12424

20 months agotest459: fix for parallel runs
Stefan Eissing [Tue, 28 Nov 2023 11:53:46 +0000 (12:53 +0100)] 
test459: fix for parallel runs

- change warniing message to work better with varying filename
  length.
- adapt test output check to new formatting

Follow-up to 97ccc4479f77ba3191c6
Closes #12423

20 months agotool_cb_prg: make the carriage return fit for wide progress bars
Daniel Stenberg [Mon, 27 Nov 2023 14:31:00 +0000 (15:31 +0100)] 
tool_cb_prg: make the carriage return fit for wide progress bars

When the progress bar was made max width (256 columns), the fly()
function attempted to generate its output buffer too long so that the
trailing carriage return would not fit and then the output would show
wrongly. The fly function is called when the expected total transfer is
unknown, which could be one or more progress calls before the actual
progress meter get shown when the expected transfer size is provided.

This new take also replaces the msnprintf() call with a much simpler
memset() for speed.

Reported-by: Tim Hill
Fixes #12407
Closes #12415

20 months agotool_parsecfg: make warning output propose double-quoting
Daniel Stenberg [Mon, 27 Nov 2023 10:36:43 +0000 (11:36 +0100)] 
tool_parsecfg: make warning output propose double-quoting

When the config file parser detects a word that *probably* should be
quoted, mention double-quotes as a possible remedy.

Test 459 verifies.

Proposed-by: Jiehong on github
Fixes #12409
Closes #12412

20 months agocurl.rc: switch out the copyright symbol for plain ASCII
Jay Satiro [Sat, 25 Nov 2023 19:21:20 +0000 (14:21 -0500)] 
curl.rc: switch out the copyright symbol for plain ASCII

.. like we already do for libcurl.rc.

libcurl.rc copyright symbol used to cause a "non-ascii 8-bit codepoint"
warning so it was switched to ascii.

Ref: https://github.com/curl/curl/commit/1ca62bb5#commitcomment-133474972

Suggested-by: Robert Southee
Closes https://github.com/curl/curl/pull/12403

20 months agoconncache: use the closure handle when disconnecting surplus connections
Daniel Stenberg [Sat, 25 Nov 2023 23:10:17 +0000 (00:10 +0100)] 
conncache: use the closure handle when disconnecting surplus connections

Use the closure handle for disconnecting connection cache entries so
that anything that happens during the disconnect is not stored and
associated with the 'data' handle which already just finished a transfer
and it is important that details from the unrelated disconnect does not
taint meta-data in the data handle.

Like storing the response code.

This also adjust test 1506. Unfortunately it also removes a key part of
the test that verifies that a connection is closed since when this
output vanishes (because the closure handle is used), we don't know
exactly that the connection actually gets closed in this test...

Reported-by: ohyeaah on github
Fixes #12367
Closes #12405

20 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 24 Nov 2023 20:01:54 +0000 (21:01 +0100)] 
RELEASE-NOTES: synced

20 months agoquic: make eyeballers connect retries stop at weird replies
Stefan Eissing [Fri, 24 Nov 2023 12:45:55 +0000 (13:45 +0100)] 
quic: make eyeballers connect retries stop at weird replies

- when a connect immediately goes into DRAINING state, do
  not attempt retries in the QUIC connection filter. Instead,
  return CURLE_WEIRD_SERVER_REPLY
- When eyeballing, interpret CURLE_WEIRD_SERVER_REPLY as an
  inconclusive answer. When all addresses have been attempted,
  rewind the address list once on an inconclusive answer.
- refs #11832 where connects were retried indefinitely until
  the overall timeout fired

Closes #12400

20 months agoCI: verify libcurl function SYNPOSIS sections
Daniel Stenberg [Fri, 24 Nov 2023 19:29:52 +0000 (20:29 +0100)] 
CI: verify libcurl function SYNPOSIS sections

With the .github/scripits/verify-synopsis.pl script

Closes #12402

20 months agodocs/libcurl: SYNSOPSIS cleanup
Daniel Stenberg [Fri, 24 Nov 2023 16:52:15 +0000 (17:52 +0100)] 
docs/libcurl: SYNSOPSIS cleanup

- use the correct include file
- make sure they are declared as in the header file
- fix minor nroff syntax mistakes (missing .fi)

These are verified by verify-synopsis.pl, which extracts the SYNPOSIS
code and runs it through gcc.

Closes #12402

20 months agosendf: fix comment typo
Daniel Stenberg [Fri, 24 Nov 2023 13:36:25 +0000 (14:36 +0100)] 
sendf: fix comment typo

20 months agofopen: allocate the dir after fopen
Daniel Stenberg [Fri, 24 Nov 2023 08:46:32 +0000 (09:46 +0100)] 
fopen: allocate the dir after fopen

Move the allocation of the directory name down to after the fopen() call
to allow that shortcut code path to avoid a superfluous malloc+free
cycle.

Follow-up to 73b65e94f35311

Closes #12398

20 months agotransfer: cleanup done+excess handling
Stefan Eissing [Tue, 21 Nov 2023 10:24:18 +0000 (11:24 +0100)] 
transfer: cleanup done+excess handling

- add `SingleRequest->download_done` as indicator that
  all download bytes have been received
- remove `stop_reading` bool from readwrite functions
- move excess body handling into client download writer

Closes #12371

20 months agofopen: create new file using old file's mode
Daniel Stenberg [Thu, 23 Nov 2023 14:52:57 +0000 (15:52 +0100)] 
fopen: create new file using old file's mode

Because the function renames the temp file to the target name as a last
step, if the file was previously owned by a different user, not ORing
the old mode could otherwise end up creating a file that was no longer
readable by the original owner after save.

Reported-by: Loïc Yhuel
Fixes #12299
Closes #12395

20 months agotest1476: require proxy
Daniel Stenberg [Thu, 23 Nov 2023 14:38:21 +0000 (15:38 +0100)] 
test1476: require proxy

Follow-up from 323df4261c3542

Closes #12394

20 months agofopen: create short(er) temporary file name
Daniel Stenberg [Thu, 23 Nov 2023 07:23:17 +0000 (08:23 +0100)] 
fopen: create short(er) temporary file name

Only using random letters in the name plus a ".tmp" extension. Not by
appending characters to the final file name.

Reported-by: Maksymilian Arciemowicz
Closes #12388

20 months agotests: git ignore generated second-hsts.txt file
Stefan Eissing [Thu, 23 Nov 2023 12:06:21 +0000 (13:06 +0100)] 
tests: git ignore generated second-hsts.txt file

File is generated in test lib1900

Follow-up to 7cb03229d9e9c5

Closes #12393