]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
22 months agoconnect: only start the happy eyeballs timer when needed
Loïc Yhuel [Mon, 25 Sep 2023 15:03:40 +0000 (17:03 +0200)] 
connect: only start the happy eyeballs timer when needed

The timeout is only used when there is a second address family, for the
delayed eyeballer.

Closes #11939

22 months agotool_operate: free 'gateway' correctly
Daniel Stenberg [Thu, 28 Sep 2023 07:32:39 +0000 (09:32 +0200)] 
tool_operate: free 'gateway' correctly

Pointed out by Coverity. The fix in 93885cf3a8d4e was incomplete.

Also removed repeated wording in IPFS related error messages.

Closes #11969

22 months agolib: move handling of `data->req.writer_stack` into Curl_client_write()
Stefan Eissing [Wed, 20 Sep 2023 09:59:16 +0000 (11:59 +0200)] 
lib: move handling of `data->req.writer_stack` into Curl_client_write()

- move definitions from content_encoding.h to sendf.h
- move create/cleanup/add code into sendf.c
- installed content_encoding writers will always be called
  on Curl_client_write(CLIENTWRITE_BODY)
- Curl_client_cleanup() frees writers and tempbuffers from
  paused transfers, irregardless of protocol

Closes #11908

22 months agomulti: round the timeout up to prevent early wakeups
Loïc Yhuel [Mon, 25 Sep 2023 19:55:29 +0000 (21:55 +0200)] 
multi: round the timeout up to prevent early wakeups

Curl_timediff rounds down to the millisecond, so curl_multi_perform can
be called too early, then we get a timeout of 0 and call it again.

The code already handled the case of timeouts which expired less than
1ms in the future.  By rounding up, we make sure we will never ask the
platform to wake up too early.

Closes #11938

22 months agoRELEASE-NOTES: spell out that IPFS is via gateway
Daniel Stenberg [Thu, 28 Sep 2023 07:49:43 +0000 (09:49 +0200)] 
RELEASE-NOTES: spell out that IPFS is via gateway

22 months agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 28 Sep 2023 07:42:52 +0000 (09:42 +0200)] 
RELEASE-NOTES: synced

22 months agotool_operate: avoid strlen() -1 on zero length content from file
Daniel Stenberg [Wed, 27 Sep 2023 08:27:07 +0000 (10:27 +0200)] 
tool_operate: avoid strlen() -1 on zero length content from file

Follow-up to 65b563a96a226649ba12cb1e

Closes #11959

22 months agotool_operate: fix memory mixups
Daniel Stenberg [Wed, 27 Sep 2023 07:51:46 +0000 (09:51 +0200)] 
tool_operate: fix memory mixups

Switch to plain getenv() from curl_getenv() to avoid the allocation and
having to keep track of which free() or curl_free() that need to be
used.

Coverity found issues and a memory leak.

Follow-up to 65b563a96a226649ba12cb1e

Closes #11959

22 months agocurl-functions.m4: fixup recent bad edits
Viktor Szakats [Wed, 27 Sep 2023 12:47:35 +0000 (12:47 +0000)] 
curl-functions.m4: fixup recent bad edits

Follow-up to 96c29900bcec32dd6bc8e9857c8871ff4b8b8ed9 #11940

Closes #11966

22 months agocurl-functions.m4: fix include line
Daniel Stenberg [Wed, 27 Sep 2023 12:10:30 +0000 (14:10 +0200)] 
curl-functions.m4: fix include line

This made the getaddrinfo detection fail, but we did not spot it in the
CI because it graciously falled back to using legacy functions instead!

