]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 years agotests/http: remove year ranges from copyrights
Daniel Stenberg [Tue, 14 Mar 2023 15:17:46 +0000 (16:17 +0100)] 
tests/http: remove year ranges from copyrights

Closes #10763

2 years agoaws_sigv4: fall back to UNSIGNED-PAYLOAD for sign_as_s3
Casey Bodley [Wed, 15 Feb 2023 15:47:04 +0000 (10:47 -0500)] 
aws_sigv4: fall back to UNSIGNED-PAYLOAD for sign_as_s3

all s3 requests default to UNSIGNED-PAYLOAD and add the required
x-amz-content-sha256 header. this allows CURLAUTH_AWS_SIGV4 to correctly
sign s3 requests to amazon with no additional configuration

Signed-off-by: Casey Bodley <cbodley@redhat.com>
Closes #9995

2 years agowolfssl: add quic/ngtcp2 detection in cmake, and fix builds
Viktor Szakats [Tue, 14 Mar 2023 11:57:31 +0000 (11:57 +0000)] 
wolfssl: add quic/ngtcp2 detection in cmake, and fix builds

- add QUIC/ngtcp2 detection in CMake with wolfSSL.

  Because wolfSSL uses zlib if available, move compression detection
  before TLS detection. (OpenSSL might also need this in the future.)

- wolfSSL 5.5.0 started using C99 types in its `quic.h` header, but it
  doesn't #include the necessary C99 header itself, breaking builds
  (unless another dependency pulled it by chance.) Add local workaround
  for it. For this to work with all build tools, we had to fix our
  header detection first. Ref: #10745

  Ref: https://github.com/curl/curl-for-win/commit/6ad5f6ecc15620c15625fc443476b3a1ecef4f3f

Closes #10739

2 years agosecure-transport: fix recv return code handling
Stefan Eissing [Thu, 9 Mar 2023 10:55:46 +0000 (11:55 +0100)] 
secure-transport: fix recv return code handling

Return code handling of recv calls were not always correct when an error
occured or the connection was closed.

Closes #10717

2 years agohttp2: Use KEEP_SEND_HOLD for flow control in HTTP/2
Stefan Eissing [Mon, 13 Mar 2023 10:44:26 +0000 (11:44 +0100)] 
http2: Use KEEP_SEND_HOLD for flow control in HTTP/2

- use the defined, but so far not used, KEEP_SEND_HOLD bit for flow
  control based suspend of sending in transfers.

Prior to this change KEEP_SEND_PAUSE bit was used instead, but that can
interfere with pausing streams from the user side via curl_easy_pause.

Fixes https://github.com/curl/curl/issues/10751
Closes https://github.com/curl/curl/pull/10753

2 years agotests: fix control code that hid some text in runtests.1
Dan Fandrich [Tue, 14 Mar 2023 00:21:02 +0000 (17:21 -0700)] 
tests: fix control code that hid some text in runtests.1

2 years agotests: sync option lists in runtests.pl & its man page
Dan Fandrich [Tue, 14 Mar 2023 00:12:41 +0000 (17:12 -0700)] 
tests: sync option lists in runtests.pl & its man page

2 years agomulti: make multi_perform ignore/unignore signals less often
Daniel Stenberg [Sun, 12 Mar 2023 22:55:09 +0000 (23:55 +0100)] 
multi: make multi_perform ignore/unignore signals less often

For improved performance

Reported-by: Jerome St-Louis
Ref: #10743
Closes #10750

2 years agocmake: delete unused HAVE__STRTOI64
Viktor Szakats [Mon, 13 Mar 2023 15:49:54 +0000 (15:49 +0000)] 
cmake: delete unused HAVE__STRTOI64

Also delete obsolete surrounding comments.

Reviewed-by: Daniel Stenberg
Closes #10756

2 years agoCI: fix copyright header
Viktor Szakats [Mon, 13 Mar 2023 15:47:38 +0000 (15:47 +0000)] 
CI: fix copyright header

Follow-up to 395b9175b7422d699fa93643973295c106cdf147

2 years agoRELEASE-PROCEDURE.md: update coming release dates
Daniel Stenberg [Mon, 13 Mar 2023 15:43:42 +0000 (16:43 +0100)] 
RELEASE-PROCEDURE.md: update coming release dates

2 years agotests/http: add pytest to GHA and improve tests
Stefan Eissing [Thu, 9 Mar 2023 09:50:55 +0000 (10:50 +0100)] 
tests/http: add pytest to GHA and improve tests

- added to: ngtcp2-quictls, ngtcp2-gnutls and the linux varians
  quiche, bearssl, libressl, mbedtls, openssl3, rustls
- added disabled in ngtcp2-wolfssl due to weird SSL_connect() errors
  not reproducable locally

Improvements on pytest:

-  handling of systems with nghttpx in $PATH
   - configure will seach $PATH got nghttpx used in pytest
   - pytest fixes for managing nghttpx without h3 support
   - ngtcp2-wolfssl: use a fully enabled wolfssl build

- lower parallel count for http/1.1 tests, since we do not
   want to test excessive connections.
