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

22 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

22 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

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

23 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

23 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

23 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

23 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

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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

23 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

23 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

23 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

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

23 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

23 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

23 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

23 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

23 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

23 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

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

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

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

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

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

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

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

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

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

23 months agourl: ConnectionExists revisited
Stefan Eissing [Tue, 21 Nov 2023 14:46:41 +0000 (15:46 +0100)] 
url: ConnectionExists revisited

- have common pattern of `if not match, continue`
- revert pages long if()s to return early
- move dead connection check to later since it may
  be relatively expensive
- check multiuse also when NOT building with NGHTTP2
- for MULTIUSE bundles, verify that the inspected
  connection indeed supports multiplexing when in use
  (bundles may contain a mix of connection, afaict)

Closes #12373

23 months agoCURLMOPT_MAX_CONCURRENT_STREAMS: make sure the set value is within range
Daniel Stenberg [Wed, 22 Nov 2023 09:54:40 +0000 (10:54 +0100)] 
CURLMOPT_MAX_CONCURRENT_STREAMS: make sure the set value is within range

... or use the default value.

Also clarify the documentation language somewhat.

Closes #12382

23 months agourldata: make maxconnects a 32 bit value
Daniel Stenberg [Tue, 21 Nov 2023 17:18:27 +0000 (18:18 +0100)] 
urldata: make maxconnects a 32 bit value

"2^32 idle connections ought to be enough for anybody"

Closes #12375

23 months agoFEATURES: update the URL phrasing
Daniel Stenberg [Wed, 22 Nov 2023 10:34:13 +0000 (11:34 +0100)] 
FEATURES: update the URL phrasing

The URL is length limited since a while back so "no limit" simply is not
true anymore. Mention the URL RFC standard used instead.

Closes #12383

23 months agowolfssh: remove redundant static prototypes
Daniel Stenberg [Wed, 22 Nov 2023 07:57:19 +0000 (08:57 +0100)] 
wolfssh: remove redundant static prototypes

vssh/wolfssh.c:346:18: error: redundant redeclaration of ‘wscp_recv’ [-Werror=redundant-decls]

Closes #12381

23 months agosetopt: remove superfluous use of ternary expressions
Daniel Stenberg [Tue, 21 Nov 2023 16:55:31 +0000 (17:55 +0100)] 
setopt: remove superfluous use of ternary expressions

Closes #12374

23 months agomime: store "form escape" as a single bit
Daniel Stenberg [Tue, 21 Nov 2023 16:44:05 +0000 (17:44 +0100)] 
mime: store "form escape" as a single bit

Closes #12374

23 months agosetopt: check CURLOPT_TFTP_BLKSIZE range on set
Daniel Stenberg [Tue, 21 Nov 2023 16:34:30 +0000 (17:34 +0100)] 
setopt: check CURLOPT_TFTP_BLKSIZE range on set

... instead of later when the transfer is about to happen.

Closes #12374

23 months agobuild: add more picky warnings and fix them
Viktor Szakats [Wed, 15 Nov 2023 14:43:36 +0000 (14:43 +0000)] 
build: add more picky warnings and fix them

Enable more picky compiler warnings. I've found these options in the
nghttp3 project when implementing the CMake quick picky warning
functionality for it [1].

`-Wunused-macros` was too noisy to keep around, but fixed a few issues
it revealed while testing.

- autotools: reflect the more precisely-versioned clang warnings.
  Follow-up to 033f8e2a08eb1d3102f08c4d8c8e85470f8b460e #12324
- autotools: sync between clang and gcc the way we set `no-multichar`.
- autotools: avoid setting `-Wstrict-aliasing=3` twice.
- autotools: disable `-Wmissing-noreturn` for MSYS gcc targets [2].
  It triggers in libtool-generated stub code.

- lib/timeval: delete a redundant `!MSDOS` guard from a `WIN32` branch.

- lib/curl_setup.h: delete duplicate declaration for `fileno`.
  Added in initial commit ae1912cb0d494b48d514d937826c9fe83ec96c4d
  (1999-12-29). This suggests this may not be needed anymore, but if
  it does, we may restore this for those specific (non-Windows) systems.
- lib: delete unused macro `FTP_BUFFER_ALLOCSIZE` since
  c1d6fe2aaa5a26e49a69a4f2495b3cc7a24d9394.
- lib: delete unused macro `isxdigit_ascii` since
  f65f750742068f579f4ee6d8539ed9d5f0afcb85.
- lib/mqtt: delete unused macro `MQTT_HEADER_LEN`.
- lib/multi: delete unused macro `SH_READ`/`SH_WRITE`.
- lib/hostip: add `noreturn` function attribute via new `CURL_NORETURN`
  macro.
