]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 years agocurl: timeout in the read callback
Daniel Stenberg [Thu, 27 Oct 2022 11:40:06 +0000 (13:40 +0200)] 
curl: timeout in the read callback

The read callback can timeout if there's nothing to read within the
given maximum period. Example use case is when doing "curl -m 3
telnet://example.com" or anything else that expects input on stdin or
similar that otherwise would "hang" until something happens and then not
respect the timeout.

This fixes KNOWN_BUG 8.1, first filed in July 2009.

Bug: https://sourceforge.net/p/curl/bugs/846/

Closes #9815

2 years agonoproxy: fix tail-matching
Daniel Stenberg [Fri, 28 Oct 2022 08:51:49 +0000 (10:51 +0200)] 
noproxy: fix tail-matching

Also ignore trailing dots in both host name and comparison pattern.

Regression in 7.86.0 (from 1e9a538e05c0)

Extended test 1614 to verify better.

Reported-by: Henning Schild
Fixes #9821
Closes #9822

2 years agodocs: explain the noproxy CIDR notation support
Daniel Stenberg [Thu, 27 Oct 2022 22:07:14 +0000 (00:07 +0200)] 
docs: explain the noproxy CIDR notation support

Follow-up to 1e9a538e05c0107c

Closes #9818

2 years agoos400: use platform socklen_t in Curl_getnameinfo_a
jonrumsey [Thu, 27 Oct 2022 10:47:02 +0000 (11:47 +0100)] 
os400: use platform socklen_t in Curl_getnameinfo_a

Curl_getnameinfo_a() is prototyped before including curl.h as an
ASCII'fied wrapper for getnameinfo(), which itself is prototyped with
socklen_t arguments, so this should use the platform socklen_t and not
curl_socklen_t too.

Update setup-os400.h

Fixes #9811
Closes #9812

2 years agonoproxy: also match with adjacent comma
Daniel Stenberg [Thu, 27 Oct 2022 11:54:27 +0000 (13:54 +0200)] 
noproxy: also match with adjacent comma

If the host name is an IP address and the noproxy string contained that
IP address with a following comma, it would erroneously not match.

Extended test 1614 to verify this combo as well.

Reported-by: Henning Schild
Fixes #9813
Closes #9814

2 years agobuild: fix for NonStop
Randall S. Becker [Thu, 27 Oct 2022 15:04:55 +0000 (10:04 -0500)] 
build: fix for NonStop

- Include arpa/inet.h in all units where htonl is called.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Closes https://github.com/curl/curl/pull/9816

2 years agosystem.h: support 64-bit curl_off_t for NonStop 32-bit
Randall S. Becker [Thu, 27 Oct 2022 19:43:05 +0000 (14:43 -0500)] 
system.h: support 64-bit curl_off_t for NonStop 32-bit

- Correctly define curl_off_t on NonStop (ie __TANDEM) ia64 and x86 for
  32-bit builds.

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Closes https://github.com/curl/curl/pull/9817

2 years agospellcheck.words: remove 'github' as an accepted word
Daniel Stenberg [Thu, 27 Oct 2022 08:05:44 +0000 (10:05 +0200)] 
spellcheck.words: remove 'github' as an accepted word

Prefer the properly cased version: GitHub

Use markdown for links and GitHub in text.

Closes #9810

2 years agomisc: typo and grammar fixes
Ayesh Karunaratne [Wed, 26 Oct 2022 06:59:35 +0000 (12:29 +0530)] 
misc: typo and grammar fixes

- Replace `Github` with `GitHub`.
- Replace `windows` with `Windows`
- Replace `advice` with `advise` where a verb is used.
- A few fixes on removing repeated words.
- Replace `a HTTP` with `an HTTP`

Closes #9802

2 years agowindows: fix linking .rc to shared curl with autotools
Viktor Szakats [Thu, 27 Oct 2022 06:45:32 +0000 (06:45 +0000)] 
windows: fix linking .rc to shared curl with autotools

`./configure --enable-shared --disable-static` fails when trying to link
a shared `curl.exe`, due to `libtool` magically changing the output
filename of `windres` to one that it doesn't find when linking:

```
/bin/sh ../libtool --tag=RC --mode=compile windres -I../../curl/include -DCURL_EMBED_MANIFEST  -i ../../curl/src/curl.rc -o curl.o
libtool: compile:  windres -I../../curl/include -DCURL_EMBED_MANIFEST -i ../../curl/src/curl.rc  -o .libs/curl.o
[...]
CCLD     curl.exe
clang: error: no such file or directory: 'curl.o'
```

Let's resolve this by skipping `libtool` and calling `windres` directly
when building `src` (aka `curl.exe`). Leave `lib` unchanged, as it does
need the `libtool` magic. This solution is compatible with building
a static `curl.exe`.

This build scenario is not CI-tested.

While here, delete an obsolete comment about a permanent `libtool`
warning that we've resolved earlier.

Regression from 6de7322c03d5b4d91576a7d9fc893e03cc9d1057

Reported-by: Christoph Reiter
Fixes #9803
Closes #9805

2 years agocmake: really enable warnings with clang
Viktor Szakats [Wed, 26 Oct 2022 09:56:52 +0000 (09:56 +0000)] 
cmake: really enable warnings with clang

Even though `PICKY_COMPILER=ON` is the default, warnings were not
enabled when using llvm/clang, because `CMAKE_COMPILER_IS_CLANG` was
always false (in my tests at least).

This is the single use of this variable in curl, and in a different
place we already use `CMAKE_C_COMPILER_ID MATCHES "Clang"`, which works
as expected, so change the condition to use that instead.

Also fix the warnings uncovered by the above:

- lib: add casts to silence clang warnings

