]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 years agourlapi: skip path checks if path is just "/"
Daniel Stenberg [Wed, 1 Feb 2023 07:26:08 +0000 (08:26 +0100)] 
urlapi: skip path checks if path is just "/"

As a miniscule optimization, treat a path of the length 1 as the same as
non-existing, as it can only be a single leading slash, and that's what
we do for no paths as well.

Closes #10385

2 years agoGHA/macos: use Xcode_14.0.1 for cmake builds
Philip H [Tue, 31 Jan 2023 14:57:41 +0000 (15:57 +0100)] 
GHA/macos: use Xcode_14.0.1 for cmake builds

Fixes #10356
Closes #10381

2 years agotls: fixes for wolfssl + openssl combo builds
Viktor Szakats [Wed, 1 Feb 2023 09:44:57 +0000 (09:44 +0000)] 
tls: fixes for wolfssl + openssl combo builds

1. Add `USE_WOLFSSL` to the TLS backend priority list in
   `lib/curl_ntlm_core.c`.

2. Fix `lib/curl_ntlm_core.h` to respect TLS backend priority, bringing
   it in sync with the above list and `lib/curl_ntlm_core.c` itself.

Reported-by: Mark Roszko
   Ref: https://github.com/curl/curl/issues/10321

3. Allow enabling both wolfSSL and OpenSSL at the same time in
   `lib/Makefile.mk` bringing this in line with cmake/autotools builds.
   Update logic to select the crypto-specific lib for `ngtcp2`, which
   supports a single TLS backend at the same time.

Closes #10322

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 1 Feb 2023 07:08:07 +0000 (08:08 +0100)] 
RELEASE-NOTES: synced

2 years agodocs/INSTALL: document how to use multiple TLS backends
Daniel Stenberg [Tue, 31 Jan 2023 22:29:23 +0000 (23:29 +0100)] 
docs/INSTALL: document how to use multiple TLS backends

And document how OpenSSL forks and wolfSSL cannot be used at the same
time.

Reported-by: Mark Roszko
Fixes #10321
Closes #10382

2 years agocookies: fp is always not NULL
Kvarec Lezki [Wed, 1 Feb 2023 06:00:03 +0000 (11:00 +0500)] 
cookies: fp is always not NULL

Closes #10383

2 years agoescape: use table lookup when adding %-codes to output
Daniel Stenberg [Tue, 31 Jan 2023 11:34:08 +0000 (12:34 +0100)] 
escape: use table lookup when adding %-codes to output

On my dev host, this code runs 7.8 times faster.

Closes #10377

2 years agounit2600: avoid error: ‘TEST_CASES’ defined but not used
Daniel Stenberg [Tue, 31 Jan 2023 13:41:15 +0000 (14:41 +0100)] 
unit2600: avoid error: ‘TEST_CASES’ defined but not used

Follow-up to d55de24dce9d51

Closes #10379

2 years agoescape: hex decode with a lookup-table
Daniel Stenberg [Tue, 31 Jan 2023 08:36:07 +0000 (09:36 +0100)] 
escape: hex decode with a lookup-table

Makes the decoding 2.8 times faster in my tests.

Closes #10376

2 years agocf-socket: fix build error wo TCP_FASTOPEN_CONNECT
Daniel Stenberg [Tue, 31 Jan 2023 12:48:30 +0000 (13:48 +0100)] 
cf-socket: fix build error wo TCP_FASTOPEN_CONNECT

Follow-up to 5651a36d1a

Closes #10378

Reviewed-by: Stefan Eissing
2 years agoCI: add pytest github workflow to CI test/tests-httpd on a HTTP/3 setup
Stefan Eissing [Wed, 18 Jan 2023 10:11:41 +0000 (11:11 +0100)] 
CI: add pytest github workflow to CI test/tests-httpd on a HTTP/3 setup

Closes #10317

2 years agoconnect: fix strategy testing for attempts, timeouts and happy-eyeball
Stefan Eissing [Tue, 17 Jan 2023 14:58:49 +0000 (15:58 +0100)] 
connect: fix strategy testing for attempts, timeouts and happy-eyeball

- add test2600 as a unit test that triggers various connect conditions
  and monitors behaviour, available in a debug build only.

- this exposed edge cases in connect.c that have been fixed

Closes #10312

2 years agocf-socket: improvements in socket I/O handling
Stefan Eissing [Mon, 30 Jan 2023 15:03:00 +0000 (16:03 +0100)] 
cf-socket: improvements in socket I/O handling

- Curl_write_plain/Curl_read_plain have been eliminated. Last code use
  now uses Curl_conn_send/recv so that requests use conn->send/revc
  callbacks which defaults to cfilters use.
- Curl_recv_plain/Curl_send_plain have been internalized in cf-socket.c.
- USE_RECV_BEFORE_SEND_WORKAROUND (active on Windows) has been moved
  into cf-socket.c. The pre_recv buffer is held at the socket filter
  context.  `postponed_data` structures have been removed from
  `connectdata`.
