]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
3 years agotest1221: verify --url-query
Daniel Stenberg [Fri, 4 Nov 2022 23:10:25 +0000 (00:10 +0100)] 
test1221: verify --url-query

3 years agocurl: add --url-query
Daniel Stenberg [Fri, 4 Nov 2022 23:10:24 +0000 (00:10 +0100)] 
curl: add --url-query

This option adds a piece of data, usually a name + value pair, to the
end of the URL query part. The syntax is identical to that used for
--data-urlencode with one extension:

If the argument starts with a '+' (plus), the rest of the string is
provided as-is unencoded.

This allows users to "build" query parts with options and URL encoding
even when not doing GET requests, which the already provided option -G
(--get) is limited to.

This idea was born in a Twitter thread.

Closes #9691

3 years agomaketgz: set the right version in lib/libcurl.plist
Daniel Stenberg [Tue, 8 Nov 2022 07:53:05 +0000 (08:53 +0100)] 
maketgz: set the right version in lib/libcurl.plist

Follow-up to e498a9b1fe5964a18eb2a3a99dc52

Make sure the tarball gets a version of the libcurl.plist file that is
updated with the new version string.

Reported-by: jvreelanda on github
Fixes #9866
Closes #9867

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 8 Nov 2022 09:29:17 +0000 (10:29 +0100)] 
RELEASE-NOTES: synced

Bumped version to 7.87.0

3 years agocurl.h: add CURLOPT_CA_CACHE_TIMEOUT option
Michael Drake [Wed, 12 Oct 2022 11:12:08 +0000 (12:12 +0100)] 
curl.h: add CURLOPT_CA_CACHE_TIMEOUT option

Adds a new option to control the maximum time that a cached
certificate store may be retained for.

Currently only the OpenSSL backend implements support for
caching certificate stores.

Closes #9620

3 years agoopenssl: reduce CA certificate bundle reparsing by caching
Michael Drake [Wed, 28 Sep 2022 14:51:44 +0000 (15:51 +0100)] 
openssl: reduce CA certificate bundle reparsing by caching

Closes #9620

3 years agolib: fix some type mismatches and remove unneeded typecasts
Rose [Fri, 28 Oct 2022 16:32:09 +0000 (12:32 -0400)] 
lib: fix some type mismatches and remove unneeded typecasts

Many of these castings are unneeded if we change the variables to work
better with each other.

Ref: https://github.com/curl/curl/pull/9823

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

3 years agocookie: compare cookie prefixes case insensitively
Daniel Stenberg [Mon, 7 Nov 2022 16:10:56 +0000 (17:10 +0100)] 
cookie: compare cookie prefixes case insensitively

Adapted to language in rfc6265bis draft-11.

Closes #9863

Reviewed-by: Daniel Gustafsson
3 years agotool_operate: when aborting, make sure there is a non-NULL error buffer
Daniel Stenberg [Mon, 7 Nov 2022 17:01:24 +0000 (18:01 +0100)] 
tool_operate: when aborting, make sure there is a non-NULL error buffer

To store custom errors in. Or SIGSEGVs will follow.

Reported-by: Trail of Bits
Closes #9865

3 years agoWEBSOCKET.md: fix broken link
Daniel Stenberg [Mon, 7 Nov 2022 16:23:31 +0000 (17:23 +0100)] 
WEBSOCKET.md: fix broken link

Reported-by: Felipe Gasper
Bug: https://curl.se/mail/lib-2022-10/0097.html
Closes #9864

3 years agoCURLOPT_DEBUGFUNCTION.3: do not assume nul-termination in example
Daniel Stenberg [Mon, 7 Nov 2022 11:15:24 +0000 (12:15 +0100)] 
CURLOPT_DEBUGFUNCTION.3: do not assume nul-termination in example

Reported-by: Oskar Sigvardsson
Bug: https://curl.se/mail/lib-2022-11/0016.html

Closes #9862

3 years agowebsockets: fix handling of partial frames
Stefan Eissing [Mon, 7 Nov 2022 09:11:17 +0000 (10:11 +0100)] 
websockets: fix handling of partial frames

buffer used and send length calculations are fixed when a partial
websocket frame has been received.

Closes #9861

3 years agomailmap: unify Stefan Eissing
Daniel Stenberg [Mon, 7 Nov 2022 11:24:07 +0000 (12:24 +0100)] 
mailmap: unify Stefan Eissing

3 years agohyper: fix handling of hyper_task's when reusing the same address
Stefan Eissing [Mon, 7 Nov 2022 08:47:10 +0000 (09:47 +0100)] 
hyper: fix handling of hyper_task's when reusing the same address

Fixes #9840
Closes #9860