- schannel: add casts to silence clang warnings in ALPN code

  Assuming the code is correct, solve the warnings with a cast.
  This particular build case isn't CI tested.

  There is a chance the warning is relevant for some platforms, perhaps
  Windows 32-bit ARM7.

Closes #9783

2 years agosendf: remove unnecessary if condition
Joel Depooter [Wed, 26 Oct 2022 00:12:30 +0000 (17:12 -0700)] 
sendf: remove unnecessary if condition

At this point, the psnd->buffer will always exist. We have already
allocated a new buffer if one did not previously exist, and returned
from the function if the allocation failed.

Closes #9801

2 years agowinidn: drop WANT_IDN_PROTOTYPES
Viktor Szakats [Wed, 26 Oct 2022 09:43:50 +0000 (09:43 +0000)] 
winidn: drop WANT_IDN_PROTOTYPES

`WANT_IDN_PROTOTYPES` was necessary to avoid using a header that came
via an optional package. MS stopped distributing this package some
years ago and the winidn definitions are part of standard headers (via
`windows.h`) since Vista.

Auto-detect Vista inside `lib/idn_win32.c` and enable the manual
definitions if building for an older Windows.

This allows to delete this manual knob from all build-systems.

Also drop the `_SAL_VERSION` sub-case:

Our manual definitions are now only enabled with old systems. We assume
that code analysis is not run on such systems, allowing us to delete the
SAL-friendly flavour of these.

Reviewed-by: Jay Satiro
Closes #9793

2 years agomisc: remove duplicated include files
Daniel Stenberg [Mon, 24 Oct 2022 21:27:31 +0000 (23:27 +0200)] 
misc: remove duplicated include files

Closes #9796

2 years agoscripts/checksrc.pl: detect duplicated include files
Daniel Stenberg [Mon, 24 Oct 2022 21:26:56 +0000 (23:26 +0200)] 
scripts/checksrc.pl: detect duplicated include files

After an idea by Dan Fandrich in #9794

Closes #9796

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 26 Oct 2022 09:19:15 +0000 (11:19 +0200)] 
RELEASE-NOTES: synced

And bumped version to 7.86.1 for now

2 years agoCURLMOPT_SOCKETFUNCTION.3: clarify CURL_POLL_REMOVE
Daniel Stenberg [Tue, 25 Oct 2022 22:35:07 +0000 (00:35 +0200)] 
CURLMOPT_SOCKETFUNCTION.3: clarify CURL_POLL_REMOVE

The removal is brief or long, don't assume.

Reported-by: Luca Niccoli
Fixes #9799
Closes #9800

2 years agoRELEASE: synced curl-7_86_0
Daniel Stenberg [Mon, 24 Oct 2022 11:26:34 +0000 (13:26 +0200)] 
RELEASE: synced

The 7.86.0 release

2 years agoTHANKS: added from the 7.86.0 release
Daniel Stenberg [Wed, 26 Oct 2022 06:11:58 +0000 (08:11 +0200)] 
THANKS: added from the 7.86.0 release

2 years agonoproxy: include netinet/in.h for htonl()
Viktor Szakats [Tue, 25 Oct 2022 15:19:28 +0000 (15:19 +0000)] 
noproxy: include netinet/in.h for htonl()

Solve the Amiga build warning by including `netinet/in.h`.

`krb5.c` and `socketpair.c` are using `htonl()` too. This header is
already included in those sources.

Regression from 1e9a538e05c0107c54ef81d9de7cd0b27cd13309

Reviewed-by: Daniel Stenberg
Closes #9787

2 years agoCI: fix AppVeyor status failing for starting jobs
Marc Hoersken [Mon, 24 Oct 2022 18:50:27 +0000 (20:50 +0200)] 
CI: fix AppVeyor status failing for starting jobs

2 years agotest445: verifies the protocols-over-http-proxy flaw and fix
Daniel Stenberg [Thu, 6 Oct 2022 12:14:25 +0000 (14:14 +0200)] 
test445: verifies the protocols-over-http-proxy flaw and fix

2 years agohttp_proxy: restore the protocol pointer on error
Daniel Stenberg [Thu, 6 Oct 2022 12:13:36 +0000 (14:13 +0200)] 
http_proxy: restore the protocol pointer on error

Reported-by: Trail of Bits
Closes #9790

2 years agomulti: remove duplicate include of connect.h
Daniel Stenberg [Mon, 24 Oct 2022 11:11:33 +0000 (13:11 +0200)] 
multi: remove duplicate include of connect.h

Reported-by: Martin Strunz
Fixes #9794
Closes #9795

2 years agoidn: fix typo in test description
Daniel Gustafsson [Mon, 24 Oct 2022 11:38:26 +0000 (13:38 +0200)] 
idn: fix typo in test description

s/enabked/enabled/i

2 years agourl: use IDN decoded names for HSTS checks
Daniel Stenberg [Wed, 12 Oct 2022 08:47:59 +0000 (10:47 +0200)] 
url: use IDN decoded names for HSTS checks

Reported-by: Hiroki Kurosawa
Closes #9791

2 years agounit1614: fix disabled-proxy build
Daniel Stenberg [Mon, 24 Oct 2022 07:54:08 +0000 (09:54 +0200)] 
unit1614: fix disabled-proxy build

Follow-up to 1e9a538e05c01

Closes #9792

2 years agocookies: optimize control character check
Daniel Gustafsson [Mon, 24 Oct 2022 09:31:08 +0000 (11:31 +0200)] 
cookies: optimize control character check

When checking for invalid octets the strcspn() call will return the
position of the first found invalid char or the first NULL byte.
This means that we can check the indicated position in the search-
string saving a strlen() call.