Follow-up to 96c29900bcec (#11940)

Closes #11965

22 months agoinet_ntop: add typecast to silence Coverity
Daniel Stenberg [Wed, 27 Sep 2023 08:04:40 +0000 (10:04 +0200)] 
inet_ntop: add typecast to silence Coverity

CID 1024653:  Integer handling issues  (SIGN_EXTENSION)

Suspicious implicit sign extension: "src[i]" with type "unsigned char
const" (8 bits, unsigned) is promoted in "src[i] << (1 - i % 2 << 3)" to
type "int" (32 bits, signed), then sign-extended to type "unsigned long"
(64 bits, unsigned).  If "src[i] << (1 - i % 2 << 3)" is greater than
0x7FFFFFFF, the upper bits of the result will all be 1.

111         words[i/2] |= (src[i] << ((1 - (i % 2)) << 3));

The value will not be greater than 0x7FFFFFFF so this still cannot
happen.

Also, switch to ints here instead of longs. The values stored are 16 bit
so at least no need to use 64 bit variables. Also, longs are 32 bit on
some platforms so this logic still needs to work with 32 bits.

Closes #11960

22 months agodocs: adapt SEE ALSO sections to new requirements
Daniel Stenberg [Tue, 26 Sep 2023 21:25:11 +0000 (23:25 +0200)] 
docs: adapt SEE ALSO sections to new requirements

To please manpage-syntax.pl used by test 1173

Closes #11957

22 months agomanpage-syntax.pl: verify SEE ALSO syntax
Daniel Stenberg [Tue, 26 Sep 2023 07:54:14 +0000 (09:54 +0200)] 
manpage-syntax.pl: verify SEE ALSO syntax

- Enforce a single reference per .BR line
- Skip the quotes around the section number for example (3)
- Insist on trailing commas on all lines except the last
- Error on comma on the last SEE ALSO entry

- List the entries alpha-sorted, not enforced just recommended

Closes #11957

22 months agoconnect: expire the timeout when trying next
Daniel Stenberg [Mon, 25 Sep 2023 13:59:38 +0000 (15:59 +0200)] 
connect: expire the timeout when trying next

... so that it gets called again immediately and can continue trying
addresses to connect to. Otherwise it might unnecessarily wait for a
while there.

Fixes #11920
Reported-by: Loïc Yhuel
Closes #11935

22 months agohttp: remove wrong comment for http_should_fail
Daniel Stenberg [Mon, 25 Sep 2023 21:01:15 +0000 (23:01 +0200)] 
http: remove wrong comment for http_should_fail

Reported-by: Christian Schmitz
Ref: #11936
Closes #11941

22 months agotool_setopt: remove unused function tool_setopt_flags
Dan Fandrich [Mon, 25 Sep 2023 21:41:15 +0000 (14:41 -0700)] 
tool_setopt: remove unused function tool_setopt_flags

This function is identical to tool_setopt_bitmask except that it treats
the argument as unsigned.

Closes #11943

22 months agocmake: add feature checks for `memrchr` and `getifaddrs`
Viktor Szakats [Mon, 25 Sep 2023 22:35:26 +0000 (22:35 +0000)] 
cmake: add feature checks for `memrchr` and `getifaddrs`

- `HAVE_MEMRCHR` for `memrchr`.
- `HAVE_GETIFADDRS` for `getifaddrs`.
  This was present in `lib/curl_config.h.cmake` but missed the detection
  logic.

To match existing autotools feature checks.

Closes #11954

22 months agocmake: move global headers to specific checks
Viktor Szakats [Mon, 25 Sep 2023 22:35:26 +0000 (22:35 +0000)] 
cmake: move global headers to specific checks

Before this patch we added standard headers unconditionally to the
global list of headers used for feature checks. This is unnecessary
and also doesn't help CMake 'Generate' performance. This patch moves
these headers to each feature check where they are actually needed.
Stop using `stddef.h`, as it seems unnecessary.

I've used autotools' `m4/curl-functions.m4` to figure out these
dependencies.

Also delete checking for the C89 standard header `time.h`, that I
missed in the earlier commit.

Ref: 96c29900bcec32dd6bc8e9857c8871ff4b8b8ed9 #11940

Closes #11951

22 months agosrc/mkhelp: make generated code pass `checksrc`
Viktor Szakats [Tue, 26 Sep 2023 17:08:26 +0000 (17:08 +0000)] 
src/mkhelp: make generated code pass `checksrc`

Closes #11955

22 months agotests: show which curl tool `runtests.pl` is using
Viktor Szakats [Tue, 26 Sep 2023 11:02:08 +0000 (11:02 +0000)] 
tests: show which curl tool `runtests.pl` is using

To help debugging when there is issue finding or running it.

Closes #11953

22 months agoCI/azure: make `MAKEFLAGS` global to parallelize all jobs
Viktor Szakats [Tue, 26 Sep 2023 11:24:02 +0000 (11:24 +0000)] 
CI/azure: make `MAKEFLAGS` global to parallelize all jobs

https://dev.azure.com/daniel0244/curl/_build/results?buildId=17528 (before)
https://dev.azure.com/daniel0244/curl/_build/results?buildId=17545 (after, with -j3)

Closes #11952

22 months agoCI/azure: migrate old mingw MSYS1 jobs to MSYS2
Viktor Szakats [Tue, 26 Sep 2023 03:15:52 +0000 (03:15 +0000)] 
CI/azure: migrate old mingw MSYS1 jobs to MSYS2

Also delete an accidental variable reference.

Follow-up to 38029101e2d78ba125732b3bab6ec267b80a0e72

Closes #11945

22 months agodocs: add see also curl_multi_get_handles to some man pages
Daniel Stenberg [Mon, 25 Sep 2023 21:24:06 +0000 (23:24 +0200)] 
docs: add see also curl_multi_get_handles to some man pages

Assisted-by: Jay Satiro
Closes #11942

22 months agocmake: assume `_fseeki64` and no `fseeko` on Windows
Viktor Szakats [Tue, 26 Sep 2023 09:55:33 +0000 (09:55 +0000)] 
cmake: assume `_fseeki64` and no `fseeko` on Windows

`_fseeki64` is present in mingw-w64 1.0 (2011-09-26) headers, and
at least Watcom C 1.9 (2010) headers and MSVS 2008 [1].

`fseeko` is not present in any of these.

(mingw-w64 1.0 also offers `fseeko64`.)

[1] https://github.com/curl/curl/pull/11944#issuecomment-1734995004

Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918

Closes #11950

22 months agobuild: delete checks for C89 standard headers
Viktor Szakats [Mon, 25 Sep 2023 20:06:44 +0000 (20:06 +0000)] 
build: delete checks for C89 standard headers

Delete checks and guards for standard C89 headers and assume these are
available: `stdio.h`, `string.h`, `time.h`, `setjmp.h`, `stdlib.h`,
`stddef.h`, `signal.h`.

Some of these we already used unconditionally, some others we only used
for feature checks.

Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918 (for `stdio.h` in CMake)

Closes #11940

22 months agomultiif.h: remove Curl_multi_dump declaration
Stefan Eissing [Tue, 26 Sep 2023 07:22:57 +0000 (09:22 +0200)] 
multiif.h: remove Curl_multi_dump declaration

Follow-up to d850eea2 which removed the Curl_multi_dump definition.

Closes https://github.com/curl/curl/pull/11946

22 months agoconfig-win32: define HAVE__FSEEKI64
Jay Satiro [Mon, 25 Sep 2023 22:22:25 +0000 (18:22 -0400)] 
config-win32: define HAVE__FSEEKI64

Follow-up to 9c7165e9 which added an fseeko wrapper to the lib that
calls _fseeki64 if it is available.

Closes https://github.com/curl/curl/pull/11944

22 months agodocs: explain how PINNEDPUBLICKEY is independent of VERIFYPEER
Jay Satiro [Mon, 25 Sep 2023 05:41:20 +0000 (01:41 -0400)] 
docs: explain how PINNEDPUBLICKEY is independent of VERIFYPEER

- Explain that peer verification via CURLOPT_PINNEDPUBLICKEY takes place
  even if peer verification via CURLOPT_SSL_VERIFYPEER is turned off.

The behavior is verified by test2048.

Bug: https://github.com/curl/curl/issues/2935#issuecomment-418371872
Reported-by: claudiusaiz@users.noreply.github.com
Bug: https://github.com/curl/curl/discussions/11910
Reported-by: Hakan Sunay Halil
Closes https://github.com/curl/curl/pull/11930

22 months agoopenssl: improve ssl shutdown handling
Stefan Eissing [Fri, 15 Sep 2023 07:12:52 +0000 (09:12 +0200)] 
openssl: improve ssl shutdown handling

- If SSL shutdown is not finished then make an additional call to
  SSL_read to gather additional tracing.

- Fix http2 and h2-proxy filters to forward do_close() calls to the next
  filter.

For example h2 and SSL shutdown before and after this change:

Before:

Curl_conn_close -> cf_hc_close -> Curl_conn_cf_discard_chain ->
ssl_cf_destroy

After:

Curl_conn_close -> cf_hc_close -> cf_h2_close -> cf_setup_close ->
ssl_cf_close

Note that currently the tracing does not show output on the connection
closure handle. Refer to discussion in #11878.

Ref: https://github.com/curl/curl/discussions/11878

Closes https://github.com/curl/curl/pull/11858

22 months agomulti: fix small timeouts
Loïc Yhuel [Mon, 25 Sep 2023 19:12:42 +0000 (21:12 +0200)] 
multi: fix small timeouts

Since Curl_timediff rounds down to the millisecond, timeouts which
expire in less than 1ms are considered as outdated and removed from the
list. We can use Curl_timediff_us instead, big timeouts could saturate
but this is not an issue.

Closes #11937

22 months agocmake: fix stderr initialization in unity builds
Viktor Szakats [Mon, 25 Sep 2023 01:08:02 +0000 (01:08 +0000)] 
cmake: fix stderr initialization in unity builds

Before this patch, in certain build configurations the curl tool may
not have displayed anything (debug, macOS), or crashed at startup
(debug, Windows).

Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719
Necessary after 2f17a9b654121dd1ecf4fc043c6d08a9da3522db

Closes #11929

22 months agocmake: fix missing `zlib.h` when compiling `libcurltool`
Viktor Szakats [Sun, 24 Sep 2023 18:30:43 +0000 (18:30 +0000)] 
cmake: fix missing `zlib.h` when compiling `libcurltool`

Came up while testing debug/testing build for Windows. I'm not sure why
it didn't come up in earlier tests with similar config.
`tool_hugehelp.c` might indeed require `zlib.h` and without linking
`CURL_LIBS` to the `curltool` target, CMake doesn't seem to add detected
dependency headers to the compiler command.

```
[ 25%] Building C object src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
cd .../curl/bld-cmake-llvm-x64/src && /usr/local/opt/llvm/bin/clang
  --target=x86_64-w64-mingw32 --sysroot=/usr/local/opt/mingw-w64/toolchain-x86_64
  -DCURLDEBUG -DCURL_STATICLIB -DHAVE_CONFIG_H -DUNICODE -DUNITTESTS -D_UNICODE
  -I.../curl/include -I.../curl/lib -I.../curl/bld-cmake-llvm-x64/lib
  -I.../curl/bld-cmake-llvm-x64/include -I.../curl/src -Wno-unused-command-line-argument
  -D_UCRT -DDEBUGBUILD -DHAS_ALPN -DUSE_MANUAL=1  -fuse-ld=lld -Wl,-s -static-libgcc
  -lucrt [...] -O3 -DNDEBUG -municode -MD
  -MT src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj
  -MF CMakeFiles/curltool.dir/tool_hugehelp.c.obj.d
  -o CMakeFiles/curltool.dir/tool_hugehelp.c.obj -c .../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c
.../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c:6:10: fatal error: 'zlib.h' file not found
    6 | #include <zlib.h>
      |          ^~~~~~~~
```

Follow-up to 39e7c22bb459c2e818f079984989a26a09741860

Closes #11927

22 months agocmake: fix duplicate symbols when linking tests
Viktor Szakats [Sun, 24 Sep 2023 00:52:57 +0000 (00:52 +0000)] 
cmake: fix duplicate symbols when linking tests

The linker resolves this automatically in non-unity builds. In unity
builds the linker cannot drop a single object with the duplicates,
resulting in these errors. The root issue is that we started including
certain objects both via both libcurlu and libcurltool libs.

Regression from 39e7c22bb459c2e818f079984989a26a09741860

Windows errors:
```
[  3%] Linking C executable unit1303.exe
[  3%] Building C object tests/server/CMakeFiles/rtspd.dir/__/__/lib/curl_multibyte.c.obj
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_UTF8_to_wchar':
C:/projects/curl/lib/curl_multibyte.c:44: multiple definition of `curlx_convert_UTF8_to_wchar'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:44: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_wchar_to_UTF8':
C:/projects/curl/lib/curl_multibyte.c:66: multiple definition of `curlx_convert_wchar_to_UTF8'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:66: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_open':
C:/projects/curl/lib/curl_multibyte.c:92: multiple definition of `curlx_win32_open'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:92: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_fopen':
C:/projects/curl/lib/curl_multibyte.c:120: multiple definition of `curlx_win32_fopen'
../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:120: first defined here
../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_stat':
[...]
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/48110107/job/nvlhpt9aa4ehny5q#L247

macOS errors:
```
[ 56%] Linking C executable unit1302
duplicate symbol '_curlx_sotouz' in:
    ../../lib/libcurlu.a(unity_0_c.c.o)
    ../../src/libcurltool.a(unity_0_c.c.o)
duplicate symbol '_curlx_sitouz' in:
    ../../lib/libcurlu.a(unity_0_c.c.o)
    ../../src/libcurltool.a(unity_0_c.c.o)
duplicate symbol '_curlx_uztosz' in:
    ../../lib/libcurlu.a(unity_0_c.c.o)
    ../../src/libcurltool.a(unity_0_c.c.o)
[...]
```
with config:
```
  -DCMAKE_UNITY_BUILD=ON \
  -DENABLE_DEBUG=ON -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=-DDEBUGBUILD \
  -DBUILD_SHARED_LIBS=ON \
  -DBUILD_STATIC_LIBS=OFF
```

Closes #11926

22 months agocmake: lib `CURL_STATICLIB` fixes (Windows)
Viktor Szakats [Fri, 22 Sep 2023 10:18:26 +0000 (10:18 +0000)] 
cmake: lib `CURL_STATICLIB` fixes (Windows)

- always define `CURL_STATICLIB` when building libcurl for Windows.

  This disables `__declspec(dllexport)` for exported libcurl symbols.
  In normal mode (hide symbols) these exported symbols are specified
  via `libcurl.def`. When not hiding symbols, all symbols are exported
  by default.

  Regression from 1199308dbc902c52be67fc805c72dd2582520d30

  Fixes #11844

- fix to omit `libcurl.def` when not hiding private symbols.

  Regression from 2ebc74c36a19a1700af394c16855ce144d9878e3

- fix `ENABLED_DEBUG=ON` + shared curl tool Windows builds by also
  omitting `libcurl.def` in this case, and exporting all symbols
  instead. This ensures that a shared curl tool can access all debug
  functions which are not normally exported from libcurl DLL.

- delete `INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB"` for "objects"
  target.

  Follow-up to 2ebc74c36a19a1700af394c16855ce144d9878e3

- delete duplicate `BUILDING_LIBCURL` definitions.

- fix `HIDES_CURL_PRIVATE_SYMBOLS` to not overwrite earlier build settings.

  Follow-up to 1199308dbc902c52be67fc805c72dd2582520d30

Closes #11914

22 months agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 25 Sep 2023 21:35:49 +0000 (23:35 +0200)] 
RELEASE-NOTES: synced