- check built curl for HTTPS-proxy support in proxy tests
- bearssl does not like one of our critical cert extensions, making
  it non-critical now
- bearssl is too slow for test_12, skipping
- making sure we do h3 tests only when curl and server support is there

Closes #10699

2 years agotool_operate: silence unused parameter warning
Marcel Raad [Mon, 13 Mar 2023 07:52:39 +0000 (08:52 +0100)] 
tool_operate: silence unused parameter warning

`global` is only used in the `my_setopt` macro version without
`CURL_DISABLE_LIBCURL_OPTION` since commit 4774decf10a.

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

2 years agobuild: fix stdint/inttypes detection with non-autotools
Viktor Szakats [Mon, 13 Mar 2023 10:46:38 +0000 (10:46 +0000)] 
build: fix stdint/inttypes detection with non-autotools

Fix `stdint.h` and `inttypes.h` detection with non-autotools builds on
Windows. (autotools already auto-detected them accurately.)

`lib/config-win32.h` builds (e.g. `Makefile.mk`):
- set `HAVE_STDINT_H` where supported.
- set `HAVE_INTTYPES_H` for MinGW.

CMake:
- auto-detect them on Windows. (They were both force-disabled.)
- delete unused `CURL_PULL_STDINT_H`.
- delete unused `CURL_PULL_INTTYPES_H`.
- stop detecting `HAVE_STDINT_H` twice.
  Present since the initial CMake commit: 4c5307b45655ba75ab066564afdc0c111a8b9291

curl doesn't use these C99 headers, we need them now to workaround
broken wolfSSL builds. Ref: #10739

Once that clears up, we can delete these detections and macros (unless
we want to keep them for future us.)

Reviewed-by: Daniel Stenberg
Closes #10745

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 13 Mar 2023 08:11:14 +0000 (09:11 +0100)] 
RELEASE-NOTES: synced

2 years agoftp: add more conditions for connection reuse
Daniel Stenberg [Thu, 9 Mar 2023 16:47:06 +0000 (17:47 +0100)] 
ftp: add more conditions for connection reuse

Reported-by: Harry Sintonen
Closes #10730

2 years agotests: make first.c the same for both lib tests and unit tests
Dan Fandrich [Mon, 13 Mar 2023 01:56:22 +0000 (18:56 -0700)] 
tests: make first.c the same for both lib tests and unit tests

The only difference used to be global variable used in unittest tests.
After cb7ed5a removed individual flag overrides for the unittests, first.c
was no longer recompiled for unit tests to include the flag, so whether it
worked or gave a link error depended on whether it was compiled in
libtest or unittest first. This way also speeds up the build by
eliminating 40 identical compile invocations.

Fixes #10749

2 years agotests: use AM_CPPFILES to modify flags in unit tests
Dan Fandrich [Sun, 12 Mar 2023 23:58:26 +0000 (16:58 -0700)] 
tests: use AM_CPPFILES to modify flags in unit tests

Using CPPFLAGS sometimes caused odd compile issues when building tests
with parallel make and AM_CPPFILES is the right flag, anyway.

Follow-up to cb7ed5a

Ref #10749

2 years agoMakefile.mk: fix -g option in debug mode [ci skip]
Viktor Szakats [Mon, 13 Mar 2023 00:16:30 +0000 (00:16 +0000)] 
Makefile.mk: fix -g option in debug mode [ci skip]

Add it to `CFLAGS` (was: `LDFLAGS`).

Closes #10747

2 years agotool: improve --stderr handling
Jay Satiro [Sat, 4 Mar 2023 09:07:24 +0000 (04:07 -0500)] 
tool: improve --stderr handling

- freopen stderr with the user-specified file (--stderr file) instead of
  using a separate 'errors' stream.

- In tool_setup.h override stdio.h's stderr macro as global variable
  tool_stderr.

Both freopen and overriding the stderr macro are necessary because if
the user-specified filename is "-" then stdout is assigned to
tool_stderr and no freopen takes place. See the PR for more information.

Ref: https://github.com/curl/curl/issues/10491

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

2 years agoCI: don't run CI jobs if only another CI was changed
Dan Fandrich [Sat, 11 Mar 2023 00:58:21 +0000 (16:58 -0800)] 
CI: don't run CI jobs if only another CI was changed

Also skip builds on non-Windows platforms when only Windows build files
have changed.

This should reduce the number of useless builds and the associated
waiting time and chance of spurious failures, freeing resources for
new PRs.

Closes #10742

2 years agohttp: don't send 100-continue for short PUT requests
Dan Fandrich [Fri, 10 Mar 2023 21:15:43 +0000 (13:15 -0800)] 
http: don't send 100-continue for short PUT requests

This is already how curl is documented to behave in Everything curl, but
in actuality only short POSTs skip this. This should knock 30 seconds
off a full run of the test suite since the 100-continue timeout will no
longer be hit.

Closes #10740

2 years agotests: add DELAY keyword to more tests using waits
Dan Fandrich [Fri, 10 Mar 2023 20:01:01 +0000 (12:01 -0800)] 
tests: add DELAY keyword to more tests using waits