Closes: #9736
Reviewed-by: Jay Satiro <raysatiro@yahoo.com>
2 years agonetrc: replace fgets with Curl_get_line
Daniel Stenberg [Tue, 4 Oct 2022 12:37:24 +0000 (14:37 +0200)] 
netrc: replace fgets with Curl_get_line

Make the parser only accept complete lines and avoid problems with
overly long lines.

Reported-by: Hiroki Kurosawa
Closes #9789

2 years agoRELEASE-NOTES: add "Planned upcoming removals include"
Daniel Stenberg [Sun, 23 Oct 2022 15:25:01 +0000 (17:25 +0200)] 
RELEASE-NOTES: add "Planned upcoming removals include"

URL: https://curl.se/mail/archive-2022-10/0001.html

Suggested-by: Dan Fandrich
2 years agoci: bump to gcc-11 for macos
Viktor Szakats [Sun, 23 Oct 2022 12:40:26 +0000 (12:40 +0000)] 
ci: bump to gcc-11 for macos

Ref: https://github.blog/changelog/2022-10-03-github-actions-jobs-running-on-macos-latest-are-now-running-on-macos-12/
Ref: https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md

Reviewed-by: Max Dymond
Closes #9785

2 years agoMakefile.m32: reintroduce CROSSPREFIX and -W -Wall [ci skip]
Viktor Szakats [Sat, 22 Oct 2022 23:21:03 +0000 (23:21 +0000)] 
Makefile.m32: reintroduce CROSSPREFIX and -W -Wall [ci skip]

- Reintroduce `CROSSPREFIX`:

  If set, we add it to the `CC` and `AR` values, and to the _default_
  value of `RC`, which is `windres`. This allows to control each of
  these individidually, while also allowing to simplify configuration
  via `CROSSPREFIX`.

  This variable worked differently earlier. Hopefully this new solution
  hits a better compromise in usefulness/complexity/flexibility.

  Follow-up to: aa970c4c08775afcd0c2853be89b0a6f02582d50

- Enable warnings again:

  This time with an option to override it via `CFLAGS`. Warnings are
  also enabled by default in CMake, `makefile.dj` and `makefile.amiga`
  builds (not in autotools though).

  Follow-up to 10fbd8b4e3f83b967fd9ad9a41ab484c0e7e7ca3

Closes #9784

2 years agonoproxy: silence unused variable warnings with no ipv6
Viktor Szakats [Sat, 22 Oct 2022 23:20:26 +0000 (23:20 +0000)] 
noproxy: silence unused variable warnings with no ipv6

Follow-up to 36474f1050c7f4117e3c8de6cc9217cfebfc717d

Reviewed-by: Daniel Stenberg
Closes #9782

2 years agotest644: verify --xattr (with redirect)
Daniel Stenberg [Wed, 19 Oct 2022 09:40:11 +0000 (11:40 +0200)] 
test644: verify --xattr (with redirect)

2 years agotool_xattr: save the original URL, not the final redirected one
Daniel Stenberg [Wed, 19 Oct 2022 09:17:35 +0000 (11:17 +0200)] 
tool_xattr: save the original URL, not the final redirected one

Adjusted test 1621 accordingly.

Reported-by: Viktor Szakats
Fixes #9766
Closes #9768

2 years agodocs: make sure libcurl opts examples pass in long arguments
Daniel Stenberg [Fri, 21 Oct 2022 22:06:35 +0000 (00:06 +0200)] 
docs: make sure libcurl opts examples pass in long arguments

Reported-by: Sergey
Fixes #9779
Closes #9780

2 years agoCI: fix AppVeyor job links only working for most recent build
Marc Hoersken [Fri, 21 Oct 2022 20:54:04 +0000 (22:54 +0200)] 
CI: fix AppVeyor job links only working for most recent build

Ref: https://github.com/curl/curl/pull/9768#issuecomment-1286675916
Reported-by: Daniel Stenberg
Follow up to #9769

2 years agonoproxy: fix builds without AF_INET6
Viktor Szakats [Fri, 21 Oct 2022 19:06:25 +0000 (19:06 +0000)] 
noproxy: fix builds without AF_INET6

Regression from 1e9a538e05c0107c54ef81d9de7cd0b27cd13309

Reviewed-by: Daniel Stenberg
Closes #9778

2 years agonoproxy: support proxies specified using cidr notation
Daniel Stenberg [Thu, 20 Oct 2022 13:21:12 +0000 (15:21 +0200)] 
noproxy: support proxies specified using cidr notation

For both IPv4 and IPv6 addresses. Now also checks IPv6 addresses "correctly"
and not with string comparisons.

Split out the noproxy checks and functionality into noproxy.c

Added unit test 1614 to verify checking functions.

Reported-by: Mathieu Carbonneaux
Fixes #9773
Fixes #5745
Closes #9775

2 years agourlapi: remove two variable assigns
Daniel Stenberg [Fri, 21 Oct 2022 07:41:54 +0000 (09:41 +0200)] 
urlapi: remove two variable assigns

To please scan-build:

urlapi.c:1163:9: warning: Value stored to 'qlen' is never read
        qlen = Curl_dyn_len(&enc);
        ^      ~~~~~~~~~~~~~~~~~~
urlapi.c:1164:9: warning: Value stored to 'query' is never read
        query = u->query = Curl_dyn_ptr(&enc);
        ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Follow-up to 7d6cf06f571d57

Closes #9777

2 years agocmake: improve usability of CMake build as a sub-project
Jeremy Maitin-Shepard [Sun, 2 Oct 2022 19:43:07 +0000 (12:43 -0700)] 
cmake: improve usability of CMake build as a sub-project

- Renames `uninstall` -> `curl_uninstall`
- Ensures all export rules are guarded by CURL_ENABLE_EXPORT_TARGET