22 months agotests: fix log directory path in IPFS tests
Dan Fandrich [Mon, 25 Sep 2023 19:37:20 +0000 (12:37 -0700)] 
tests: fix log directory path in IPFS tests

Hard-coding the log directory name fails with parallel tests.

Follow-up to 65b563a96

Ref: #8805

22 months agocurl_multi_get_handles: get easy handles from a multi handle
Daniel Stenberg [Mon, 25 Sep 2023 15:08:41 +0000 (17:08 +0200)] 
curl_multi_get_handles: get easy handles from a multi handle

Closes #11750

22 months agohttp: h1/h2 proxy unification
Stefan Eissing [Wed, 6 Sep 2023 12:43:22 +0000 (14:43 +0200)] 
http: h1/h2 proxy unification

- use shared code for setting up the CONNECT request
  when tunneling, used in HTTP/1.x and HTTP/2 proxying
- eliminate use of Curl_buffer_send() and other manipulations
  of `data->req` or `data->state.ulbuf`

Closes #11808

22 months agolib: use wrapper for curl_mime_data fseek callback
Natanael Copa [Fri, 22 Sep 2023 13:58:49 +0000 (13:58 +0000)] 
lib: use wrapper for curl_mime_data fseek callback

fseek uses long offset which does not match with curl_off_t. This leads
to undefined behavior when calling the callback and caused failure on
arm 32 bit.