2 years agotests: hack to build most unit tests under cmake
Dan Fandrich [Thu, 9 Mar 2023 21:17:44 +0000 (13:17 -0800)] 
tests: hack to build most unit tests under cmake

These are only built when a libcurl static library is available, since
we're not building a special libcurlu library yet and these tests rely
on private symbols that aren't available in the shared library. A few
unit tests do require libcurlu, so those are not built.

Closes #10722

2 years agotests: fix MSVC unreachable code warnings in unit tests
Dan Fandrich [Thu, 9 Mar 2023 22:53:57 +0000 (14:53 -0800)] 
tests: fix MSVC unreachable code warnings in unit tests

Switch unit1654 to use the proper test macros as well.

2 years agotests: make CPPFLAGS common to all unit tests
Dan Fandrich [Thu, 9 Mar 2023 20:28:39 +0000 (12:28 -0800)] 
tests: make CPPFLAGS common to all unit tests

There's no need to specify them individually.

2 years agotests: keep cmake unit tests names in sync
Dan Fandrich [Thu, 9 Mar 2023 20:23:14 +0000 (12:23 -0800)] 
tests: keep cmake unit tests names in sync

Put only the test names into Makefile.inc so they can be used by both
cmake and automake. This will prevent the list of tests from becoming
out of date when they are also built under cmake.

2 years agosrc: silence wmain() warning for all build methods
Viktor Szakats [Sat, 11 Mar 2023 15:21:43 +0000 (15:21 +0000)] 
src: silence wmain() warning for all build methods

llvm/clang and gcc doesn't recognize the wmain() function in Unicode
Windows builds:

llvm/clang:
```
../../src/tool_main.c:239:5: warning: no previous prototype for function 'wmain' [-Wmissing-prototypes]
int wmain(int argc, wchar_t *argv[])
    ^
1 warning generated.
```

gcc:
```
../../src/tool_main.c:239:5: warning: no previous prototype for 'wmain' [-Wmissing-prototypes]
  239 | int wmain(int argc, wchar_t *argv[])
      |     ^~~~~
```

Before this patch, we already silenced it with CMake. This patch moves
the silencing to the source, so that it applies to all build tools.

Bug: https://github.com/curl/curl/issues/7229#issuecomment-1464806651

Reviewed-by: Marcel Raad
Closes #10744

2 years agoCI: fix retrying on brew failures
Dan Fandrich [Sat, 11 Mar 2023 00:41:25 +0000 (16:41 -0800)] 
CI: fix retrying on brew failures

The previous attempt didn't consider that the shell would exit
immediately after the false statement in the retry case.

Follow-up to dc141a37

2 years agohttp2: fix error handling during parallel operations
Stefan Eissing [Thu, 9 Mar 2023 10:16:21 +0000 (11:16 +0100)] 
http2: fix error handling during parallel operations

RST and connection close were not handled correctly during parallel
transfers, leading to aborted response bodies being reported complete.

Closes #10715

2 years agourl: only reuse connections with same GSS delegation
Daniel Stenberg [Fri, 10 Mar 2023 08:22:43 +0000 (09:22 +0100)] 
url: only reuse connections with same GSS delegation

Reported-by: Harry Sintonen
Closes #10731

2 years agolib: silence clang/gcc -Wvla warnings in brotli headers
Viktor Szakats [Fri, 10 Mar 2023 22:24:24 +0000 (22:24 +0000)] 
lib: silence clang/gcc -Wvla warnings in brotli headers

brotli v1.0.0 throughout current latest v1.0.9 and latest master [1]
trigger this warning.

It happened with CMake and GNU Make. autotools builds avoid it with
the `convert -I options to -isystem` macro.

llvm/clang:
```
In file included from ./curl/lib/content_encoding.c:36:
./brotli/x64-ucrt/usr/include/brotli/decode.h:204:34: warning: variable length array used [-Wvla]
    const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./brotli/x64-ucrt/usr/include/brotli/port.h:253:34: note: expanded from macro 'BROTLI_ARRAY_PARAM'
                                 ^~~~~~
In file included from ./curl/lib/content_encoding.c:36:
./brotli/x64-ucrt/usr/include/brotli/decode.h:206:48: warning: variable length array used [-Wvla]
    uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
                           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
./brotli/x64-ucrt/usr/include/brotli/port.h:253:35: note: expanded from macro 'BROTLI_ARRAY_PARAM'
                                 ~^~~~~
```

gcc:
```
In file included from ./curl/lib/content_encoding.c:36:
./brotli/x64-ucrt/usr/include/brotli/decode.h:204:5: warning: ISO C90 forbids variable length array 'encoded_buffer' [-Wvla]
  204 |     const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
      |     ^~~~~
./brotli/x64-ucrt/usr/include/brotli/decode.h:206:5: warning: ISO C90 forbids variable length array 'decoded_buffer' [-Wvla]
  206 |     uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
      |     ^~~~~~~
```

[1] https://github.com/google/brotli/commit/ed1995b6bda19244070ab5d331111f16f67c8054

Reviewed-by: Daniel Stenberg
Reviewed-by: Marcel Raad
Closes #10738