- the hanger in HTTP/2 request handling was a result of read buffering
  on all sends and the multi handling is not prepared for this. The
  following happens:

   - multi preforms on a HTTP/2 easy handle
   - h2 reads and processes data
   - this leads to a send of h2 data
   - which receives and buffers before the send
   - h2 returns
   - multi selects on the socket, but no data arrives (its in the buffer already)
   the workaround now receives data in a loop as long as there is something in
   the buffer. The real fix would be for multi to change, so that `data_pending`
   is evaluated before deciding to wait on the socket.

io_buffer, optional, in cf-socket.c, http/2 sets state.drain if lower
filter have pending data.

This io_buffer is only available/used when the
-DUSE_RECV_BEFORE_SEND_WORKAROUND is active, e.g. on Windows
configurations. It also maintains the original checks on protocol
handler being HTTP and conn->send/recv not being replaced.

The HTTP/2 (nghttp2) cfilter now sets data->state.drain when it finds
out that the "lower" filter chain has still pending data at the end of
its IO operation. This prevents the processing from becoming stalled.

Closes #10280

2 years agoopenssl: only use CA_BLOB if verifying peer
Daniel Stenberg [Sun, 29 Jan 2023 10:32:33 +0000 (11:32 +0100)] 
openssl: only use CA_BLOB if verifying peer

Reported-by: Paul Groke
Bug: https://curl.se/mail/lib-2023-01/0070.html
Fixes #10351
Closes #10359

2 years agocurl_free.3: fix return type of `curl_free`
Thomas1664 on github [Mon, 30 Jan 2023 22:51:32 +0000 (23:51 +0100)] 
curl_free.3: fix return type of `curl_free`

Fixes #10373
Closes #10374

2 years agozuul: stop using this CI service
Daniel Stenberg [Mon, 30 Jan 2023 10:38:50 +0000 (11:38 +0100)] 
zuul: stop using this CI service

The important jobs have already transitioned. The remaining ones we can
skip for now.

Closes #10368

2 years agocopyright: remove "m4/ax_compile_check_sizeof.m4" from skips
Daniel Stenberg [Mon, 30 Jan 2023 10:47:07 +0000 (11:47 +0100)] 
copyright: remove "m4/ax_compile_check_sizeof.m4" from skips

and report if skipped files do not exist.

Follow-up to 9e11c2791fb960758 which removed the file.

Closes #10369

2 years agows: unstick connect-only shutdown
Daniel Stenberg [Mon, 30 Jan 2023 08:35:39 +0000 (09:35 +0100)] 
ws: unstick connect-only shutdown

As this mode uses blocking sockets, it must set them back to
non-blocking in disconnect to avoid the risk of getting stuck.

Closes #10366

2 years agows: remove bad assert
Daniel Stenberg [Mon, 30 Jan 2023 08:35:23 +0000 (09:35 +0100)] 
ws: remove bad assert

Reported-by: Stanley Wucw
Fixes #10347
Closes #10366

2 years agoopenssl: adapt to boringssl's error code type
Daniel Stenberg [Sun, 29 Jan 2023 11:26:18 +0000 (12:26 +0100)] 
openssl: adapt to boringssl's error code type

BoringSSL uses uint32_t, OpenSSL uses 'unsigned 'long'

Closes #10360

2 years agotool_operate: repair --rate
Daniel Stenberg [Sun, 29 Jan 2023 09:59:56 +0000 (10:59 +0100)] 
tool_operate: repair --rate

Regression from a55256cfb242 (7.87.0)
Reported-by: highmtworks on github
Fixes #10357
Closes #10358

2 years agodict: URL decode the entire path always
Daniel Stenberg [Sat, 28 Jan 2023 21:05:11 +0000 (22:05 +0100)] 
dict: URL decode the entire path always

Reported-by: dekerser on github
Fixes #10298
Closes #10354

2 years agovtls: do not null-check when we already assume cf-ctx exists
Stefan Eissing [Sun, 29 Jan 2023 13:10:20 +0000 (14:10 +0100)] 
vtls: do not null-check when we already assume cf-ctx exists

Fixes #10361
Closes #10362

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 29 Jan 2023 09:44:11 +0000 (10:44 +0100)] 
RELEASE-NOTES: synced

2 years agoCURLOPT_READFUNCTION.3: the callback 'size' arg is always 1
Daniel Stenberg [Sat, 28 Jan 2023 22:40:59 +0000 (23:40 +0100)] 
CURLOPT_READFUNCTION.3: the callback 'size' arg is always 1

Reported-by: Brian Green
Fixes #10328
Closes #10355

2 years agocopyright.pl: cease doing year verifications
Daniel Stenberg [Sat, 28 Jan 2023 10:22:35 +0000 (11:22 +0100)] 
copyright.pl: cease doing year verifications