Use a wrapper to solve this and use fseeko which uses off_t instead of
long.

Thanks to the nice people at Libera IRC #musl for helping finding this
out.

Fixes #11882
Fixes #11900
Closes #11918

22 months agoconfigure: sort AC_CHECK_FUNCS
Natanael Copa [Mon, 25 Sep 2023 11:03:26 +0000 (13:03 +0200)] 
configure: sort AC_CHECK_FUNCS

No functional changes.

22 months agowarnless: remove unused functions
Daniel Stenberg [Mon, 25 Sep 2023 10:32:07 +0000 (12:32 +0200)] 
warnless: remove unused functions

Previously put there for use with the intel compiler

Closes #11932

22 months agoGHA/linux: run singleuse to detect single-use global functions
Daniel Stenberg [Mon, 25 Sep 2023 07:44:51 +0000 (09:44 +0200)] 
GHA/linux: run singleuse to detect single-use global functions

Use --unit for configure --enable-debug builds

Closes #11932

22 months agosingleuse: add scan for use in other source codes
Daniel Stenberg [Mon, 25 Sep 2023 07:42:12 +0000 (09:42 +0200)] 
singleuse: add scan for use in other source codes

This should reduce false-positive to almost zero. Checks for presence in
unit tests if --unit is specified, which is intended for debug builds
where unit testing is enabled.

Closes #11932

22 months agomulti: remove Curl_multi_dump
Daniel Stenberg [Mon, 25 Sep 2023 07:42:47 +0000 (09:42 +0200)] 
multi: remove Curl_multi_dump

A debug-only function that is basically never used. Removed to ease the
use of the singleuse script to detect non-static functions not used
outside the file where it is defined.

Closes #11931

22 months agotests: fix compiler warnings
Viktor Szakats [Sun, 24 Sep 2023 09:50:39 +0000 (09:50 +0000)] 
tests: fix compiler warnings

Seen with llvm 17 on Windows x64.