2 years agocurl_path: create the new path with dynbuf
Daniel Stenberg [Thu, 9 Mar 2023 15:22:11 +0000 (16:22 +0100)] 
curl_path: create the new path with dynbuf

Closes #10729

2 years agourl: remove dummy protocol handler
Daniel Stenberg [Fri, 10 Mar 2023 07:39:47 +0000 (08:39 +0100)] 
url: remove dummy protocol handler

Just two added checks were needed saves a whole handler struct.

Closes #10727

2 years agoCI: retry a failed brew update too, not just brew install
Dan Fandrich [Fri, 10 Mar 2023 17:53:09 +0000 (09:53 -0800)] 
CI: retry a failed brew update too, not just brew install

Also, make sure an eventual failure ends up returning a failure code so
the job stops.

2 years agourl: fix the SSH connection reuse check
Daniel Stenberg [Fri, 10 Mar 2023 07:22:51 +0000 (08:22 +0100)] 
url: fix the SSH connection reuse check

Reported-by: Harry Sintonen
Closes #10735

2 years agoCURLOPT_PROXY.3: curl+NSS does not handle HTTPS over unix domain socket
Daniel Stenberg [Fri, 10 Mar 2023 09:35:24 +0000 (10:35 +0100)] 
CURLOPT_PROXY.3: curl+NSS does not handle HTTPS over unix domain socket

It results in error "NSS error -5985 (PR_ADDRESS_NOT_SUPPORTED_ERROR)"

Disabled test 1470 for NSS builds and documented the restriction.

Reported-by: Dan Fandrich
Fixes #10723
Closes #10734

2 years agoCURLSHOPT_SHARE.3: HSTS sharing is not thread-safe
Daniel Stenberg [Thu, 9 Mar 2023 17:01:34 +0000 (18:01 +0100)] 
CURLSHOPT_SHARE.3: HSTS sharing is not thread-safe

Reported-by: Hiroki Kurosawa
Closes #10732

2 years agotelnet: only accept option arguments in ascii
Daniel Stenberg [Mon, 6 Mar 2023 11:07:33 +0000 (12:07 +0100)] 
telnet: only accept option arguments in ascii

To avoid embedded telnet negotiation commands etc.

Reported-by: Harry Sintonen
Closes #10728

2 years agotest1903: test use of COOKIEFILE - reset - COOKIEFILE
Daniel Stenberg [Wed, 8 Mar 2023 13:31:33 +0000 (14:31 +0100)] 
test1903: test use of COOKIEFILE - reset - COOKIEFILE

This also tests for the memory leak bug fixed by parent commit b559ef6f.

Ref: #10694

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

2 years agourl: fix cookielist memleak when curl_easy_reset
Jay Satiro [Wed, 8 Mar 2023 08:42:19 +0000 (03:42 -0500)] 
url: fix cookielist memleak when curl_easy_reset

- Free set.cookelist in Curl_freeset instead of Curl_close.

Prior to this change the cookielist linked list wasn't freed by
curl_easy_reset which calls Curl_freeset to free all set.

Bug: https://github.com/curl/curl/issues/10694#issuecomment-1458619157
Reported-by: Sergey Ryabinin
Closes https://github.com/curl/curl/pull/10709

2 years agotests: fix some keywords and unused sections
Dan Fandrich [Fri, 10 Mar 2023 07:22:36 +0000 (23:22 -0800)] 
tests: fix some keywords and unused sections

2 years agotests: fix test1301 to call the right binary
Dan Fandrich [Fri, 10 Mar 2023 06:59:46 +0000 (22:59 -0800)] 
tests: fix test1301 to call the right binary

It was refactored in commit 480ac6e5 but this step was missed.

2 years agotests: add timeout, SLOWDOWN and DELAY keywords to tests
Dan Fandrich [Fri, 10 Mar 2023 06:46:50 +0000 (22:46 -0800)] 
tests: add timeout, SLOWDOWN and DELAY keywords to tests

These are tests that are testing timing and end up being quite slow.

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 10 Mar 2023 07:14:53 +0000 (08:14 +0100)] 
RELEASE-NOTES: synced

2 years agowolfSSL: ressurect the BIO `io_result`
Stefan Eissing [Thu, 9 Mar 2023 10:29:59 +0000 (11:29 +0100)] 
wolfSSL: ressurect the BIO `io_result`

In pytest'ing the situation occored that wolfSSL reported an
IO error when the underlying BIO operation was returning an
CURLE_AGAIN condition.

Readding the `io_result` filter context member to detect such
situations.

Also, making sure that the returned CURLcode is initialized
on all recv operations outcome.

Closes #10716

2 years agogssapi: align global `gss_OID_desc` vars to silence ld warnings on macOS ventura
Stefan Eissing [Thu, 9 Mar 2023 11:32:36 +0000 (12:32 +0100)] 
gssapi: align global `gss_OID_desc` vars to silence ld warnings on macOS ventura

Refs #9975 which first reported this.

Closes #10718

2 years agolibssh2: only set the memory callbacks when debugging
Daniel Stenberg [Thu, 9 Mar 2023 14:58:02 +0000 (15:58 +0100)] 
libssh2: only set the memory callbacks when debugging