As we have (mostly) removed the copyright year ranges.

Reported-by: Ryan Schmidt
Fixes #10345
Closes #10352

2 years agoCI: Work around a labeler bug that removes labels
Dan Fandrich [Sun, 29 Jan 2023 03:48:02 +0000 (19:48 -0800)] 
CI: Work around a labeler bug that removes labels

2 years agowrite-out.d: clarify Windows % symbol escaping
Jay Satiro [Mon, 23 Jan 2023 08:44:16 +0000 (03:44 -0500)] 
write-out.d: clarify Windows % symbol escaping

- Clarify that in Windows batch files the % must be escaped as %%, and
  at the command prompt it cannot be escaped which could lead to
  incorrect expansion.

Prior to this change the doc implied % must be escaped as %% in win32
always.

---

Examples showing how a write-out argument is received by curl:

If curl --write-out "%{http_code}" is executed in a batch file:
{http_code}

If curl --write-out "%%{http_code}" is executed in a batch file:
%{http_code}

If curl --write-out "%{http_code}" is executed from the command prompt:
%{http_code}

If curl --write-out "%%{http_code}" is executed from the command prompt:
%%{http_code}

At the command prompt something like "%{speed_download}%{http_code}"
would first be parsed by the command interpreter as %{speed_download}%
and would be expanded as environment variable {speed_download} if it
existed, though that's highly unlikely since Windows environment names
don't use braces.

---

Reported-by: Muhammad Hussein Ammari
Ref: https://github.com/bagder/everything-curl/pull/279

Fixes https://github.com/curl/curl/issues/10323
Closes https://github.com/curl/curl/pull/10337

2 years agoconnect: Fix build when not ENABLE_IPV6
Ryan Schmidt [Thu, 26 Jan 2023 01:30:23 +0000 (19:30 -0600)] 
connect: Fix build when not ENABLE_IPV6

Check for ENABLE_IPV6 before accessing AF_INET6. Fixes build failure
introduced in 1c5d8ac.

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

2 years agocf-socket: Fix build when not HAVE_GETPEERNAME
Ryan Schmidt [Thu, 26 Jan 2023 01:05:02 +0000 (19:05 -0600)] 
cf-socket: Fix build when not HAVE_GETPEERNAME

Remove remaining references to conn and sockfd, which were removed from
the function signature when conninfo_remote was renamed to
conn_set_primary_ip in 6a8d7ef.

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

2 years agovtls: Manage current easy handle in nested cfilter calls
Stefan Eissing [Mon, 23 Jan 2023 10:41:23 +0000 (11:41 +0100)] 
vtls: Manage current easy handle in nested cfilter calls

The previous implementation cleared `data` so the outer invocation lost
its data, which could lead to a crash.

Bug: https://github.com/curl/curl/issues/10336
Reported-by: Fujii Hironori
Closes https://github.com/curl/curl/pull/10340