```
.../curl/tests/server/rtspd.c:136:13: warning: no previous extern declaration for non-static variable 'logdir' [-Wmissing-variable-declarations]
  136 | const char *logdir = "log";
      |             ^
.../curl/tests/server/rtspd.c:136:7: note: declare 'static' if the variable is not intended to be used outside of this translation unit
  136 | const char *logdir = "log";
      |       ^
.../curl/tests/server/rtspd.c:137:6: warning: no previous extern declaration for non-static variable 'loglockfile' [-Wmissing-variable-declarations]
  137 | char loglockfile[256];
      |      ^
.../curl/tests/server/rtspd.c:137:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
  137 | char loglockfile[256];
      | ^
.../curl/tests/server/fake_ntlm.c:43:13: warning: no previous extern declaration for non-static variable 'logdir' [-Wmissing-variable-declarations]
   43 | const char *logdir = "log";
      |             ^
.../curl/tests/server/fake_ntlm.c:43:7: note: declare 'static' if the variable is not intended to be used outside of this translation unit
   43 | const char *logdir = "log";
      |       ^
.../curl/src/tool_doswin.c:350:8: warning: possible misuse of comma operator here [-Wcomma]
  350 |     ++d, ++s;
      |        ^
.../curl/src/tool_doswin.c:350:5: note: cast expression to void to silence warning
  350 |     ++d, ++s;
      |     ^~~
      |     (void)( )
```

```
.../curl/tests/libtest/lib540.c:146:27: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
  146 |         int itimeout = (L > (long)INT_MAX) ? INT_MAX : (int)L;
      |                         ~ ^ ~~~~~~~~~~~~~
1 warning generated.

.../curl/tests/libtest/libntlmconnect.c:195:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
  195 |       int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
1 warning generated.

.../curl/tests/libtest/lib591.c:117:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
  117 |       int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
1 warning generated.
.../curl/tests/libtest/lib597.c:99:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare]
   99 |       int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
1 warning generated.
```

Seen on macOS Intel:
```
.../curl/tests/server/sws.c:440:64: warning: field precision should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat]
          msnprintf(logbuf, sizeof(logbuf), "Got request: %s %.*s HTTP/%d.%d",
                                                             ~~^~
1 warning generated.
```

Closes #11925

22 months agourl: fix netrc info message
Jay Satiro [Wed, 20 Sep 2023 22:59:45 +0000 (18:59 -0400)] 
url: fix netrc info message

- Fix netrc info message to use the generic ".netrc" filename if the
  user did not specify a netrc location.

- Update --netrc doc to add that recent versions of curl on Windows
  prefer .netrc over _netrc.

Before:
* Couldn't find host google.com in the (nil) file; using defaults

After:
* Couldn't find host google.com in the .netrc file; using defaults

Closes https://github.com/curl/curl/pull/11904

22 months agowolfssh: do cleanup in Curl_ssh_cleanup
Dan Fandrich [Fri, 22 Sep 2023 17:59:53 +0000 (10:59 -0700)] 
wolfssh: do cleanup in Curl_ssh_cleanup

Closes: #11921
22 months agotool_listhelp: regenerated
Daniel Stenberg [Sat, 23 Sep 2023 09:27:03 +0000 (11:27 +0200)] 
tool_listhelp: regenerated

Polished the --ipfs-gateway description

Fixed the --trace-config description

The script also fixed some other small mistakes

Closes #11923

22 months agoMakefile.mk: always set `CURL_STATICLIB` for lib (Windows)
Viktor Szakats [Fri, 22 Sep 2023 18:52:46 +0000 (18:52 +0000)] 
Makefile.mk: always set `CURL_STATICLIB` for lib (Windows)

Also fix to export all symbols in Windows debug builds, making
`-debug-dyn` builds work with `-DCURL_STATICLIB` set.

Ref: https://github.com/curl/curl/pull/11914 (same for CMake)

Closes #11924

22 months agoquic: set ciphers/curves the same way regular TLS does
Daniel Stenberg [Tue, 12 Sep 2023 06:01:05 +0000 (08:01 +0200)] 
quic: set ciphers/curves the same way regular TLS does

for OpenSSL/BoringSSL

Fixes #11796
Reported-by: Karthikdasari0423 on github
Assisted-by: Jay Satiro
Closes #11836

22 months agotest457: verify --max-filesize with chunked encoding
Daniel Stenberg [Sat, 23 Sep 2023 09:20:00 +0000 (11:20 +0200)] 
test457: verify --max-filesize with chunked encoding

22 months agolib: let the max filesize option stop too big transfers too
Daniel Stenberg [Sat, 23 Sep 2023 09:20:00 +0000 (11:20 +0200)] 
lib: let the max filesize option stop too big transfers too

Previously it would only stop them from getting started if the size is
known to be too big then.

Update the libcurl and curl docs accordingly.

Fixes #11810
Reported-by: Elliot Killick
Assisted-by: Jay Satiro
Closes #11820

22 months agomingw: delete support for legacy mingw.org toolchain
Viktor Szakats [Tue, 8 Aug 2023 11:00:36 +0000 (11:00 +0000)] 
mingw: delete support for legacy mingw.org toolchain

Drop support for "old" / "legacy" / "classic" / "v1" / "mingw32" MinGW:
  https://en.wikipedia.org/wiki/MinGW, https://osdn.net/projects/mingw/
Its homepage used to be http://mingw.org/ [no HTTPS], and broken now.
It supported the x86 CPU only and used a old Windows API header and
implib set, often causing issues. It also misses most modern Windows
features, offering old versions of both binutils and gcc (no llvm/clang
support). It was last updated 2 years ago.

curl now relies on toolchains based on the mingw-w64 project:
https://www.mingw-w64.org/  https://sourceforge.net/projects/mingw-w64/
https://www.msys2.org/  https://github.com/msys2/msys2
https://github.com/mstorsjo/llvm-mingw
(Also available via Linux and macOS package managers.)

Closes #11625

22 months agocurl: add support for the IPFS protocols:
Mark Gaiser [Sun, 27 Mar 2022 00:31:58 +0000 (01:31 +0100)] 
curl: add support for the IPFS protocols:

- ipfs://<cid>
- ipns://<cid>