This makes us debug libssh2 less and libcurl more when for example
running torture tests that otherwise will spend a lot of time in libssh2
functions.

We leave libssh2 to test libssh2.

Closes #10721

2 years agodocs/SECURITY-PROCESS.md: updates
Daniel Stenberg [Thu, 9 Mar 2023 12:39:23 +0000 (13:39 +0100)] 
docs/SECURITY-PROCESS.md: updates

- allow Low+Medium issues to be managed through plain PRs
- update the bug-bounty part to reflect current reality

Closes #10719

2 years agotests: fix tag markup issues in some tests
Dan Fandrich [Thu, 9 Mar 2023 18:24:35 +0000 (10:24 -0800)] 
tests: fix tag markup issues in some tests

2 years agotests: add `cookies` features
Marcel Raad [Thu, 9 Mar 2023 10:29:56 +0000 (11:29 +0100)] 
tests: add `cookies` features

These tests don't work with `--disable-cookies`.

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

2 years agotest420: add cookies keyword
Marcel Raad [Wed, 8 Mar 2023 17:00:05 +0000 (18:00 +0100)] 
test420: add cookies keyword

It fails with `--disable-cookies`.

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

2 years agoCI: Add more labeler match patterns
Dan Fandrich [Thu, 9 Mar 2023 00:43:38 +0000 (16:43 -0800)] 
CI: Add more labeler match patterns

Also, add the  CI, tests or libcurl API tags in conjunction with any
others that might also apply.

2 years agoGHA: minor improvements to spellcheck
andy5995 [Tue, 28 Feb 2023 07:57:00 +0000 (01:57 -0600)] 
GHA: minor improvements to spellcheck

Closes #10640

2 years agotest1671: fix after fix
Daniel Stenberg [Wed, 8 Mar 2023 08:08:37 +0000 (09:08 +0100)] 
test1671: fix after fix

2 years agotest421: -w %{header_json} test with multiple same header names
Daniel Stenberg [Tue, 7 Mar 2023 23:32:37 +0000 (00:32 +0100)] 
test421: -w %{header_json} test with multiple same header names

To reproduce the issue in #10704

2 years agotool_writeout_json. fix the output for duplicate header names
Daniel Stenberg [Tue, 7 Mar 2023 23:35:23 +0000 (00:35 +0100)] 
tool_writeout_json. fix the output for duplicate header names

Header entries with index != 0 are handled at the index 0 level so they
should then be skipped when iterated over.

Reported-by: Boris Okunskiy
Fixes #10704
Closes #10707

2 years agoheaders: make curl_easy_header and nextheader return different buffers
Daniel Stenberg [Tue, 7 Mar 2023 23:33:33 +0000 (00:33 +0100)] 
headers: make curl_easy_header and nextheader return different buffers

By letting curl_easy_header() and curl_easy_nextheader() store the
header data in their own struct storage when they return a pointer to
it, it makes it possible for applications to use them both in a loop.
Like the curl tool does.

Reported-by: Boris Okunskiy
Fixes #10704
Closes #10707

2 years agourlapi: take const args in _dup and _get functions
rcombs [Wed, 8 Mar 2023 08:18:39 +0000 (02:18 -0600)] 
urlapi: take const args in _dup and _get functions

Closes #10708

2 years agourlapi: avoid mutating internals in getter routine
rcombs [Wed, 8 Mar 2023 08:12:25 +0000 (02:12 -0600)] 
urlapi: avoid mutating internals in getter routine

This was not intended.

Closes #10708

2 years agourlapi: '%' is illegal in host names
Daniel Stenberg [Wed, 8 Mar 2023 12:49:09 +0000 (13:49 +0100)] 
urlapi: '%' is illegal in host names

Update test 1560 to verify

Ref: #10708
Closes #10711

2 years agoftp: make the 'ftpauth' a more normal 'char *'-array
Daniel Stenberg [Tue, 7 Mar 2023 14:19:09 +0000 (15:19 +0100)] 
ftp: make the 'ftpauth' a more normal 'char *'-array

Closes #10703

2 years agodoc: fix compiler warning in libcurl.m4
Evgeny Grin (Karlson2k) [Tue, 7 Mar 2023 18:37:12 +0000 (21:37 +0300)] 
doc: fix compiler warning in libcurl.m4

Current test for curl_free() may produce warnings with strict compiler
flags or even with default compiler flags with upcoming versions.
These warning could turned into errors by -Werror or similar flags.
Such warnings/errors are avoided by this patch.

Closes #10710

2 years agomisc: fix typos
Viktor Szakats [Wed, 8 Mar 2023 08:00:35 +0000 (08:00 +0000)] 
misc: fix typos

Closes #10706

2 years agoftp: active mode with SSL, add the damn filter
Stefan Eissing [Fri, 3 Mar 2023 14:15:31 +0000 (15:15 +0100)] 
ftp: active mode with SSL, add the damn filter

- since 7.87.0 we lost adding the SSL filter for an active
  FTP connection that uses SSL. This leads to hangers and timeouts
  as reported in #10666.