Closes #9638

2 years agoeasy_lock: check for HAVE_STDATOMIC_H as well
Don Olmstead [Mon, 17 Oct 2022 23:58:50 +0000 (16:58 -0700)] 
easy_lock: check for HAVE_STDATOMIC_H as well

The check for `HAVE_STDATOMIC_H` looks to see if the `stdatomic.h`
header is present.

Closes #9755

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 21 Oct 2022 07:20:26 +0000 (09:20 +0200)] 
RELEASE-NOTES: synced

2 years agoCURLMOPT_PIPELINING.3: dedup manpage xref
Brad Harder [Thu, 20 Oct 2022 04:13:49 +0000 (21:13 -0700)] 
CURLMOPT_PIPELINING.3: dedup manpage xref

Closes #9776

2 years agoCI: report AppVeyor build status for each job
Marc Hoersken [Mon, 17 Oct 2022 20:20:42 +0000 (22:20 +0200)] 
CI: report AppVeyor build status for each job

Also give each job on AppVeyor CI a human-readable name.

This aims to make job and therefore build failures more visible.

Reviewed-by: Marcel Raad
Closes #9769

2 years agoamiga: set SIZEOF_CURL_OFF_T=8 by default [ci skip]
Viktor Szakats [Thu, 20 Oct 2022 09:10:15 +0000 (09:10 +0000)] 
amiga: set SIZEOF_CURL_OFF_T=8 by default [ci skip]

Reviewed-by: Daniel Stenberg
Closes #9771

2 years agoconnect: fix builds without AF_INET6
Viktor Szakats [Thu, 20 Oct 2022 09:09:36 +0000 (09:09 +0000)] 
connect: fix builds without AF_INET6

Regression from 2b309560c1e5d6ed5c0e542e6fdffa968b0521c9

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

2 years agotest1105: adjust <data> to work with a hyper build
Daniel Stenberg [Tue, 18 Oct 2022 22:33:17 +0000 (00:33 +0200)] 
test1105: adjust <data> to work with a hyper build

Closes #9767

2 years agourlapi: fix parsing URL without slash with CURLU_URLENCODE
Daniel Stenberg [Tue, 18 Oct 2022 13:54:06 +0000 (15:54 +0200)] 
urlapi: fix parsing URL without slash with CURLU_URLENCODE

When CURLU_URLENCODE is set, the parser would mistreat the path
component if the URL was specified without a slash like in
http://local.test:80?-123

Extended test 1560 to reproduce and verify the fix.

Reported-by: Trail of Bits
Closes #9763

2 years agotests: avoid CreateThread if _beginthreadex is available
Marc Hoersken [Tue, 11 Oct 2022 22:21:23 +0000 (00:21 +0200)] 
tests: avoid CreateThread if _beginthreadex is available

CreateThread is not threadsafe if mixed with CRT calls.
_beginthreadex on the other hand can be mixed with CRT.

Reviewed-by: Marcel Raad
Closes #9705

2 years agoschannel: Don't reset recv/send function pointers on renegotiation
Joel Depooter [Tue, 18 Oct 2022 05:56:18 +0000 (22:56 -0700)] 
schannel: Don't reset recv/send function pointers on renegotiation

These function pointers will have been set when the initial TLS
handshake was completed. If they are unchanged, there is no need to set
them again. If they have been changed, as is the case with HTTP/2, we
don't want to override that change. That would result in the
http22_recv/send functions being completely bypassed.

Prior to this change a connection that uses Schannel with HTTP/2 would
fail on renegotiation with error "Received HTTP/0.9 when not allowed".

Fixes https://github.com/curl/curl/issues/9451
Closes https://github.com/curl/curl/pull/9756

2 years agohostip: guard PF_INET6 use
Viktor Szakats [Tue, 18 Oct 2022 18:27:59 +0000 (18:27 +0000)] 
hostip: guard PF_INET6 use

Some platforms (e.g. Amiga OS) do not have `PF_INET6`. Adjust the code
for these.

```
hostip.c: In function 'fetch_addr':
hostip.c:308:12: error: 'PF_INET6' undeclared (first use in this function)
       pf = PF_INET6;
            ^~~~~~~~
```

Regression from 1902e8fc511078fb5e26fc2b907b4cce77e1240d

Reviewed-by: Daniel Stenberg
Closes #9760

2 years agoamiga: do not hardcode openssl/zlib into the os config [ci skip]
Viktor Szakats [Tue, 18 Oct 2022 18:22:41 +0000 (18:22 +0000)] 
amiga: do not hardcode openssl/zlib into the os config [ci skip]

Enable them in `lib/makefile.amiga` and `src/makefile.amiga` instead.

This allows builds without openssl and/or zlib. E.g. with the
<https://github.com/bebbo/amiga-gcc> cross-compiler.

Reviewed-by: Daniel Stenberg
Closes #9762

2 years agoamigaos: add missing curl header [ci skip]
Viktor Szakats [Tue, 18 Oct 2022 18:22:09 +0000 (18:22 +0000)] 
amigaos: add missing curl header [ci skip]

Without it, `CURLcode` and `CURLE_*` are undefined. `lib/hostip.h` and
conditional local code need them.

Reviewed-by: Daniel Stenberg
Closes #9761

2 years agocmdline/docs: add a required 'multi' keyword for each option
Daniel Stenberg [Tue, 18 Oct 2022 08:39:43 +0000 (10:39 +0200)] 
cmdline/docs: add a required 'multi' keyword for each option

The keyword specifies how option works when specified multiple times:

 - single: the last provided value replaces the earlier ones
 - append: it supports being provided multiple times
 - boolean: on/off values
 - mutex: flag-like option that disable anoter flag