This allows you tu use ipfs in curl like:
curl ipfs://<cid>
and
curl ipns://<cid>

For more information consult the readme at:
https://curl.se/docs/ipfs.html

Closes #8805

22 months agobufq: remove Curl_bufq_skip_and_shift (unused)
Daniel Stenberg [Fri, 22 Sep 2023 12:01:07 +0000 (14:01 +0200)] 
bufq: remove Curl_bufq_skip_and_shift (unused)

Closes #11915

22 months agoscripts/singleuse.pl: add curl_global_trace
Daniel Stenberg [Fri, 22 Sep 2023 12:13:00 +0000 (14:13 +0200)] 
scripts/singleuse.pl: add curl_global_trace

22 months agocmake: fix unity symbol collisions in h2 builds
Viktor Szakats [Thu, 21 Sep 2023 22:27:57 +0000 (22:27 +0000)] 
cmake: fix unity symbol collisions in h2 builds

Regression from 331b89a319d0067fa1e6441719307cfef9c7960f

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

22 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 22 Sep 2023 08:36:31 +0000 (10:36 +0200)] 
RELEASE-NOTES: synced

22 months agogithub/labeler: improve the match patterns
Dan Fandrich [Thu, 21 Sep 2023 17:50:49 +0000 (10:50 -0700)] 
github/labeler: improve the match patterns

This includes new rules for setting the appleOS and logging labels and
matches on some example files. Also, enable dot mode for wildcard
matches in the .github directory.

22 months agoupload-file.d: describe the file name slash/backslash handling
Daniel Stenberg [Thu, 21 Sep 2023 15:46:12 +0000 (17:46 +0200)] 
upload-file.d: describe the file name slash/backslash handling

Closes #11911

22 months agolibssh: cap SFTP packet size sent
Jakub Jelen [Tue, 5 Sep 2023 15:33:41 +0000 (17:33 +0200)] 
libssh: cap SFTP packet size sent

Due to libssh limitations

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Closes #11804

22 months agocurl.h: mark CURLSSLBACKEND_NSS as deprecated since 8.3.0
Daniel Stenberg [Thu, 21 Sep 2023 07:34:36 +0000 (09:34 +0200)] 
curl.h: mark CURLSSLBACKEND_NSS as deprecated since 8.3.0

Closes #11905

22 months agomailmap: unify Michael Osipov under a single email
Daniel Stenberg [Thu, 21 Sep 2023 12:18:49 +0000 (14:18 +0200)] 
mailmap: unify Michael Osipov under a single email

22 months agodocs: use CURLSSLBACKEND_NONE
Ted Lyngmo [Thu, 21 Sep 2023 10:44:35 +0000 (12:44 +0200)] 
docs: use CURLSSLBACKEND_NONE

[ssl] use CURLSSLBACKEND_NONE instead of (curl_sslbackend)-1 in
documentation and examples.

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
Closes #11909

22 months agogithub/labeler: give the sync-labels config item a default value
Dan Fandrich [Thu, 21 Sep 2023 08:17:32 +0000 (01:17 -0700)] 
github/labeler: give the sync-labels config item a default value

This shouldn't be necessary and is likely a bug with this beta version
of the labeller.

Also, fix the negative matches for the documentation label.

Follow-up to dd12b452a
Closes #11907

22 months agogithub/labeler: fix up more the labeler config format
Dan Fandrich [Thu, 21 Sep 2023 07:43:04 +0000 (00:43 -0700)] 
github/labeler: fix up more the labeler config format

The new version didn't like the workaround we had for a bug in the
previous labeler version, and it should no longer be needed.

Follow-up to dd12b452a
Closes #11906

22 months agogithub/labeler: fix indenting to try to appease labeller
Dan Fandrich [Thu, 21 Sep 2023 07:03:22 +0000 (00:03 -0700)] 
github/labeler: fix indenting to try to appease labeller

Follow-up to dd12b452a

22 months agolibssh2: fix error message on failed pubkey-from-file
Jay Satiro [Mon, 18 Sep 2023 21:58:23 +0000 (17:58 -0400)] 
libssh2: fix error message on failed pubkey-from-file

- If libssh2_userauth_publickey_fromfile_ex returns -1 then show error
  message "SSH public key authentication failed: Reason unknown (-1)".

When libssh2_userauth_publickey_fromfile_ex returns -1 it does so as a
generic error and therefore doesn't set an error message. AFAICT that is
not documented behavior.

Prior to this change libcurl retrieved the last set error message which
would be from a previous function failing. That resulted in misleading
auth failed error messages in verbose mode.

Bug: https://github.com/curl/curl/issues/11837#issue-1891827355
Reported-by: consulion@users.noreply.github.com
Closes https://github.com/curl/curl/pull/11881

22 months agopytest: exclude test_03_goaway in CI runs due to timing dependency
Stefan Eissing [Fri, 15 Sep 2023 07:21:50 +0000 (09:21 +0200)] 
pytest: exclude test_03_goaway in CI runs due to timing dependency

Closes #11860

22 months agolib: disambiguate Curl_client_write flag semantics
Stefan Eissing [Tue, 19 Sep 2023 10:31:31 +0000 (12:31 +0200)] 
lib: disambiguate Curl_client_write flag semantics

- use CLIENTWRITE_BODY *only* when data is actually body data
- add CLIENTWRITE_INFO for meta data that is *not* a HEADER
- debug assertions that BODY/INFO/HEADER is not used mixed
- move `data->set.include_header` check into Curl_client_write
  so protocol handlers no longer have to care
- add special in FTP for `data->set.include_header` for historic,
  backward compatible reasons
- move unpausing of client writes from easy.c to sendf.c, so that
  code is in one place and can forward flags correctly

Closes #11885

22 months agotftpd: always use curl's own tftp.h
Patrick Monnerat [Wed, 20 Sep 2023 12:02:05 +0000 (14:02 +0200)] 
tftpd: always use curl's own tftp.h