Reported-by: SandakovMM on github
Fixes #10666
Closes #10669

2 years agodocs: extend the URL API descriptions
Daniel Stenberg [Tue, 7 Mar 2023 10:01:15 +0000 (11:01 +0100)] 
docs: extend the URL API descriptions

Closes #10701

2 years agourl: fix logic in connection reuse to deny reuse on "unclean" connections
Stefan Eissing [Mon, 6 Mar 2023 11:44:45 +0000 (12:44 +0100)] 
url: fix logic in connection reuse to deny reuse on "unclean" connections

- add parameter to `conn_is_alive()` cfilter method that returns
  if there is input data waiting on the connection
- refrain from re-using connnection from the cache that have
  input pending
- adapt http/2 and http/3 alive checks to digest pending input
  to check the connection state
- remove check_cxn method from openssl as that was just doing
  what the socket filter now does.
- add tests for connection reuse with special server configs

Closes #10690

2 years agox509asn1: use plain %x, not %lx, when the arg is an int
Daniel Stenberg [Mon, 6 Mar 2023 10:32:55 +0000 (11:32 +0100)] 
x509asn1: use plain %x, not %lx, when the arg is an int

Pointed out by Coverity.

Closes #10689

2 years agohttp2: fix handling of RST and GOAWAY to recognize partial transfers
Stefan Eissing [Mon, 6 Mar 2023 16:16:01 +0000 (17:16 +0100)] 
http2: fix handling of RST and GOAWAY to recognize partial transfers

- a reset transfer (HTTP/2 RST) did not always lead to the proper
  error message on receiving its response, leading to wrong reports
  of a successful transfer
- test_05_02 was able to trigger this condition with increased transfer
  count. The simulated response errors did not carry a 'Content-Length'
  so only proper RST handling could detect the abort
- When doing such transfers in parallel, a connection could enter the
  state where
  a) it had been closed (GOAWAY received)
  b) the RST had not been "seen" for the transfer yet
  or c) the GOAWAY announced an error and the last successful
  stream id was not checked against ongoing transfers

Closes #10693

2 years agotests: use dynamic ports numbers in pytest suite
Stefan Eissing [Mon, 6 Mar 2023 15:11:11 +0000 (16:11 +0100)] 
tests: use dynamic ports numbers in pytest suite

- necessary ports are bound at start of test suite and then
  given to server fixtures for use.
- this make parallel use of pytest (in separate directories),
  practically safe for use as OS tend to not reuse such port numbers
  for a while

Closes #10692

2 years agoconnect: fix time_connect and time_appconnect timer statistics
Stefan Eissing [Fri, 3 Mar 2023 16:54:44 +0000 (17:54 +0100)] 
connect: fix time_connect and time_appconnect timer statistics

- time_connect was not updated when the overall connection failed,
  e.g. when SSL verification was unsuccessful, refs #10670
- rework gather those values to interrogate involved filters,
  also from all eyeballing attempts, to report the maximum of
  those values.
- added 3 test cases in test_06 to check reported values on
  successful, partially failed and totally failed connections.

Reported-by: Master Inspire
Fixes #10670
Closes #10671

2 years agotest1905: update output cookie order
Daniel Stenberg [Mon, 6 Mar 2023 07:19:35 +0000 (08:19 +0100)] 
test1905: update output cookie order

After the #10685 update

2 years agotest420: verify expiring cookies
Daniel Stenberg [Sun, 5 Mar 2023 23:19:35 +0000 (00:19 +0100)] 
test420: verify expiring cookies

Cookies that are loaded fine from a jar but then are expired in headers.

2 years agocookie: don't load cookies again when flushing
Daniel Stenberg [Sun, 5 Mar 2023 23:18:41 +0000 (00:18 +0100)] 
cookie: don't load cookies again when flushing

Reported-by: Sergio Mijatovic
Fixes #10677
Closes #10685

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 6 Mar 2023 14:48:54 +0000 (15:48 +0100)] 
RELEASE-NOTES: synced

2 years agodocs: note '--data-urlencode' option
andy5995 [Mon, 6 Mar 2023 07:00:38 +0000 (01:00 -0600)] 
docs: note '--data-urlencode' option

Closes #10687

2 years agoDEPRECATE: the original legacy mingw version 1
Daniel Stenberg [Fri, 3 Mar 2023 13:49:21 +0000 (14:49 +0100)] 
DEPRECATE: the original legacy mingw version 1

Remove completely in September 2023

Closes #10667

2 years agorand: use arc4random as fallback when available
Harry Sintonen [Sat, 4 Mar 2023 07:02:14 +0000 (09:02 +0200)] 
rand: use arc4random as fallback when available

Normally curl uses cryptographically strong random provided by the
selected SSL backend. If compiled without SSL support, a naive built-in
function was used instead.

Generally this was okay, but it will result in some downsides for non-
SSL builds, such as predictable temporary file names.

This change ensures that arc4random will be used instead, if available.

Closes #10672

2 years agotool: dump headers even if file is write-only
Grisha Levit [Sat, 4 Mar 2023 21:32:56 +0000 (16:32 -0500)] 
tool: dump headers even if file is write-only

