]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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.

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

Closes #12497

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

Closes #12484

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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.

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

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

2 years 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

2 years 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

2 years 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

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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years agoopenssl: enable `infof_certstack` for 1.1 and LibreSSL 3.6
Viktor Szakats [Thu, 23 Nov 2023 01:14:37 +0000 (01:14 +0000)] 
openssl: enable `infof_certstack` for 1.1 and LibreSSL 3.6

Lower the barrier to enable `infof_certstack()` from OpenSSL 3 to
OpenSSL 1.1.x, and LibreSSL 3.6 or upper.

With the caveat, that "group name" and "type name" are missing from
the log output with these TLS backends.

Follow-up to b6e6d4ff8f253c8b8055bab9d4d6a10f9be109f3 #12030

Reviewed-by: Daniel Stenberg
Closes #12385

2 years agourldata: fix typo in comment
Daniel Stenberg [Thu, 23 Nov 2023 11:41:13 +0000 (12:41 +0100)] 
urldata: fix typo in comment

2 years agoCI: codespell
Daniel Stenberg [Thu, 23 Nov 2023 11:08:33 +0000 (12:08 +0100)] 
CI: codespell

The list of words to ignore is in the file
.github/scripts/codespell-ignore.txt

Closes #12390

2 years agolib: fix comment typos
Daniel Stenberg [Thu, 23 Nov 2023 08:51:14 +0000 (09:51 +0100)] 
lib: fix comment typos

Five separate ones, found by codespell

Closes #12390

2 years agotest1476: verify cookie PSL mixed case
Daniel Stenberg [Thu, 23 Nov 2023 07:15:47 +0000 (08:15 +0100)] 
test1476: verify cookie PSL mixed case

2 years agocookie: lowercase the domain names before PSL checks
Daniel Stenberg [Thu, 23 Nov 2023 07:15:47 +0000 (08:15 +0100)] 
cookie: lowercase the domain names before PSL checks

Reported-by: Harry Sintonen
Closes #12387

2 years agoopenssl: fix building with v3 `no-deprecated` + add CI test
Viktor Szakats [Wed, 22 Nov 2023 15:08:09 +0000 (15:08 +0000)] 
openssl: fix building with v3 `no-deprecated` + add CI test

- build quictls with `no-deprecated` in CI to have test coverage for
  this OpenSSL 3 configuration.

- don't call `OpenSSL_add_all_algorithms()`, `OpenSSL_add_all_digests()`.
  The caller code is meant for OpenSSL 3, while these two functions were
  only necessary before OpenSSL 1.1.0. They are missing from OpenSSL 3
  if built with option `no-deprecated`, causing build errors:
  ```
  vtls/openssl.c:4097:3: error: call to undeclared function 'OpenSSL_add_all_algorithms'; ISO C99 and later do not   support implicit function declarations [-Wimplicit-function-declaration]
  vtls/openssl.c:4098:3: error: call to undeclared function 'OpenSSL_add_all_digests'; ISO C99 and later do not   support implicit function declarations [-Wimplicit-function-declaration]
  ```
  Ref: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/48587418?fullLog=true#L7667

  Regression from b6e6d4ff8f253c8b8055bab9d4d6a10f9be109f3 #12030
  Bug: https://github.com/curl/curl/issues/12380#issuecomment-1822944669
Reviewed-by: Alex Bozarth
- vquic/curl_ngtcp2: fix using `SSL_get_peer_certificate` with
  `no-deprecated` quictls 3 builds.
  Do it by moving an existing solution for this from `vtls/openssl.c`
  to `vtls/openssl.h` and adjusting caller code.
  ```
  vquic/curl_ngtcp2.c:1950:19: error: implicit declaration of function 'SSL_get_peer_certificate'; did you mean   'SSL_get1_peer_certificate'? [-Wimplicit-function-declaration]
  ```
  Ref: https://github.com/curl/curl/actions/runs/6960723097/job/18940818625#step:24:1178

- curl_ntlm_core: fix `-Wunused-parameter`, `-Wunused-variable` and
  `-Wunused-function` when trying to build curl with NTLM enabled but
  without the necessary TLS backend (with DES) support.

Closes #12384

2 years agocurl.h: delete Symbian OS references
Viktor Szakats [Wed, 22 Nov 2023 01:08:33 +0000 (01:08 +0000)] 
curl.h: delete Symbian OS references

curl deprecated Symbian OS in 3d64031fa7a80ac4ae3fd09a5939196268b92f81
via #5989. Delete references to it from public headers, because there
is no fresh release to use those headers with.

Reviewed-by: Dan Fandrich
Reviewed-by: Jay Satiro
Closes #12378

2 years agowindows: use built-in `_WIN32` macro to detect Windows
Viktor Szakats [Tue, 21 Nov 2023 16:54:49 +0000 (16:54 +0000)] 
windows: use built-in `_WIN32` macro to detect Windows

Windows compilers define `_WIN32` automatically. Windows SDK headers
or build env defines `WIN32`, or we have to take care of it. The
agreement seems to be that `_WIN32` is the preferred practice here.
Make the source code rely on that to detect we're building for Windows.

Public `curl.h` was using `WIN32`, `__WIN32__` and `CURL_WIN32` for
Windows detection, next to the official `_WIN32`. After this patch it
only uses `_WIN32` for this. Also, make it stop defining `CURL_WIN32`.

There is a slight chance these break compatibility with Windows
compilers that fail to define `_WIN32`. I'm not aware of any obsolete
or modern compiler affected, but in case there is one, one possible
solution is to define this macro manually.

grepping for `WIN32` remains useful to discover Windows-specific code.

Also:

- extend `checksrc` to ensure we're not using `WIN32` anymore.

- apply minor formatting here and there.

- delete unnecessary checks for `!MSDOS` when `_WIN32` is present.

Co-authored-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Closes #12376