The 'gen.pl' script then outputs the proper and unified language for
each option's multi-use behavior in the generated man page.

The multi: header is requires in each .d file and will cause build error
if missing or set to an unknown value.

Closes #9759

2 years agoCURLOPT_AUTOREFERER.3: highlight the privacy leak risk
Daniel Stenberg [Tue, 18 Oct 2022 06:40:24 +0000 (08:40 +0200)] 
CURLOPT_AUTOREFERER.3: highlight the privacy leak risk

Closes #9757

2 years agomprintf: reject two kinds of precision for the same argument
Daniel Stenberg [Mon, 17 Oct 2022 15:56:26 +0000 (17:56 +0200)] 
mprintf: reject two kinds of precision for the same argument

An input like "%.*1$.9999d" would first use the precision taken as an
argument *and* then the precision specified in the string, which is
confusing and wrong. pass1 will now instead return error on this double
use.

Adjusted unit test 1398 to verify

Reported-by: Peter Goodman
Closes #9754

2 years agoftp: remove redundant if
Daniel Stenberg [Mon, 17 Oct 2022 13:57:35 +0000 (15:57 +0200)] 
ftp: remove redundant if

Reported-by: Trail of Bits
Closes #9753

2 years agotool_operate: more transfer cleanup after parallel transfer fail
Daniel Stenberg [Mon, 17 Oct 2022 09:44:13 +0000 (11:44 +0200)] 
tool_operate: more transfer cleanup after parallel transfer fail

In some circumstances when doing parallel transfers, the
single_transfer_cleanup() would not be called and then 'inglob' could
leak.

Test 496 verifies

Reported-by: Trail of Bits
Closes #9749

2 years agomqtt: spell out CONNECT in comments
Daniel Stenberg [Mon, 17 Oct 2022 12:48:33 +0000 (14:48 +0200)] 
mqtt: spell out CONNECT in comments

Instead of calling it 'CONN' in several comments, use the full and
correct protocol packet name.

Suggested by Trail of Bits

Closes #9751

2 years agoCURLOPT_POSTFIELDS.3: refer to CURLOPT_MIMEPOST
Daniel Stenberg [Mon, 17 Oct 2022 12:51:51 +0000 (14:51 +0200)] 
CURLOPT_POSTFIELDS.3: refer to CURLOPT_MIMEPOST

Not the deprecated CURLOPT_HTTPPOST option.

Also added two see-alsos.

Reported-by: Trail of Bits
Closes #9752

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 17 Oct 2022 08:41:17 +0000 (10:41 +0200)] 
RELEASE-NOTES: synced

2 years agongtcp2: Fix build errors due to changes in ngtcp2 library
Jay Satiro [Mon, 17 Oct 2022 06:44:12 +0000 (02:44 -0400)] 
ngtcp2: Fix build errors due to changes in ngtcp2 library

ngtcp2/ngtcp2@b0d86f60 changed:

- ngtcp2_conn_get_max_udp_payload_size =>
  ngtcp2_conn_get_max_tx_udp_payload_size

- ngtcp2_conn_get_path_max_udp_payload_size =>
  ngtcp2_conn_get_path_max_tx_udp_payload_size

ngtcp2/ngtcp2@ec59b873 changed:

- 'early_data_rejected' member added to ng_callbacks.

Assisted-by: Daniel Stenberg
Reported-by: jurisuk@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/9747
Closes https://github.com/curl/curl/pull/9748

2 years agocurl_path: return error if given a NULL homedir
Daniel Stenberg [Sun, 16 Oct 2022 16:09:14 +0000 (18:09 +0200)] 
curl_path: return error if given a NULL homedir

Closes #9740

2 years agolibssh: if sftp_init fails, don't get the sftp error code
Daniel Stenberg [Sun, 16 Oct 2022 10:58:55 +0000 (12:58 +0200)] 
libssh: if sftp_init fails, don't get the sftp error code

This flow extracted the wrong code (sftp code instead of ssh code), and
the code is sometimes (erroneously) returned as zero anyway, so skip
getting it and set a generic error.

Reported-by: David McLaughlin
Fixes #9737
Closes #9740

2 years agomqtt: return error for too long topic
Daniel Stenberg [Sun, 16 Oct 2022 16:05:34 +0000 (18:05 +0200)] 
mqtt: return error for too long topic

Closes #9744

2 years agotool_paramhlp: make the max argument a 'double'
Rickard Hallerbäck [Thu, 13 Oct 2022 16:50:57 +0000 (18:50 +0200)] 
tool_paramhlp: make the max argument a 'double'

To fix compiler warnings "Implicit conversion from 'long' to 'double'
may lose precision"

Closes #9700

2 years agocirrus-ci: add more macOS builds with m1 based on x86_64 builds
Philip H [Sun, 9 Oct 2022 20:41:21 +0000 (22:41 +0200)] 
cirrus-ci: add more macOS builds with m1 based on x86_64 builds

Also refactor macOS builds to use task matrix.

Assisted-by: Marc Hörsken
Closes #9565

2 years agocmake: set HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID on Windows
Viktor Szakats [Fri, 14 Oct 2022 19:06:37 +0000 (19:06 +0000)] 
cmake: set HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID on Windows

`lib/config-win32.h` enables this configuration option unconditionally.
Make it apply to CMake builds as well.

While here, delete a broken check for
`HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` from `CMakeLists.txt`. This came with
the initial commit [1], but did not include the actual verification code
inside `CMake/CurlTests.c`, so it always failed. A later commit [2]
added a second test, for non-Windows platforms.

Enabling this flag causes test 1056 to fail with CMake builds, as they
do with autotools builds. Let's apply the same solution and ignore the
results here as well.