Using the system's provided arpa/tftp.h and optimizing, GCC 12 detects
and reports a stringop-overread warning:

tftpd.c: In function ‘write_behind.isra’:
tftpd.c:485:12: warning: ‘write’ reading between 1 and 2147483647 bytes from a region of size 0 [-Wstringop-overread]
  485 |     return write(test->ofile, writebuf, count);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from tftpd.c:71:
/usr/include/arpa/tftp.h:58:30: note: source object ‘tu_data’ of size 0
   58 |                         char tu_data[0];        /* data or error string */
      |                              ^~~~~~~

This occurs because writebuf points to this field and the latter
cannot be considered as being of dynamic length because it is not
the last field in the structure. Thus it is bound to its declared
size.

This commit always uses curl's own version of tftp.h where the
target field is last in its structure, effectively avoiding the
warning.

As HAVE_ARPA_TFTP_H is not used anymore, cmake/configure checks for
arpa/tftp.h are removed.

Closes #11897

22 months agotest1474: make precheck more robust on non-Solaris systems
Dan Fandrich [Wed, 20 Sep 2023 21:26:32 +0000 (14:26 -0700)] 
test1474: make precheck more robust on non-Solaris systems

If uname -r returns something odd, perl could return an error code and
the test would be erroneously skipped. The qx// syntax avoid this.

Followup to 08f9b2148

22 months agogithub/labeler: switch to the 5 beta version
Dan Fandrich [Wed, 20 Sep 2023 19:22:46 +0000 (12:22 -0700)] 
github/labeler: switch to the 5 beta version

This version adds an important feature that will allow more PRs to be
labelled. Rather than being limited to labeling PRs with files that
match a single glob, it can now label them if multiple changed files
match any one of a number of globs.

22 months agolib: enable hmac for digest as well
Daniel Stenberg [Wed, 20 Sep 2023 07:56:26 +0000 (09:56 +0200)] 
lib: enable hmac for digest as well

Previously a build that disabled NTLM and aws-sigv4 would fail to build
since the hmac was disabled, but it is also needed for digest auth.

Follow-up to e92edfbef64448ef

Fixes #11890
Reported-by: Aleksander Mazur
Closes #11896

22 months agoidn: if idn2_check_version returns NULL, return error
Daniel Stenberg [Wed, 20 Sep 2023 09:10:16 +0000 (11:10 +0200)] 
idn: if idn2_check_version returns NULL, return error

... this avoids a NULL dereference for this unusual case.

Reported-by: s0urc3_ on hackerone
Closes #11898

22 months agohttp: fix CURL_DISABLE_BEARER_AUTH breakage
Daniel Stenberg [Wed, 20 Sep 2023 06:46:56 +0000 (08:46 +0200)] 
http: fix CURL_DISABLE_BEARER_AUTH breakage

When bearer auth was disabled, the if/else logic got wrong and caused
problems.

Follow-up to e92edfbef64448ef461
Fixes #11892
Reported-by: Aleksander Mazur
Closes #11895

22 months agowolfssl: allow capath with CURLOPT_CAINFO_BLOB
Michael Osipov [Tue, 19 Sep 2023 12:30:29 +0000 (14:30 +0200)] 
wolfssl: allow capath with CURLOPT_CAINFO_BLOB

Remain consistent with OpenSSL. While CAfile is nulled as documented
with CURLOPT_CAINFO_BLOB, CApath remains intact.

Closes #11886

22 months agowolfssl: use ssl_cafile/ssl_capath variables consistent with openssl.c
Michael Osipov [Tue, 19 Sep 2023 12:26:20 +0000 (14:26 +0200)] 
wolfssl: use ssl_cafile/ssl_capath variables consistent with openssl.c

Closes #11886

22 months agotest1474: disable test on NetBSD, OpenBSD and Solaris 10
Dan Fandrich [Tue, 19 Sep 2023 18:09:47 +0000 (11:09 -0700)] 
test1474: disable test on NetBSD, OpenBSD and Solaris 10

These kernels only send a fraction of the requested amount of the first
large block, invalidating the assumptions of the test and causing it to
fail.

Assisted-by: Christian Weisgerber
Ref: https://curl.se/mail/lib-2023-09/0021.html
Closes #11888

22 months agocmake, configure: also link with CoreServices
Ryan Schmidt [Wed, 20 Sep 2023 01:36:39 +0000 (20:36 -0500)] 
cmake, configure: also link with CoreServices

When linking with CoreFoundation, also link with CoreServices which is
apparently required to avoid an NSInvalidArgumentException in software
linking with libcurl on macOS Sonoma 14 and later.

Fixes #11893
Closes #11894

22 months agoCI/azure: remove pip, wheel, cryptography, pyopenssl and impacket
Marc Hoersken [Tue, 19 Sep 2023 18:36:50 +0000 (20:36 +0200)] 
CI/azure: remove pip, wheel, cryptography, pyopenssl and impacket

These dependencies are now already included in the Docker image.

Ref: https://github.com/mback2k/curl-docker-winbuildenv/commit/2607a31bcab544b41d15606e97f38cf312c1ce56

Closes #11889

22 months agowolfssl: if CURLOPT_CAINFO_BLOB is set, ignore the CA files
Daniel Stenberg [Tue, 19 Sep 2023 08:53:44 +0000 (10:53 +0200)] 
wolfssl: if CURLOPT_CAINFO_BLOB is set, ignore the CA files

Ref: #11883
Reported-by: Michael Osipov
Closes #11884

22 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 19 Sep 2023 06:32:38 +0000 (08:32 +0200)] 
RELEASE-NOTES: synced

22 months agotest3103: CURLOPT_COOKIELIST test
Daniel Stenberg [Mon, 18 Sep 2023 06:43:00 +0000 (08:43 +0200)] 
test3103: CURLOPT_COOKIELIST test