- lib/mprintf: delete duplicate declaration for `Curl_dyn_vprintf`.
- lib/rand: fix `-Wunreachable-code` and related fallouts [3].
- lib/setopt: fix `-Wunreachable-code-break`.
- lib/system_win32 and lib/timeval: fix double declarations for
  `Curl_freq` and `Curl_isVistaOrGreater` in CMake UNITY mode [4].
- lib/warnless: fix double declarations in CMake UNITY mode [5].
  This was due to force-disabling the header guard of `warnless.h` to
  to reapply it to source code coming after `warnless.c` in UNITY
  builds. This reapplied declarations too, causing the warnings.
  Solved by adding a header guard for the lines that actually need
  to be reapplied.
- lib/vauth/digest: fix `-Wunreachable-code-break` [6].
- lib/vssh/libssh2: fix `-Wunreachable-code-break` and delete redundant
  block.
- lib/vtls/sectransp: fix `-Wunreachable-code-break` [7].
- lib/vtls/sectransp: suppress `-Wunreachable-code`.
  Detected in `else` branches of dynamic feature checks, with results
  known at compile-time, e.g.
  ```c
  if(SecCertificateCopySubjectSummary)  /* -> true */
  ```
  Likely fixable as a separate micro-project, but given SecureTransport
  is deprecated anyway, let's just silence these locally.
- src/tool_help: delete duplicate declaration for `helptext`.
- src/tool_xattr: fix `-Wunreachable-code`.
- tests: delete duplicate declaration for `unitfail` [8].
- tests: delete duplicate declaration for `strncasecompare`.
- tests/libtest: delete duplicate declaration for `gethostname`.
  Originally added in 687df5c8c39c370a59999b9afc0917d808d978b7
  (2010-08-02).
  Got complicated later: c49e9683b85ba9d12cbb6eebc4ab2c8dba68fbdc
  If there are still systems around with warnings, we may restore the
  prototype, but limited for those systems.
- tests/lib2305: delete duplicate declaration for
  `libtest_debug_config`.
- tests/h2-download: fix `-Wunreachable-code-break`.

[1] https://github.com/ngtcp2/nghttp3/blob/a70edb08e954d690e8fb2c1df999b5a056f8bf9f/cmake/PickyWarningsC.cmake
[2] https://ci.appveyor.com/project/curlorg/curl/builds/48553586/job/3qkgjauiqla5fj45?fullLog=true#L1675
[3] https://github.com/curl/curl/actions/runs/6880886309/job/18716044703?pr=12331#step:7:72
    https://github.com/curl/curl/actions/runs/6883016087/job/18722707368?pr=12331#step:7:109
[4] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L204
[5] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrriklpf1ut#L218
[6] https://github.com/curl/curl/actions/runs/6880886309/job/18716042927?pr=12331#step:7:290
[7] https://github.com/curl/curl/actions/runs/6891484996/job/18746659406?pr=12331#step:9:1193
[8] https://github.com/curl/curl/actions/runs/6882803986/job/18722082562?pr=12331#step:33:1870

Closes #12331

23 months agotransfer: avoid unreachable expression
Daniel Stenberg [Tue, 21 Nov 2023 07:13:08 +0000 (08:13 +0100)] 
transfer: avoid unreachable expression

If curl_off_t and size_t have the same size (which is common on modern
64 bit systems), a condition cannot occur which Coverity pointed
out. Avoid the warning by having the code conditionally only used if
curl_off_t actually is larger.

Follow-up to 1cd2f0072fa482e25baa2

Closes #12370

23 months agotransfer: readwrite improvements
Stefan Eissing [Mon, 6 Nov 2023 16:06:06 +0000 (17:06 +0100)] 
transfer: readwrite improvements

- changed header/chunk/handler->readwrite prototypes to accept `buf`,
  `blen` and a `pconsumed` pointer. They now get the buffer to work on
  and report back how many bytes they consumed
- eliminated `k->str` in SingleRequest
- improved excess data handling to properly calculate with any body data
  left in the headerb buffer
- eliminated `k->badheader` enum to only be a bool

Closes #12283

23 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 21 Nov 2023 07:01:42 +0000 (08:01 +0100)] 
RELEASE-NOTES: synced

23 months agotransfer: avoid calling the read callback again after EOF
Jiří Hruška [Mon, 20 Nov 2023 08:26:59 +0000 (09:26 +0100)] 
transfer: avoid calling the read callback again after EOF

Regression since 7f43f3dc5994d01b12 (7.84.0)

Bug: https://curl.se/mail/lib-2023-11/0017.html

Closes #12363

23 months agodoh: provide better return code for responses w/o addresses
Daniel Stenberg [Mon, 20 Nov 2023 12:33:31 +0000 (13:33 +0100)] 
doh: provide better return code for responses w/o addresses

Previously it was wrongly returning CURLE_OUT_OF_MEMORY when the
response did not contain any addresses. Now it more accurately returns
CURLE_COULDNT_RESOLVE_HOST.