[1] 4c5307b45655ba75ab066564afdc0c111a8b9291
[2] aec7c5a87c8482b6ddffa352d7d220698652262e

Reviewed-by: Daniel Stenberg
Assisted-by: Marcel Raad
Closes #9726

2 years agocmake: set HAVE_GETADDRINFO_THREADSAFE on Windows
Viktor Szakats [Fri, 14 Oct 2022 18:19:09 +0000 (18:19 +0000)] 
cmake: set HAVE_GETADDRINFO_THREADSAFE on Windows

autotools enables this configuration option unconditionally for Windows
[^1]. Do the same in CMake.

The above will make this work for all reasonably recent environments.
The logic present in `lib/config-win32.h` [^2] has the following
exceptions which we did not cover in this CMake update:

- Builds targeting Windows 2000 and earlier
- MS Visual C++ 5.0 (1997) and earlier

Also make sure to disable this feature when `HAVE_GETADDRINFO` isn't
set, to avoid a broken build. We might want to handle that in the C
sources in a future commit.

[^1]: https://github.com/curl/curl/blob/68fa9bf3f5d7b4fcbb57619f70cb4aabb79a51f6/m4/curl-functions.m4#L2067-L2070

[^2]: https://github.com/curl/curl/blob/68fa9bf3f5d7b4fcbb57619f70cb4aabb79a51f6/lib/config-win32.h#L511-L528

Closes #9727

2 years agocmake: sync HAVE_SIGNAL detection with autotools
Viktor Szakats [Fri, 14 Oct 2022 18:06:30 +0000 (18:06 +0000)] 
cmake: sync HAVE_SIGNAL detection with autotools

`HAVE_SIGNAL` means the availability of the `signal()` function in
autotools, while in CMake it meant the availability of that function
_and_ the symbol `SIGALRM`.

The latter is not available on Windows, but the function is, which means
on Windows, autotools did define `HAVE_SIGNAL`, but CMake did not,
introducing a slight difference into the binaries.

This patch syncs CMake behaviour with autotools to look for the function
only.

The logic came with the initial commit adding CMake support to curl, so
the commit history doesn't reveal the reason behind it. In any case,
it's best to check the existence of `SIGALRM` directly in the source
before use. For now, curl builds fine with `HAVE_SIGNAL` enabled and
`SIGALRM` missing.

Follow-up to 68fa9bf3f5d7b4fcbb57619f70cb4aabb79a51f6

Closes #9725

2 years agocmake: delete duplicate HAVE_GETADDRINFO test
Viktor Szakats [Fri, 14 Oct 2022 17:31:19 +0000 (17:31 +0000)] 
cmake: delete duplicate HAVE_GETADDRINFO test

A custom `HAVE_GETADDRINFO` check came with the initial CMake commit
[1]. A later commit [2] added a standard check for it as well. The
standard check run before the custom one, so CMake ignored the latter.

The custom check was also non-portable, so this patch deletes it in
favor of the standard check.

[1] 4c5307b45655ba75ab066564afdc0c111a8b9291
[2] aec7c5a87c8482b6ddffa352d7d220698652262e

Closes #9731

2 years agotool_formparse: unroll the NULL_CHECK and CONST_FREE macros
Daniel Stenberg [Wed, 12 Oct 2022 13:48:52 +0000 (15:48 +0200)] 
tool_formparse: unroll the NULL_CHECK and CONST_FREE macros

To make the code read more obvious

Assisted-by: Jay Satiro
Closes #9710

2 years agodocs/INSTALL: update Android Instructions for newer NDKs
Christopher Sauer [Fri, 14 Oct 2022 02:25:05 +0000 (19:25 -0700)] 
docs/INSTALL: update Android Instructions for newer NDKs

Closes #9732

2 years agomarkdown-uppercase: ignore quoted sections
Daniel Stenberg [Fri, 14 Oct 2022 06:55:37 +0000 (08:55 +0200)] 
markdown-uppercase: ignore quoted sections