22 months agocookie: set ->running in cookie_init even if data is NULL
Daniel Stenberg [Mon, 18 Sep 2023 07:06:53 +0000 (09:06 +0200)] 
cookie: set ->running in cookie_init even if data is NULL

This is a regression introduced in b1b326ec500 (shipped in curl 8.1.0)

Test 3103 verifies.

Fixes #11875
Reported-by: wangp on github
Closes #11876

22 months agotest498: total header size for all redirects is larger than accepted
Daniel Stenberg [Mon, 18 Sep 2023 07:19:21 +0000 (09:19 +0200)] 
test498: total header size for all redirects is larger than accepted

22 months agohttp: use per-request counter to check too large headers
Daniel Stenberg [Sat, 16 Sep 2023 21:54:44 +0000 (23:54 +0200)] 
http: use per-request counter to check too large headers

Not the counter that accumulates all headers over all redirects.

Follow-up to 3ee79c1674fd6

Do a second check for 20 times the limit for the accumulated size for
all headers.

Fixes #11871
Reported-by: Joshix-1 on github
Closes #11872

22 months agoTHANKS: add Eric Murphy
Jay Satiro [Mon, 18 Sep 2023 18:38:43 +0000 (14:38 -0400)] 
THANKS: add Eric Murphy

He reported #11850 (quiche build error) but I forgot to add a
'reported-by' entry in the fix 267e14f1.

22 months agoh2-proxy: remove left-over mistake in drain_tunnel()
Daniel Stenberg [Mon, 18 Sep 2023 07:25:19 +0000 (09:25 +0200)] 
h2-proxy: remove left-over mistake in drain_tunnel()

Left-over from 331b89a319

Reported-by: 南宫雪珊
Closes https://github.com/curl/curl/pull/11877

22 months agolib: failf/infof compiler warnings
vvb2060 [Sun, 17 Sep 2023 05:04:17 +0000 (13:04 +0800)] 
lib: failf/infof compiler warnings

Closes #11874

22 months agorand: fix 'alnum': array is too small to include a terminating null character
Daniel Stenberg [Sat, 16 Sep 2023 20:37:28 +0000 (22:37 +0200)] 
rand: fix 'alnum': array is too small to include a terminating null character

It was that small on purpose, but this change now adds the null byte to
avoid the error.

Follow-up to 3aa3cc9b052353b1

Reported-by: Dan Fandrich
Ref: #11838
Closes #11870

22 months agocmake: fix the help text to the static build option in CMakeLists.txt
Mathias Fuchs [Wed, 13 Sep 2023 12:55:58 +0000 (14:55 +0200)] 
cmake: fix the help text to the static build option in CMakeLists.txt

Closes #11843

22 months agoMANUAL.md: change domain to example.com
John Haugabook [Sat, 16 Sep 2023 00:36:21 +0000 (20:36 -0400)] 
MANUAL.md: change domain to example.com

Closes #11866

22 months agodoh: inherit DEBUGFUNCTION/DATA
Daniel Stenberg [Sat, 16 Sep 2023 09:17:45 +0000 (11:17 +0200)] 
doh: inherit DEBUGFUNCTION/DATA

When creating new transfers for doing DoH, they now inherit the debug
settings from the initiating transfer, so that the application can
redirect and handle the verbose output correctly even for the DoH
transfers.

Reported-by: calvin2021y on github
Fixes #11864
Closes #11869

22 months agohttp_aws_sigv4: fix sorting with empty parts
Dan Fandrich [Sat, 16 Sep 2023 07:08:26 +0000 (00:08 -0700)] 
http_aws_sigv4: fix sorting with empty parts

When comparing with an empty part, the non-empty one is always
considered greater-than. Previously, the two would be considered equal
which would randomly place empty parts amongst non-empty ones. This
showed as a test 439 failure on Solaris as it uses a different
implementation of qsort() that compares parts differently.

Fixes #11855
Closes #11868

22 months agoCI: ignore the "flaky" and "timing-dependent" test results
Dan Fandrich [Fri, 15 Sep 2023 20:42:04 +0000 (13:42 -0700)] 
CI: ignore the "flaky" and "timing-dependent" test results

CI builds will now run these tests, but will ignore the results if they
fail. The relevant tests are ones that are sensitive to timing or
have edge conditions that make them more likely to fail on CI servers,
which are often heavily overloaded and slow.

This change only adds two additional tests to be ignored, since the
others already had the flaky keyword.

Closes #11865

22 months agoruntests: eliminate a warning on old perl versions
Dan Fandrich [Thu, 14 Sep 2023 23:23:08 +0000 (16:23 -0700)] 
runtests: eliminate a warning on old perl versions

The warning "Use of implicit split to @_ is deprecated" showed between
perl versions about 5.8 through 5.11.

22 months agotests: log the test result code after each libtest
Dan Fandrich [Wed, 13 Sep 2023 18:31:16 +0000 (11:31 -0700)] 
tests: log the test result code after each libtest

This makes it easier to determine the test status. Also, capitalize
FAILURE and ABORT messages in log lines to make them easier to spot.

22 months agomisc: better random strings
Harry Sintonen [Tue, 12 Sep 2023 10:51:21 +0000 (13:51 +0300)] 
misc: better random strings

Generate alphanumerical random strings.

Prior this change curl used to create random hex strings. This was
mostly okay, but having alphanumerical random strings is better: The
strings have more entropy in the same space.

The MIME multipart boundary used to be mere 64-bits of randomness due
to being 16 hex chars. With these changes the boundary is 22
alphanumerical chars, or little over 130 bits of randomness.

Closes #11838

22 months agocookie: reduce variable scope, add const
Daniel Stenberg [Fri, 15 Sep 2023 11:43:00 +0000 (13:43 +0200)] 
cookie: reduce variable scope, add const