Reported-by: lRoccoon on github
Fixes #12365
Closes #12366

23 months agoHTTP/2, HTTP/3: handle detach of onoing transfers
Stefan Eissing [Mon, 20 Nov 2023 10:32:19 +0000 (11:32 +0100)] 
HTTP/2, HTTP/3: handle detach of onoing transfers

- refs #12356 where a UAF is reported when closing a connection
  with a stream whose easy handle was cleaned up already
- handle DETACH events same as DONE events in h2/h3 filters

Fixes #12356
Reported-by: Paweł Wegner
Closes #12364

23 months agoautotools: stop setting `-std=gnu89` with `--enable-warnings`
Viktor Szakats [Thu, 16 Nov 2023 21:44:45 +0000 (21:44 +0000)] 
autotools: stop setting `-std=gnu89` with `--enable-warnings`

Do not alter the C standard when building with `--enable-warnings` when
building with gcc.

On one hand this alters warning results compared to a default build.
On the other, it may produce different binaries, which is unexpected.

Also fix new warnings that appeared after removing `-std=gnu89`:

- include: fix public curl headers to use the correct printf mask for
  `CURL_FORMAT_CURL_OFF_T` and `CURL_FORMAT_CURL_OFF_TU` with mingw-w64
  and Visual Studio 2013 and newer. This fixes the printf mask warnings
  in examples and tests. E.g. [1]

- conncache: fix printf format string [2].

- http2: fix potential null pointer dereference [3].
  (seen on Slackware with gcc 11.)

- libssh: fix printf format string in SFTP code [4].
  Also make MSVC builds compatible with old CRT versions.

- libssh2: fix printf format string in SFTP code for MSVC.
  Applying the same fix as for libssh above.

- unit1395: fix `argument is null` and related issues [5]:
  - stop calling `strcmp()` with NULL to avoid undefined behaviour.
  - fix checking results if some of them were NULL.
  - do not pass NULL to printf `%s`.

- ci: keep a build job with `-std=gnu89` to continue testing for
  C89-compliance. We can apply this to other gcc jobs as needed.
  Ref: b23ce2cee7329bbf425f18b49973b7a5f23dfcb4 (2022-09-23) #9542

[1] https://dev.azure.com/daniel0244/curl/_build/results?buildId=18581&view=logs&jobId=ccf9cc6d-2ef1-5cf2-2c09-30f0c14f923b
[2] https://github.com/curl/curl/actions/runs/6896854263/job/18763831142?pr=12346#step:6:67
[3] https://github.com/curl/curl/actions/runs/6896854253/job/18763839238?pr=12346#step:30:214
[4] https://github.com/curl/curl/actions/runs/6896854253/job/18763838007?pr=12346#step:29:895
[5] https://github.com/curl/curl/actions/runs/6896854253/job/18763836775?pr=12346#step:33:1689

Closes #12346

23 months agoautotools: fix/improve gcc and Apple clang version detection
Viktor Szakats [Sun, 19 Nov 2023 23:31:40 +0000 (23:31 +0000)] 
autotools: fix/improve gcc and Apple clang version detection

- Before this patch we expected `n.n` `-dumpversion` output, but Ubuntu
  may return `n-win32` (also with `-dumpfullversion`). Causing these
  errors and failing to enable picky warnings:
  ```
  ../configure: line 23845: test: : integer expression expected
  ```
  Ref: https://github.com/libssh2/libssh2/actions/runs/6263453828/job/17007893718#step:5:143

  Fix that by stripping any dash-suffix and handling a dotless (major-only)
  version number by assuming `.0` in that case.

  `9.3-posix`, `9.3-win32`, `6`, `9.3.0`, `11`, `11.2`, `11.2.0`
  Ref: https://github.com/mamedev/mame/pull/9767

- fix Apple clang version detection for releases between
  'Apple LLVM version 7.3.0' and 'Apple LLVM version 10.0.1' where the
  version was under-detected as 3.7 llvm/clang equivalent.

- fix Apple clang version detection for 'Apple clang version 11.0.0'
  and newer where the Apple clang version was detected, instead of its
  llvm/clang equivalent.

- display detected clang/gcc/icc compiler version.

Via libssh2:
- https://github.com/libssh2/libssh2/commit/00a3b88c51cdb407fbbb347a2e38c5c7d89875ad
  https://github.com/libssh2/libssh2/pull/1187
- https://github.com/libssh2/libssh2/commit/89ccc83c7da73e7ca3a112e350008131942b592e
  https://github.com/libssh2/libssh2/pull/1232

Closes #12362

23 months agoautotools: delete LCC compiler support bits
Viktor Szakats [Sun, 19 Nov 2023 17:45:24 +0000 (17:45 +0000)] 
autotools: delete LCC compiler support bits

Follow-up to fd7ef00f4305a2919e6950def1cf83d0110a4acd #12222

Closes #12357