2 years agoCI: Add even more paths to the labeler config (#10326)
Dan Fandrich [Thu, 26 Jan 2023 02:06:11 +0000 (18:06 -0800)] 
CI: Add even more paths to the labeler config (#10326)

2 years agoscripts: Fix Appveyor job detection in cijobs.pl
Dan Fandrich [Wed, 25 Jan 2023 23:30:59 +0000 (15:30 -0800)] 
scripts: Fix Appveyor job detection in cijobs.pl

The reorganization in #9769 broke the script. This should probably be
rewritten to use a YAML parser for better upward compatibility.

2 years agoCI: Add a few more paths to the labeler config (#10326)
Dan Fandrich [Wed, 25 Jan 2023 23:02:36 +0000 (15:02 -0800)] 
CI: Add a few more paths to the labeler config (#10326)

2 years agoCI: Switch the labeler event to pull_request_target
Dan Fandrich [Wed, 25 Jan 2023 18:42:17 +0000 (10:42 -0800)] 
CI: Switch the labeler event to pull_request_target

Otherwise, the action won't work on PRs from forked repositories
(#10326).

2 years agocmake: delete redundant macro definition `SECURITY_WIN32`
Viktor Szakats [Wed, 25 Jan 2023 11:55:57 +0000 (11:55 +0000)] 
cmake: delete redundant macro definition `SECURITY_WIN32`

Stop explicitly defining `SECURITY_WIN32` in CMake builds.

No other build systems define this macro, because it's unconditionally
defined in `lib/curl_sspi.h` already. This is the only curl source using
the `sspi.h` and `security.h` Win32 headers, and no other Win32 headers
need this macro.

Reviewed-by: Jay Satiro
Closes #10341

2 years agowinbuild: document that arm64 is supported
Fredrik [Sun, 22 Jan 2023 16:59:03 +0000 (17:59 +0100)] 
winbuild: document that arm64 is supported

Building an arm64 version works flawlessly with the VS arm64 toolset.

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

2 years agoopenssl: don't log raw record headers
Cherish98 [Sun, 15 Jan 2023 18:15:23 +0000 (18:15 +0000)] 
openssl: don't log raw record headers

- Skip content type SSL3_RT_HEADER in verbose TLS output.

This commit prevents bogus and misleading verbose TLS header messages as
discussed in #10299.

Assisted-by: Peter Wu
Closes https://github.com/curl/curl/pull/10299

2 years agocmake: use list APPEND syntax for CMAKE_REQUIRED_DEFINITIONS
Marc Aldorasi [Mon, 9 Jan 2023 21:38:28 +0000 (16:38 -0500)] 
cmake: use list APPEND syntax for CMAKE_REQUIRED_DEFINITIONS

- Use list() instead of set() for CMAKE_REQUIRED_DEFINITIONS list since
  the former is clearer.

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

2 years agoCI: Add a workflow to automatically label pull requests
Dan Fandrich [Fri, 20 Jan 2023 19:35:48 +0000 (11:35 -0800)] 
CI: Add a workflow to automatically label pull requests

The labeler language is quite restrictive right now so labels are added
quite conservatively, meaning that many PRs won't get labels when it's
"obvious" they should. It will still save some manual work on those
that it can label.

2 years agosystem.h: assume OS400 is always built with ILEC compiler
Jay Satiro [Fri, 20 Jan 2023 23:37:44 +0000 (18:37 -0500)] 
system.h: assume OS400 is always built with ILEC compiler

Prior to this change the OS400 types were only defined when __ILEC400__.
That symbol is only defined by IBM's C compiler and not their C++
compiler, which led to missing types when users on OS400 would compile a
C++ application that included curl.

The IBM C and C++ compilers are the only native compilers on the
platform.

Assisted-by: Jon Rumsey
Reported-by: John Sherrill
Fixes https://github.com/curl/curl/issues/10305
Closes https://github.com/curl/curl/pull/10329

2 years agocmake: Remove deprecated symbols check
xgladius [Tue, 17 Jan 2023 18:08:10 +0000 (12:08 -0600)] 
cmake: Remove deprecated symbols check

curl stopped use of CMAKE_USE_ as a prefix for its own build symbols in
2021 and added a check, meant to last 1 year, to fatally error on those
symbols. This commit removes that check.

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

2 years agodocs: POSTFIELDSIZE must be set to -1 with read function
Dan Fandrich [Tue, 17 Jan 2023 22:21:07 +0000 (14:21 -0800)] 
docs: POSTFIELDSIZE must be set to -1 with read function

Reported-by: RanBarLavie on github
Closes #10313

2 years agovtls: fix hostname handling in filters
Stefan Eissing [Tue, 17 Jan 2023 10:21:29 +0000 (11:21 +0100)] 
vtls: fix hostname handling in filters

- Copy the hostname and dispname to ssl_connect_data.

Use a copy instead of referencing the `connectdata` instance since this
may get free'ed on connection reuse.

Reported-by: Stefan Talpalaru
Reported-by: sergio-nsk@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/10273
Fixes https://github.com/curl/curl/issues/10309

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

2 years agolib: fix typos
Sergey Bronnikov [Mon, 16 Jan 2023 16:49:57 +0000 (19:49 +0300)] 
lib: fix typos

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

2 years agocurl_version_info.3: fix typo
Sergey Bronnikov [Mon, 16 Jan 2023 16:42:03 +0000 (19:42 +0300)] 
curl_version_info.3: fix typo

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

2 years agoopenssl: Don't ignore CA paths when using Windows CA store (redux)
Jay Satiro [Thu, 5 Jan 2023 23:32:27 +0000 (18:32 -0500)] 
openssl: Don't ignore CA paths when using Windows CA store (redux)

.. and remove 'experimental' designation from CURLSSLOPT_NATIVE_CA.

This commit restores the behavior of CURLSSLOPT_NATIVE_CA so that it
does not override CURLOPT_CAINFO / CURLOPT_CAPATH, or the hardcoded
default locations. Instead the native Windows CA store can be used at
the same time.

---

This behavior was originally added over two years ago in abbc5d60
(#5585) but then 83393b1a (#7892) broke it over a year ago, I assume
inadvertently.

The CURLSSLOPT_NATIVE_CA feature was marked experimental and likely
rarely used.

Ref: https://github.com/curl/curl/pull/5585
Ref: https://github.com/curl/curl/pull/7892
Ref: https://curl.se/mail/lib-2023-01/0019.html

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

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 13 Jan 2023 15:25:02 +0000 (16:25 +0100)] 
RELEASE-NOTES: synced

2 years agows: fix autoping handling
Daniel Stenberg [Fri, 13 Jan 2023 12:34:18 +0000 (13:34 +0100)] 
ws: fix autoping handling

Reported-by: Alexey Savchuk
Fixes #10289
Closes #10294

2 years agocurl_log: avoid printf() format checking with mingw
Daniel Stenberg [Fri, 13 Jan 2023 09:58:54 +0000 (10:58 +0100)] 
curl_log: avoid printf() format checking with mingw

Since it does not seem to like %zu and more

Follow-up to db91dbbf2

Fixes #10291
Closes #10292

2 years agotool_getparam: fix compiler warning when !HAVE_WRITABLE_ARGV
Daniel Stenberg [Thu, 12 Jan 2023 22:06:15 +0000 (23:06 +0100)] 
tool_getparam: fix compiler warning when !HAVE_WRITABLE_ARGV

Follow-up to 2ed0e1f70ee176edf3d2

Closes #10286

2 years agoopenssl: make the BIO_METHOD a local variable in the connection filter
Stefan Eissing [Thu, 12 Jan 2023 15:43:35 +0000 (16:43 +0100)] 
openssl: make the BIO_METHOD a local variable in the connection filter

This avoids UAF issues when `curl_global_cleanup()` is called before all
transfers have been completely handled. Unfortunately this seems to be a
more common pattern than we like.

Closes #10285

2 years agocurl: output warning at --verbose output for debug-enabled version
Daniel Stenberg [Wed, 11 Jan 2023 13:15:26 +0000 (14:15 +0100)] 
curl: output warning at --verbose output for debug-enabled version

+ a libcurl warning in the debug output

Assisted-by: Jay Satiro
Ref: https://curl.se/mail/lib-2023-01/0039.html
Closes #10278

2 years agosrc: add --http3-only 10264/head
Daniel Stenberg [Mon, 9 Jan 2023 14:00:34 +0000 (15:00 +0100)] 
src: add --http3-only

Warning: --http3 and --http3-only are subject to change again (or be
removed) before HTTP/3 support goes non-experimental.

Closes #10264

2 years agocurl.h: add CURL_HTTP_VERSION_3ONLY
Daniel Stenberg [Mon, 9 Jan 2023 13:59:27 +0000 (14:59 +0100)] 
curl.h: add CURL_HTTP_VERSION_3ONLY

As the previous CURL_HTTP_VERSION_3 option gets a slightly altered meaning.

Closes #10264

2 years agoconnect: fix access of pointer before NULL check
Daniel Stenberg [Thu, 12 Jan 2023 13:38:21 +0000 (14:38 +0100)] 
connect: fix access of pointer before NULL check

Detected by Coverity CID 1518992

Closes #10284

2 years agoeasyoptions: Fix header printing in generation script
Daniel Gustafsson [Wed, 11 Jan 2023 10:35:08 +0000 (11:35 +0100)] 
easyoptions: Fix header printing in generation script

The optiontable.pl script prints the header comment when generating
easyoptions.c, but it wasn't escaping all characters which jumbled the
curl ascii logo.  Fix by escaping.

Cloes #10275

2 years agotool_getparam: fix hiding of command line secrets
Harry Sintonen [Wed, 11 Jan 2023 10:39:33 +0000 (11:39 +0100)] 
tool_getparam: fix hiding of command line secrets

Closes #10276

2 years agotests: document the cfilter debug logging options
Stefan Eissing [Thu, 12 Jan 2023 09:46:21 +0000 (10:46 +0100)] 
tests: document the cfilter debug logging options

Closes #10283

2 years agocurl_log: for failf/infof and debug logging implementations
Stefan Eissing [Wed, 11 Jan 2023 09:30:42 +0000 (10:30 +0100)] 
curl_log: for failf/infof and debug logging implementations

 - new functions and macros for cfilter debugging
 - set CURL_DEBUG with names of cfilters where debug logging should be
   enabled
 - use GNUC __attribute__ to enable printf format checks during compile

Closes #10271

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 10 Jan 2023 12:54:29 +0000 (13:54 +0100)] 
RELEASE-NOTES: synced

2 years agomsh3: update to v0.6
Nick Banks [Sun, 8 Jan 2023 15:23:21 +0000 (15:23 +0000)] 
msh3: update to v0.6

Closes #10192

2 years agongtcp2: add CURLOPT_SSL_CTX_FUNCTION support for openssl+wolfssl
Stefan Eissing [Thu, 5 Jan 2023 16:01:42 +0000 (17:01 +0100)] 
ngtcp2: add CURLOPT_SSL_CTX_FUNCTION support for openssl+wolfssl

Using common method for SSL_CTX initialization of verfiy peer and CA
settings. This also provides X509_STORE sharing to become available for
ngtcp2+openssl HTTP/3.

Reported-by: violetlige on github
Fixes #10222
Closes #10239

2 years agocf-socket: make infof() call use %zu for size_t output
Daniel Stenberg [Tue, 10 Jan 2023 09:08:47 +0000 (10:08 +0100)] 
cf-socket: make infof() call use %zu for size_t output

Detected by Coverity CID 1518986 and CID 1518984

Closes #10268

2 years agoos400: fixes to make-lib.sh and initscript.sh
jonrumsey [Mon, 9 Jan 2023 13:22:36 +0000 (13:22 +0000)] 
os400: fixes to make-lib.sh and initscript.sh

Adjust how exports list is generated from header files to account for
declarations across multiple lines and CURL_DEPRECATED(...) tags.

Update initscript.sh

Specify qadrt_use_inline to prevent unistd.h in ASCII runtime defining
close(a) -> close_a(a)

Fixes #10266
Closes #10267

2 years agotests-httpd: basic infra to run curl against an apache httpd plus nghttpx for h3
Stefan Eissing [Mon, 9 Jan 2023 15:58:10 +0000 (16:58 +0100)] 
tests-httpd: basic infra to run curl against an apache httpd plus nghttpx for h3

- adding '--with-test-httpd=<path>' to configure non-standard apache2
  install
- python env and base classes for running httpd
- basic tests for connectivity with h1/h2/h3
- adding test cases for truncated responses in http versions.
- adding goaway test for HTTP/3.
- adding "stuttering" tests with parallel downloads in chunks with
  varying delays between chunks.

- adding a curltest module to the httpd server, adding GOAWAY test.
    - mod_curltest now installs 2 handlers
      - 'echo': writing as response body what came as request body
      - 'tweak': with query parameters to tweak response behaviour
- marked known fails as skip for now

Closes #10175

2 years agoquic: improve connect error message, debugging info, fix false connect report
Stefan Eissing [Fri, 6 Jan 2023 11:33:34 +0000 (12:33 +0100)] 
quic: improve connect error message, debugging info, fix false connect report

- ECONNECTREFUSED has not its own fail message in quic filters
- Debug logging in connect eyballing improved
- Fix bug in ngtcp2/quiche that could lead to false success reporting.

Reported-by: Divy Le Ray
Fixes #10245
Closes #10248

2 years agoquiche: fix build without any HTTP/2 implementation
Stefan Eissing [Mon, 9 Jan 2023 08:23:03 +0000 (09:23 +0100)] 
quiche: fix build without any HTTP/2 implementation

Fixes #10260
Closes #10263

2 years ago.github/workflows/linux.yml: add a quiche CI job
Daniel Stenberg [Thu, 5 Jan 2023 17:47:38 +0000 (18:47 +0100)] 
.github/workflows/linux.yml: add a quiche CI job

Move over from zuul

Closes #10241

2 years agocurl.h: allow up to 10M buffer size
Daniel Stenberg [Sat, 7 Jan 2023 15:03:40 +0000 (16:03 +0100)] 
curl.h: allow up to 10M buffer size

Bump the limit from 512K. There might be reasons for applications using
h3 to set larger buffers and there is no strong reason for curl to have
a very small maximum.

Ref: https://curl.se/mail/lib-2023-01/0026.html

Closes #10256

2 years agoGHA: use designated ngtcp2 and its dependencies versions
Tatsuhiro Tsujikawa [Sun, 8 Jan 2023 06:58:54 +0000 (15:58 +0900)] 
GHA: use designated ngtcp2 and its dependencies versions

Designate ngtcp2 and its dependency versions so that the CI build does
not fail without our control.

Closes #10257

2 years agodocs/cmdline-opts/hsts.d: explain hsts more
Daniel Stenberg [Sun, 8 Jan 2023 09:29:18 +0000 (10:29 +0100)] 
docs/cmdline-opts/hsts.d: explain hsts more

Closes #10258

2 years agomsh3: run again in its cfilter
Stefan Eissing [Mon, 2 Jan 2023 13:08:16 +0000 (14:08 +0100)] 
msh3: run again in its cfilter

- test 2500, single GET works
- test 2501, single POST stalls
- test 2502, multiple, sequential GETs each use a new connection since
  MsH3ConnectionGetState(qconn) no longer reports CONNECTED after one
  GET.

Closes #10204

2 years agosendf: fix build for Linux TCP fastopen
Jay Satiro [Fri, 6 Jan 2023 19:00:59 +0000 (14:00 -0500)] 
sendf: fix build for Linux TCP fastopen

- Fix the remote addr struct dereference.

- Include cf-socket.h in urldata.h.

Follow-up to 6a8d7ef9 which changed conn->ipaddr (Curl_addrinfo* )
member to conn->remote_addr (Curl_sockaddr_ex *) several days ago.

Reported-by: Stephan Guilloux
Fixes https://github.com/curl/curl/issues/10249
Closes https://github.com/curl/curl/pull/10250

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 7 Jan 2023 22:09:28 +0000 (23:09 +0100)] 
RELEASE-NOTES: synced

2 years agosetopt: move the SHA256 opt within #ifdef libssh2
Daniel Stenberg [Sat, 7 Jan 2023 14:49:03 +0000 (15:49 +0100)] 
setopt: move the SHA256 opt within #ifdef libssh2

Because only the libssh2 backend not supports it and thus this should
return error if this option is used other backends.

Reported-by: Harry Sintonen
Closes #10255

2 years agonss: implement data_pending method
Patrick Monnerat [Thu, 5 Jan 2023 03:22:14 +0000 (04:22 +0100)] 
nss: implement data_pending method

NSS currently uses the default Curl_none_data_pending() method which
always returns false, causing TLS buffered input data to be missed.

The current commit implements the nss_data_pending() method that properly
monitors the presence of available TLS data.

Ref:#10077

Closes #10225

2 years agoCURLOPT_HEADERDATA.3: warn DLL users must set write function
Jay Satiro [Thu, 5 Jan 2023 07:14:53 +0000 (02:14 -0500)] 
CURLOPT_HEADERDATA.3: warn DLL users must set write function

- Warn that in Windows if libcurl is running from a DLL and if
  CURLOPT_HEADERDATA is set then CURLOPT_WRITEFUNCTION or
  CURLOPT_HEADERFUNCTION must be set as well, otherwise the user may
  experience crashes.

We already have a similar warning in CURLOPT_WRITEDATA. Basically, in
Windows libcurl could crash writing a FILE pointer that was created by
a different C runtime. In Windows each DLL that is part of a program may
or may not have its own C runtime.

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

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

2 years agox509asn1: fix compile errors and warnings
jonrumsey [Thu, 5 Jan 2023 15:26:50 +0000 (15:26 +0000)] 
x509asn1: fix compile errors and warnings

Various small issues when built for GSKit

Closes #10238

2 years agoruntests: fix detection of TLS backends
Patrick Monnerat [Thu, 5 Jan 2023 16:26:50 +0000 (17:26 +0100)] 
runtests: fix detection of TLS backends

Built-in TLS backends are detected at test time by scanning for their
names in the version string line returned by the cli tool: as this line
may also list the libssh configuration that mentions its own backend,
the curl backend may be wrongly determined.

In example, if the version line contains "libssh/0.10.4/openssl/zlib",
OpenSSL is detected as a curl-configured backend even if not.

This fix requires the backend names to appear as full words preceded by
spacing in the version line to be recognized as curl TLS backends.

Closes #10236

2 years agoGHA: add job on Slackware 15.0
andy5995 [Wed, 4 Jan 2023 23:33:52 +0000 (17:33 -0600)] 
GHA: add job on Slackware 15.0

Closes #10230

2 years agotest363: make even smaller writes to loop more
Daniel Stenberg [Thu, 5 Jan 2023 12:35:53 +0000 (13:35 +0100)] 
test363: make even smaller writes to loop more

2 years agohttp_proxy: do not assign data->req.p.http use local copy
Daniel Stenberg [Thu, 5 Jan 2023 08:38:11 +0000 (09:38 +0100)] 
http_proxy: do not assign data->req.p.http use local copy

Avoid the tricky reusing of the data->req.p.http pointer for http proxy
tunneling.

Fixes #10194
Closes #10234

2 years agoquic: rename vquic implementations, fix for quiche build.
Stefan Eissing [Thu, 5 Jan 2023 18:23:21 +0000 (19:23 +0100)] 
quic: rename vquic implementations, fix for quiche build.

- quiche in debug mode did not build, fixed.
- moved all vquic implementation files to prefix curl_* to avoid
  the potential mixups between provided .h files and our own.
- quich passes test 2500 and 2502. 2501, the POST, fail with
  the body being rejected. Quich bug?

Closes #10242

2 years agosectransp: fix for incomplete read/writes
Stefan Eissing [Thu, 5 Jan 2023 10:13:17 +0000 (11:13 +0100)] 
sectransp: fix for incomplete read/writes

SecureTransport expects result code errSSLWouldBlock when the requested
length could not be sent/recieved in full. The previous code returned
noErr, which let SecureTransport to believe that the IO had terminated
prematurely.

Fixes #10227
Closes #10235

2 years agoGHA: Hacktoberfest CI: Update deprecated 'set-output' command
andy5995 [Wed, 4 Jan 2023 06:32:02 +0000 (00:32 -0600)] 
GHA: Hacktoberfest CI: Update deprecated 'set-output' command

Closes #10221

2 years agoscripts: set file mode +x on all perl and shell scripts
Jay Satiro [Tue, 3 Jan 2023 22:35:24 +0000 (17:35 -0500)] 
scripts: set file mode +x on all perl and shell scripts

- Set all scripts +x, ie 644 => 755.

Prior to this change some scripts were not executable and therefore
could not be called directly.

~~~
git ls-files -s \*.{sh,pl,py} | grep -v 100755
~~~

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

2 years agotool_operate: fix headerfile writing
Stefan Eissing [Wed, 4 Jan 2023 13:37:52 +0000 (14:37 +0100)] 
tool_operate: fix headerfile writing

Do not rely on the first transfer started to be the first to get a
response (remember -Z). All transfers now write the headefile (-D) in
append mode, making sure that the order of transfer responses does not
lead to overwrites of previous data.

Closes #10224

2 years agomisc: reduce struct and struct field sizes
Daniel Stenberg [Sun, 1 Jan 2023 10:26:22 +0000 (11:26 +0100)] 
misc: reduce struct and struct field sizes

- by using BIT() instead of bool
- imap: shrink struct
- ftp: make state 'unsigned char'
- ftp: sort ftp_conn struct entries on size
- urldata: use smaller fields for SSL version info storage
- pop3: reduce the pop3_conn struct size
- smtp: reduce the size of the smtp structs

Closes #10186

2 years agonoproxy: support for space-separated names is deprecated
Daniel Stenberg [Tue, 3 Jan 2023 13:58:37 +0000 (14:58 +0100)] 
noproxy: support for space-separated names is deprecated

To be removed in July 2024.

Assisted-by: Michael Osipov
Fixes #10209
Closes #10215

2 years agolib: fix typos in comments which repeat a word
Andrei Rybak [Wed, 4 Jan 2023 00:13:52 +0000 (01:13 +0100)] 
lib: fix typos in comments which repeat a word

Remove erroneously duplicated words in code comments of files
`lib.connect.c` and `lib/url.c`.

Closes #10220

2 years agocmake: set SOVERSION also for macOS 10406/head
Radek Brich [Tue, 3 Jan 2023 13:31:57 +0000 (14:31 +0100)] 
cmake: set SOVERSION also for macOS

Closes #10214

2 years agohttp2: fix compiler warning due to uninitialized variable
Jay Satiro [Tue, 3 Jan 2023 22:15:26 +0000 (17:15 -0500)] 
http2: fix compiler warning due to uninitialized variable

Prior to this change http2_cfilter_add could return an uninitialized
cfilter pointer in an OOM condition. In this case though, the pointer
is discarded and not dereferenced so there was no risk of a crash.

2 years agocf-socket: keep sockaddr local in the socket filters
Stefan Eissing [Tue, 3 Jan 2023 12:13:37 +0000 (13:13 +0100)] 
cf-socket: keep sockaddr local in the socket filters

- copy `struct Curl_addrinfo` on filter setup into context
- remove `struct Curl_addrinfoi *` with `struct Curl_sockaddr_ex *` in
  connectdata that is set and NULLed by the socket filter
- this means we have no reference to the resolver info in connectdata or
  its filters
- trigger the CF_CTRL_CONN_INFO_UPDATE event when the complete filter
  chain reaches connected status
- update easy handle connection information on CF_CTRL_DATA_SETUP event.

Closes #10213

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 3 Jan 2023 08:34:54 +0000 (09:34 +0100)] 
RELEASE-NOTES: synced

2 years agoruntests: consider warnings fatal and error on them
Daniel Stenberg [Mon, 2 Jan 2023 16:47:30 +0000 (17:47 +0100)] 
runtests: consider warnings fatal and error on them

To help us detect and fix warnings in this script easier and faster.

Assisted-by: Jakob Hirsch
Ref: #10206
Closes #10208

2 years agocopyright: update all copyright lines and remove year ranges
Daniel Stenberg [Mon, 2 Jan 2023 12:51:48 +0000 (13:51 +0100)] 
copyright: update all copyright lines and remove year ranges

- they are mostly pointless in all major jurisdictions
- many big corporations and projects already don't use them
- saves us from pointless churn
- git keeps history for us
- the year range is kept in COPYING

checksrc is updated to allow non-year using copyright statements

Closes #10205

2 years agodocs/DEPRECATE.md: deprecate gskit
Daniel Stenberg [Mon, 2 Jan 2023 10:43:51 +0000 (11:43 +0100)] 
docs/DEPRECATE.md: deprecate gskit

Ref: #10163

- This is a niche TLS library, only running on some IBM systems
- no regular curl contributors use this backend
- no CI builds use or verify this backend
- gskit, or the curl adaption for it, lacks many modern TLS features
  making it an inferior solution
- build breakages in this code take weeks or more to get detected
- fixing gskit code is mostly done "flying blind"

Closes #10201

2 years agoRevert "x509asn1: avoid freeing unallocated pointers"
Daniel Stenberg [Mon, 2 Jan 2023 15:42:55 +0000 (16:42 +0100)] 
Revert "x509asn1: avoid freeing unallocated pointers"

This reverts commit 6b19247e794cfdf4ec63c5880d8f4f5485f653ab.

Fixes #10163
Closes #10207

2 years agongtcp2: fix the build without 'sendmsg'
Daniel Stenberg [Mon, 2 Jan 2023 22:22:27 +0000 (23:22 +0100)] 
ngtcp2: fix the build without 'sendmsg'

Follow-up from 71b7e0161032

Closes #10210