Sections within the markdown ~~~ or ``` are now ignored.

Closes #9733

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 14 Oct 2022 06:32:38 +0000 (08:32 +0200)] 
RELEASE-NOTES: synced

2 years agotest8: update as cookies no longer can have "embedded" TABs in content
Daniel Stenberg [Thu, 6 Oct 2022 15:39:49 +0000 (17:39 +0200)] 
test8: update as cookies no longer can have "embedded" TABs in content

2 years agotest1105: extend to verify TAB in name/content discarding cookies
Daniel Stenberg [Thu, 6 Oct 2022 12:39:51 +0000 (14:39 +0200)] 
test1105: extend to verify TAB in name/content discarding cookies

2 years agocookie: reject cookie names or content with TAB characters
Daniel Stenberg [Wed, 5 Oct 2022 07:12:39 +0000 (09:12 +0200)] 
cookie: reject cookie names or content with TAB characters

TABs in name and content seem allowed by RFC 6265: "the algorithm strips
leading and trailing whitespace from the cookie name and value (but
maintains internal whitespace)"

Cookies with TABs in the names are rejected by Firefox and Chrome.

TABs in content are stripped out by Firefox, while Chrome discards the
whole cookie.

TABs in cookies also cause issues in saved netscape cookie files.

Reported-by: Trail of Bits
URL: https://curl.se/mail/lib-2022-10/0032.html
URL: https://github.com/httpwg/http-extensions/issues/2262

Closes #9659

2 years agocurl/add_parallel_transfers: better error handling
Daniel Stenberg [Wed, 12 Oct 2022 06:42:57 +0000 (08:42 +0200)] 
curl/add_parallel_transfers: better error handling

1 - consider the transfer handled at once when in the function, to avoid
    the same list entry to get added more than once in rare error
    situations

2 - set the ERRORBUFFER for the handle first after it has been added
    successfully

Reported-by: Trail of Bits
Closes #9729

2 years agonetrc: remove the two 'changed' arguments
Daniel Stenberg [Thu, 13 Oct 2022 12:59:34 +0000 (14:59 +0200)] 
netrc: remove the two 'changed' arguments

As no user of these functions used the returned content.

2 years agotest495: verify URL encoded user name + netrc-optional
Daniel Stenberg [Thu, 13 Oct 2022 12:15:00 +0000 (14:15 +0200)] 
test495: verify URL encoded user name + netrc-optional

Reproduced issue #9709

2 years agonetrc: use the URL-decoded user
Daniel Stenberg [Wed, 12 Oct 2022 21:48:38 +0000 (23:48 +0200)] 
netrc: use the URL-decoded user

When the user name is provided in the URL it is URL encoded there, but
when used for authentication the encoded version should be used.

Regression introduced after 7.83.0

Reported-by: Jonas Haag
Fixes #9709
Closes #9715

2 years agourl: allow non-HTTPS HSTS-matching for debug builds
Shaun Mirani [Wed, 12 Oct 2022 19:27:43 +0000 (16:27 -0300)] 
url: allow non-HTTPS HSTS-matching for debug builds

Closes #9728

2 years agotest1275: remove the check of stderr
Daniel Stenberg [Thu, 13 Oct 2022 15:04:46 +0000 (17:04 +0200)] 
test1275: remove the check of stderr

To avoid the mysterious test failures on Windows, instead rely on the
error code returned on failure.

Fixes #9716
Closes #9723

2 years agolib: set more flags in config-win32.h
Viktor Szakats [Thu, 13 Oct 2022 15:43:31 +0000 (15:43 +0000)] 
lib: set more flags in config-win32.h

The goal is to add any flag that affect the created binary, to get in
sync with the ones built with CMake and autotools.

I took these flags from curl-for-win [0], where they've been tested with
mingw-w64 and proven to work well.

This patch brings them to curl as follows:

- Enable unconditionally those force-enabled via
  `CMake/WindowsCache.cmake`:

  - `HAVE_SETJMP_H`
  - `HAVE_STRING_H`
  - `HAVE_SIGNAL` (CMake equivalent is `HAVE_SIGNAL_FUNC`)

- Expand existing guards with mingw-w64:

  - `HAVE_STDBOOL_H`
  - `HAVE_BOOL_T`

- Enable Win32 API functions for Windows Vista and later:

  - `HAVE_INET_NTOP`
  - `HAVE_INET_PTON`

- Set sizes, if not already set:

  - `SIZEOF_OFF_T = 8`
  - `_FILE_OFFSET_BITS = 64` when `USE_WIN32_LARGE_FILES` is set,
    and using mingw-w64.

- Add the remaining for mingw-w64 only. Feel free to expand as desired:

  - `HAVE_LIBGEN_H`
  - `HAVE_FTRUNCATE`
  - `HAVE_BASENAME`
  - `HAVE_STRTOK_R`

Future TODO:

- `HAVE_SIGNAL` has a different meaning in CMake. It's enabled when both
  the `signal()` function and the `SIGALRM` macro are found. In
  autotools and this header, it means the function only. For the
  function alone, CMake uses `HAVE_SIGNAL_FUNC`.

[0] https://github.com/curl/curl-for-win/blob/c9b9a5f273c94c73d2b565ee892c4dff0ca97a8c/curl-m32.sh#L53-L58

Reviewed-by: Daniel Stenberg
Closes #9712

2 years agotests: add tests/markdown-uppercase.pl to dist tarball
Daniel Stenberg [Thu, 13 Oct 2022 15:01:09 +0000 (17:01 +0200)] 
tests: add tests/markdown-uppercase.pl to dist tarball

Follow-up to aafb06c5928183d

Closes #9722

2 years agotool_paramhelp: asserts verify maximum sizes for string loading
Daniel Stenberg [Thu, 13 Oct 2022 10:00:09 +0000 (12:00 +0200)] 
tool_paramhelp: asserts verify maximum sizes for string loading

The two defines MAX_FILE2MEMORY and MAX_FILE2STRING define the largest
strings accepted when loading files into memory, but as the size is
later used as input to functions that take the size as 'int' as
argument, the sizes must not be larger than INT_MAX.

These two new assert()s make the code error out if someone would bump
the sizes without this consideration.

Reported-by Trail of Bits

Closes #9719

2 years agohttp: try parsing Retry-After: as a number first
Daniel Stenberg [Thu, 13 Oct 2022 09:30:16 +0000 (11:30 +0200)] 
http: try parsing Retry-After: as a number first

Since the date parser allows YYYYMMDD as a date format (due to it being
a bit too generic for parsing this particular header), a large integer
number could wrongly match that pattern and cause the parser to generate
a wrong value.

No date format accepted for this header starts with a decimal number, so
by reversing the check and trying a number first we can deduct that if
that works, it was not a date.

Reported-by Trail of Bits

Closes #9718

2 years agodoc: fix deprecation versions inconsistencies
Patrick Monnerat [Wed, 12 Oct 2022 14:43:31 +0000 (16:43 +0200)] 
doc: fix deprecation versions inconsistencies

Ref: https://curl.se/mail/lib-2022-10/0026.html

Closes #9711

2 years agohttp_aws_sigv4: fix strlen() check
Daniel Stenberg [Wed, 12 Oct 2022 21:03:26 +0000 (23:03 +0200)] 
http_aws_sigv4: fix strlen() check

The check was off-by-one leading to buffer overflow.

Follow-up to 29c4aa00a16872

Detected by OSS-Fuzz

Closes #9714

2 years agocurl/main_checkfds: check the fcntl return code better
Daniel Stenberg [Wed, 12 Oct 2022 09:49:44 +0000 (11:49 +0200)] 
curl/main_checkfds: check the fcntl return code better

fcntl() can (in theory) return a non-zero number for success, so a
better test for error is checking for -1 explicitly.

Follow-up to 41e1b30ea1b77e9ff

Mentioned-by: Dominik Klemba
Closes #9708

2 years agotidy-up: delete unused HAVE_STRUCT_POLLFD
Viktor Szakats [Wed, 12 Oct 2022 14:19:09 +0000 (14:19 +0000)] 
tidy-up: delete unused HAVE_STRUCT_POLLFD

It was only defined in `lib/config-win32.h`, when building for Vista.

It was only used in `select.h`, in a condition that also included a
check for `POLLIN` which is a superior choice for this detection and
which was already used by cmake and autotools builds.

Delete both instances of this macro.

Closes #9707

2 years agotest1275: verify upercase after period in markdown
Daniel Stenberg [Tue, 11 Oct 2022 07:34:38 +0000 (09:34 +0200)] 
test1275: verify upercase after period in markdown

Script based on the #9474 pull-request logic, but implemented in perl.

Updated docs/URL-SYNTAX.md accordingly.

Suggested-by: Dan Fandrich
Closes #9697

2 years agomisc: nitpick grammar in comments/docs
12932 [Tue, 11 Oct 2022 14:01:37 +0000 (22:01 +0800)] 
misc: nitpick grammar in comments/docs

because the 'u' in URL is actually a consonant *sound* it is only
correct to write "a URL"

sorry this is a bit nitpicky :P

https://english.stackexchange.com/questions/152/when-should-i-use-a-vs-an
https://www.techtarget.com/whatis/feature/Which-is-correct-a-URL-or-an-URL

Closes #9699

2 years agoMakefile.m32: drop CROSSPREFIX and our CC/AR defaults [ci skip]
Viktor Szakats [Tue, 11 Oct 2022 21:16:00 +0000 (21:16 +0000)] 
Makefile.m32: drop CROSSPREFIX and our CC/AR defaults [ci skip]

This patch aimed to fix a regression [0], where `CC` initialization
moved beyond its first use. But, on closer inspection it turned out that
the `CC` initialization does not work as expected due to GNU Make
filling it with `cc` by default. So unless implicit values were
explicitly disabled via a GNU Make option, the default value of
`$CROSSPREFIX` + `gcc` was never used. At the same time the implicit
value `cc` maps to `gcc` in (most/all?) MinGW envs.

`AR` has the same issue, with a default value of `ar`.

We could reintroduce a separate variable to fix this without ill
effects, but for simplicity and flexibility, it seems better to drop
support for `CROSSPREFIX`, along with our own `CC`/`AR` init logic, and
require the caller to initialize `CC`, `AR` and `RC` to the full
(prefixed if necessary) names of these tools, as desired.

We keep `RC ?= windres` because `RC` is empty by default.

Also fix grammar in a comment.

[0] 10fbd8b4e3f83b967fd9ad9a41ab484c0e7e7ca3

Closes #9698

2 years agosmb: replace CURL_WIN32 with WIN32
Viktor Szakats [Tue, 11 Oct 2022 21:05:44 +0000 (21:05 +0000)] 
smb: replace CURL_WIN32 with WIN32

PR #9255 aimed to fix a Cygwin/MSYS issue (#8220). It used the
`CURL_WIN32` macro, but that one is not defined here, while compiling
curl itself. This patch changes this to `WIN32`, assuming this was the
original intent.

Regression from 1c52e8a3795ccdf8ec9c308f4f8f19cf10ea1f1a

Reviewed-by: Marcel Raad
Closes #9701

2 years agoaws_sigv4: fix header computation
Matthias Gatto [Thu, 13 Jan 2022 14:53:52 +0000 (15:53 +0100)] 
aws_sigv4: fix header computation

Handle canonical headers and signed headers creation as explained here:
https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html

The algo tells that signed and canonical must contain at last host and
x-amz-date.

So we check whatever thoses are present in the curl http headers list.
If they are, we use the one enter by curl user, otherwise we generate
them.  then we to lower, and remove space from each http headers plus
host and x-amz-date, then sort them all by alphabetical order.

This patch also fix a bug with host header, which was ignoring the port.

Closes #7966

2 years agoREADME.md: link the curl logo to the website
Aftab Alam [Sun, 9 Oct 2022 17:33:21 +0000 (23:03 +0530)] 
README.md: link the curl logo to the website

- Link the curl:// image to https://curl.se/

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

2 years agoschannel: when importing PFX, disable key persistence
Dustin Howett [Thu, 25 Aug 2022 00:20:43 +0000 (19:20 -0500)] 
schannel: when importing PFX, disable key persistence

By default, the PFXImportCertStore API persists the key in the user's
key store (as though the certificate was being imported for permanent,
ongoing use.)

The documentation specifies that keys that are not to be persisted
should be imported with the flag PKCS12_NO_PERSIST_KEY.
NOTE: this flag is only supported on versions of Windows newer than XP
and Server 2003.

--

This is take 2 of the original fix. It extends the lifetime of the
client certificate store to that of the credential handle. The original
fix which landed in 70d010d and was later reverted in aec8d30 failed to
work properly because it did not do that.

Minor changes were made to the schannel credential context to support
closing the client certificate store handle at the end of an SSL session.

--

Reported-by: ShadowZzj@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/9300
Supersedes https://github.com/curl/curl/pull/9363
Closes https://github.com/curl/curl/pull/9460