3 years agows: return CURLE_NOT_BUILT_IN when websockets not built in
Jay Satiro [Thu, 3 Nov 2022 19:52:34 +0000 (15:52 -0400)] 
ws: return CURLE_NOT_BUILT_IN when websockets not built in

- Change curl_ws_recv & curl_ws_send to return CURLE_NOT_BUILT_IN when
  websockets support is not built in.

Prior to this change they returned CURLE_OK.

Closes #9851

3 years agonoproxy: tailmatch like in 7.85.0 and earlier
Daniel Stenberg [Sun, 6 Nov 2022 22:19:51 +0000 (23:19 +0100)] 
noproxy: tailmatch like in 7.85.0 and earlier

A regfression in 7.86.0 (via 1e9a538e05c010) made the tailmatch work
differently than before. This restores the logic to how it used to work:

All names listed in NO_PROXY are tailmatched against the used domain
name, if the lengths are identical it needs a full match.

Update the docs, update test 1614.

Reported-by: Stuart Henderson
Fixes #9842
Closes #9858

3 years agoconfigure: require fork for NTLM-WB
Daniel Stenberg [Sat, 5 Nov 2022 12:42:06 +0000 (13:42 +0100)] 
configure: require fork for NTLM-WB

Reported-by: ウさん
Fixes #9847
Closes #9856

3 years agodocs/EARLY-RELEASE.md: how to determine an early release
Daniel Stenberg [Sat, 5 Nov 2022 22:50:32 +0000 (23:50 +0100)] 
docs/EARLY-RELEASE.md: how to determine an early release

URL: https://curl.se/mail/lib-2022-10/0079.html

Closes #9820

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 3 Nov 2022 10:37:15 +0000 (11:37 +0100)] 
RELEASE-NOTES: synced

3 years agodocs: add missing parameters for --retry flag
Zespre Schmidt [Thu, 3 Nov 2022 03:20:19 +0000 (11:20 +0800)] 
docs: add missing parameters for --retry flag

Closes #9848

3 years agolibcurl-errors.3: remove duplicate word
Adam Averay [Thu, 3 Nov 2022 00:04:08 +0000 (10:04 +1000)] 
libcurl-errors.3: remove duplicate word

Closes #9846

3 years agocur_path: do not add '/' if homedir ends with one
Eric Vigeant [Wed, 2 Nov 2022 15:47:09 +0000 (11:47 -0400)] 
cur_path: do not add '/' if homedir ends with one

When using SFTP and a path relative to the user home, do not add a
trailing '/' to the user home dir if it already ends with one.

Closes #9844

3 years agowindows: fail early with a missing windres in autotools
Viktor Szakats [Tue, 1 Nov 2022 22:45:28 +0000 (22:45 +0000)] 
windows: fail early with a missing windres in autotools

`windres` is not always auto-detected by autotools when building for
Windows. When this happened, the build failed with a confusing error due
to the empty `RC` command:

```
/bin/bash ../libtool --tag=RC --mode=compile  -I../include -DCURL_EMBED_MANIFEST  -i curl.rc -o curl.o
[...]
Usage: /sandbox/curl/libtool [OPTION]... [MODE-ARG]...
Try 'libtool --help' for more information.
libtool:   error: unrecognised option: '-I../include'
```

Improve this by verifying if `RC` is set, and fail with a clear error
otherwise.

Follow-up to 6de7322c03d5b4d91576a7d9fc893e03cc9d1057

Ref: https://curl.se/mail/lib-2022-10/0049.html
Reported-by: Thomas Glanzmann
Closes #9781

3 years agolib: sync guard for Curl_getaddrinfo_ex() definition and use
Viktor Szakats [Tue, 1 Nov 2022 22:40:36 +0000 (22:40 +0000)] 
lib: sync guard for Curl_getaddrinfo_ex() definition and use

`Curl_getaddrinfo_ex()` gets _defined_ with `HAVE_GETADDRINFO` set. But,
`hostip4.c` _used_ it with `HAVE_GETADDRINFO_THREADSAFE` set alone. It
meant a build with the latter, but without the former flag could result
in calling this function but not defining it, and failing to link.

Patch this by adding an extra check for `HAVE_GETATTRINFO` around the
call.

Before this patch, build systems prevented this condition. Now they
don't need to.

While here, simplify the related CMake logic on Windows by setting
`HAVE_GETADDRINFO_THREADSAFE` to the detection result of
`HAVE_GETADDRINFO`. This expresses the following intent clearer than
the previous patch and keeps the logic in a single block of code:
When we have `getaddrinfo()` on Windows, it's always threadsafe.

Follow-up to 67d88626d44ec04b9e11dca4cfbf62cd29fe9781

Reviewed-by: Jay Satiro
Closes #9734

3 years agotidy-up: process.h detection and use
Viktor Szakats [Tue, 1 Nov 2022 22:27:28 +0000 (22:27 +0000)] 
tidy-up: process.h detection and use