The fixes in #10079 brought a (seemingly unrelated) change of open mode
from `wb`/`ab` to `wb+`/`ab+` for the headerfile. This makes it no
longer possible to write the header file to e.g. a pipe, like:

    curl -D >(grep ...) file:///dev/null

Which presently results in `Warning: Failed to open /dev/fd/63`

See #10079
Closes #10675

2 years agotests: fix gnutls-serv check
Jay Satiro [Mon, 6 Mar 2023 08:47:16 +0000 (03:47 -0500)] 
tests: fix gnutls-serv check

- If gnutls-serv doesn't exist then don't try to execute it.

Follow-up to 2fdc1d81.

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

2 years agolib1560: fix enumerated type mixed with another type
Daniel Stenberg [Sun, 5 Mar 2023 23:09:19 +0000 (00:09 +0100)] 
lib1560: fix enumerated type mixed with another type

Follow-up to c84c0f9aa3bb006

Closes #10684

2 years agocmake: fix enabling LDAPS on Windows
Viktor Szakats [Sun, 5 Mar 2023 19:55:14 +0000 (19:55 +0000)] 
cmake: fix enabling LDAPS on Windows

Before this patch, enabling LDAPS required a manual C flag:
https://github.com/curl/curl-for-win/blob/c1cfc31cfc04f24f7a4f946564d6f0e1b4d7dd36/curl-cmake.sh#L105

Fix this and enable LDAPS automatically when using `wldap32` (and
when not explicitly disabled). This matches autotools and `Makefile.mk`
behavior. Also remove issue from KNOWN_BUGS.

Add workaround for MSVS 2010 warning triggered by LDAPS now enabled
in more CI tests:
`ldap.c(360): warning C4306: 'type cast' : conversion from 'int' to 'void *' of greater size`
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/46408284/job/v8mwl9yfbmoeqwlr#L312

Reported-by: JackBoosY on github
Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Fixes #6284
Closes #10674

2 years agoMakefile.mk: delete redundant `HAVE_LDAP_SSL` macro [ci skip]
Viktor Szakats [Sun, 5 Mar 2023 19:52:21 +0000 (19:52 +0000)] 
Makefile.mk: delete redundant `HAVE_LDAP_SSL` macro [ci skip]

Since abebb2b8939c6b3e0f951eb2d9ec3729b569aa2c, we set this macro for
all Windows `wldap32` builds using `Makefile.mk`.

For OpenLDAP builds this macro is not enough to enable LDAPS, and
OpenLDAP is not an option in `Makefile.mk`. For Novell LDAP it might
have helped, but it's also not an option anymore in `Makefile.mk`.

The future for LDAPS is that we should enable it by default without
extra build knobs.

Reviewed-by: Marcel Raad
Closes #10681

2 years agocmake: skip CA-path/bundle auto-detection in cross-builds
Viktor Szakats [Sun, 5 Mar 2023 19:51:52 +0000 (19:51 +0000)] 
cmake: skip CA-path/bundle auto-detection in cross-builds

Also remove issue from KNOWN_BUGS.

Reported-by: Cristian Morales Vega
Reviewed-by: Marcel Raad
Fixes #6178
Closes #10676

2 years agoschannel: loop over the algos to pick the selected one
Daniel Stenberg [Wed, 1 Mar 2023 08:59:21 +0000 (09:59 +0100)] 
schannel: loop over the algos to pick the selected one

Avoid using the funny macro and the extra buffer copy.

Closes #10647

2 years agowildcard: remove files and move functions into ftplistparser.c
Daniel Stenberg [Tue, 28 Feb 2023 08:22:46 +0000 (09:22 +0100)] 
wildcard: remove files and move functions into ftplistparser.c

2 years agoftp: allocate the wildcard struct on demand
Daniel Stenberg [Mon, 27 Feb 2023 22:57:23 +0000 (23:57 +0100)] 
ftp: allocate the wildcard struct on demand

The feature is rarely used so this frees up data for the vast majority
of easy handles that don't use it.

Rename "protdata" to "ftpwc" since it is always an FTP wildcard struct
pointer. Made the state struct field an unsigned char to save space.

Closes #10639

2 years agolib1560: test parsing URLs with ridiculously large fields
Daniel Stenberg [Fri, 3 Mar 2023 07:32:45 +0000 (08:32 +0100)] 
lib1560: test parsing URLs with ridiculously large fields

In the order of 120K.

Closes #10665

2 years agourlapi: parse IPv6 literals without ENABLE_IPV6
Brad Spencer [Fri, 17 Feb 2023 20:01:05 +0000 (16:01 -0400)] 
urlapi: parse IPv6 literals without ENABLE_IPV6

This makes the URL parser API stable and working the same way
independently of libcurl supporting IPv6 transfers or not.

Closes #10660

2 years agobuild: drop the use of XC_AMEND_DISTCLEAN
Jan Engelhardt [Thu, 2 Mar 2023 15:08:22 +0000 (16:08 +0100)] 
build: drop the use of XC_AMEND_DISTCLEAN