This patch aims to cleanup the use of `process.h` header and the macro
`HAVE_PROCESS_H` associated with it.

- `process.h` is always available on Windows. In curl, it is required
  only for `_beginthreadex()` in `lib/curl_threads.c`.

- `process.h` is also available in MS-DOS. In curl, its only use was in
  `lib/smb.c` for `getpid()`. But `getpid()` is in fact declared by
  `unistd.h`, which is always enabled via `lib/config-dos.h`. So the
  header is not necessary.

- `HAVE_PROCESS_H` was detected by CMake, forced to 1 on Windows and
  left to real detection for other platforms.
  It was also set to always-on in `lib/config-win32.h` and
  `lib/config-dos.h`.
  In autotools builds, there was no detection and the macro was never
  set.

Based on these observations, in this patch we:

- Rework Windows `getpid` logic in `lib/smb.c` to always use the
  equivalent direct Win32 API function `GetCurrentProcessId()`, as we
  already did for Windows UWP apps. This makes `process.h` unnecessary
  here on Windows.

- Stop #including `process.h` into files where it was not necessary.
  This is everywhere, except `lib/curl_threads.c`.

  > Strangely enough, `lib/curl_threads.c` compiled fine with autotools
  > because `process.h` is also indirecty included via `unistd.h`. This
  > might have been broken in autotools MSVC builds, where the latter
  > header is missing.

- Delete all remaining `HAVE_PROCESS_H` feature guards, for they were
  unnecessary.

- Delete `HAVE_PROCESS_H` detection from CMake and predefined values
  from `lib/config-*.h` headers.

Reviewed-by: Jay Satiro
Closes #9703

3 years agolib1301: unit103 turned into a libtest
Daniel Stenberg [Mon, 31 Oct 2022 12:04:19 +0000 (13:04 +0100)] 
lib1301: unit103 turned into a libtest

It is not a unit test so moved over to libtests.

3 years agostrcase: use curl_str(n)equal for case insensitive matches
Daniel Stenberg [Mon, 31 Oct 2022 11:49:46 +0000 (12:49 +0100)] 
strcase: use curl_str(n)equal for case insensitive matches

No point in having two entry points for the same functions.

Also merged the *safe* function treatment into these so that they can
also be used when one or both pointers are NULL.

Closes #9837

3 years agoREADME.md: remove badges and xmas-tree garnish
Daniel Stenberg [Sun, 30 Oct 2022 22:56:41 +0000 (23:56 +0100)] 
README.md: remove badges and xmas-tree garnish

URL: https://curl.se/mail/lib-2022-10/0050.html

Closes #9833

3 years agogen.pl: do not generate CURLHELP bitmask lines > 79 characters
Patrick Monnerat [Mon, 31 Oct 2022 03:23:59 +0000 (04:23 +0100)] 
gen.pl: do not generate CURLHELP bitmask lines > 79 characters

If a command line option is in many help categories, there is a risk
that CURLHELP bitmask source lines generated for listhelp are longer
than 79 characters.

This change takes care of folding such long lines.

Cloes #9834

3 years agoCI/cirrus: remove superfluous double-quotes and sudo
Marc Hoersken [Sat, 15 Oct 2022 20:48:08 +0000 (22:48 +0200)] 
CI/cirrus: remove superfluous double-quotes and sudo

Follow up to #9565 and #9677
Closes #9738

3 years agotests/sshserver.pl: re-enable ssh-rsa while using openssh 8.8+
Marc Hoersken [Mon, 24 Oct 2022 19:33:01 +0000 (21:33 +0200)] 
tests/sshserver.pl: re-enable ssh-rsa while using openssh 8.8+

Ref: #9738

3 years agostyle: use space after comment start and before comment end
Daniel Stenberg [Sun, 30 Oct 2022 16:38:16 +0000 (17:38 +0100)] 
style: use space after comment start and before comment end

/* like this */

/*not this*/

checksrc is updated accordingly

Closes #9828

3 years agodocs: remove performance note in CURLOPT_SSL_VERIFYPEER
Patrick Schlangen [Sun, 30 Oct 2022 21:04:20 +0000 (22:04 +0100)] 
docs: remove performance note in CURLOPT_SSL_VERIFYPEER

This note became obsolete since PR #7892 (see also discussion in the PR
comments).

Closes #9832

3 years agotests/server: make use of strcasecompare from lib/
Daniel Stenberg [Sun, 30 Oct 2022 18:57:20 +0000 (19:57 +0100)] 
tests/server: make use of strcasecompare from lib/

... instead of having a second private implementation.

Idea triggered by #9830

Closes #9831

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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>
3 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

3 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
3 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

3 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

3 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

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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

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

3 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

3 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

3 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

3 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