Because automake used to delete depdirs at once (.deps) and there was an issue
with portability, curl's XC_AMEND_DISTCLEAN greps the Makefiles in an attempt
to build a list of all depfiles and delete them individually instead.

Since commit 08849db866b44510f6b8fd49e313c91a43a3dfd3, automake switched from
deleting directories to individual files. curl's custom logic now finds a lot
more results with the grep (the filtering of these results isn't great), which
causes a massive bloating of the Makefile in the order of O(n^2).

Also remove now-unused XC_AMEND_DISTCLEAN macro group

References: https://github.com/curl/curl/issues/9843
References: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59288

Reported-by: Ilmari Lauhakangas
Fixes #9843
Closes #10661

2 years agotest1470: test socks proxy using unix sockets and connect to https
Balakrishnan Balasubramanian [Thu, 2 Mar 2023 17:16:13 +0000 (12:16 -0500)] 
test1470: test socks proxy using unix sockets and connect to https

Similar to test1468 except using https instead of http

Closes #10662

2 years agotest1960: verify CURL_SOCKOPT_ALREADY_CONNECTED
Daniel Stenberg [Wed, 1 Mar 2023 10:39:17 +0000 (11:39 +0100)] 
test1960: verify CURL_SOCKOPT_ALREADY_CONNECTED

When returned from the CURLOPT_SOCKOPTFUNCTION, like when we have a
custom socket connected in the app, passed in to libcurl.

Verifies the fix in #10648

Closes #10651

2 years agotests: rename tests/tests-httpd to tests/http
Stefan Eissing [Wed, 1 Mar 2023 15:55:31 +0000 (16:55 +0100)] 
tests: rename tests/tests-httpd to tests/http

 - httpd is only one server we test with
 - the suite coveres the HTTP protocol in general where
   the default test cases need a more beefy environment

Closes #10654

2 years agosocket: detect "dead" connections better, e.g. not fit for reuse
Stefan Eissing [Wed, 1 Mar 2023 12:05:09 +0000 (13:05 +0100)] 
socket: detect "dead" connections better, e.g. not fit for reuse

- refs #10646 where reuse was attempted on closed connections in the
  cache, leading to an exhaustion of retries on a transfer
- the mistake was that poll events like POLLHUP, POLLERR, etc
  were regarded as "not dead".
- change cf-socket filter check to regard such events as inidication
  of corpsiness.
- vtls filter checks: fixed interpretation of backend check result
  when inconclusive to interrogate status further down the filter
  chain.

Reported-by: SendSonS on github
Fixes #10646
Closes #10652

2 years agolib: give source files cf-http.* better fitting names
Stefan Eissing [Wed, 1 Mar 2023 15:40:22 +0000 (16:40 +0100)] 
lib: give source files cf-http.* better fitting names

Closes #10656

2 years agohttp2: fix code indent
Stefan Eissing [Wed, 1 Mar 2023 15:18:12 +0000 (16:18 +0100)] 
http2: fix code indent

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

2 years agocf-socket: if socket is already connected, return CURLE_OK
Shankar Jadhavar [Wed, 1 Mar 2023 09:02:08 +0000 (14:32 +0530)] 
cf-socket: if socket is already connected, return CURLE_OK

In 7.87.0, if callback method for CURLOPT_SOCKOPTFUNCTION returns
CURL_SOCKOPT_ALREADY_CONNECTED then curl library used to return
CURLE_OK.  n 7.88.0, now even if callback returns
CURL_SOCKOPT_ALREADY_CONNECTED, curl library still tries to connect to
socket by invoking method do_connect().

This is regression caused by commit
https://github.com/curl/curl/commit/71b7e0161032927cdfb

Fix: Check if we are already connected and return CURLE_OK.

Fixes #10626
Closes #10648

2 years agoDYNBUF.md: note Curl_dyn_add* calls Curl_dyn_free on failure
Jay Satiro [Wed, 1 Mar 2023 03:45:28 +0000 (22:45 -0500)] 
DYNBUF.md: note Curl_dyn_add* calls Curl_dyn_free on failure

This is the existing behavior and it has been widely assumed in the
codebase.

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

2 years agohttp2: fix upload busy loop
Stefan Eissing [Thu, 9 Feb 2023 09:16:50 +0000 (10:16 +0100)] 
http2: fix upload busy loop

- Set KEEP_SEND_PAUSE when exhausting remote HTTP/2 window size of a
  stream.

- Clear KEEP_SEND_PAUSE when receiving HTTP/2 window updates on a paused
  stream.

- Also fix http2 send compiler warnings reported in #10449.

Prior to this change, starting in 71b7e016 which precedes 7.88.0,
libcurl may eat CPU during HTTP/2 upload.

Reported-by: Jay Satiro
Fixes https://github.com/curl/curl/issues/10449
Fixes https://github.com/curl/curl/issues/10618
Closes https://github.com/curl/curl/pull/10627

2 years agosectransp: make read_cert() use a dynbuf when loading
Daniel Stenberg [Mon, 27 Feb 2023 19:36:22 +0000 (20:36 +0100)] 
sectransp: make read_cert() use a dynbuf when loading

Closes #10632