]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
3 years agotool: use feature names instead of bit mask, when possible
Patrick Monnerat [Tue, 8 Nov 2022 23:37:49 +0000 (00:37 +0100)] 
tool: use feature names instead of bit mask, when possible

If the run-time libcurl is too old to support feature names, the name
array is created locally from the bit masks. This is the only sequence
left that uses feature bit masks.

Closes #9583

3 years agodocs: curl_version_info is not thread-safe before libcurl initialization
Patrick Monnerat [Sun, 25 Sep 2022 15:30:23 +0000 (17:30 +0200)] 
docs: curl_version_info is not thread-safe before libcurl initialization

Closes #9583

3 years agoversion: add a feature names array to curl_version_info_data
Patrick Monnerat [Tue, 8 Nov 2022 23:27:32 +0000 (00:27 +0100)] 
version: add a feature names array to curl_version_info_data

Field feature_names contains a null-terminated sorted array of feature
names. Bitmask field features is deprecated.

Documentation is updated. Test 1177 and tests/version-scan.pl updated to
match new documentation format and extended to check feature names too.

Closes #9583

3 years agonegtelnetserver.py: have it call its close() method
Stefan Eissing [Fri, 11 Nov 2022 15:39:06 +0000 (16:39 +0100)] 
negtelnetserver.py: have it call its close() method

Closes #9894

3 years agontlm: silence ubsan warning about copying from null target_info pointer.
Nathan Moinvaziri [Sat, 12 Nov 2022 00:42:18 +0000 (16:42 -0800)] 
ntlm: silence ubsan warning about copying from null target_info pointer.

runtime error: null pointer passed as argument 2, which is declared to
never be null

Closes #9898

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 11 Nov 2022 23:54:35 +0000 (00:54 +0100)] 
RELEASE-NOTES: synced

3 years agoWebsocket: fixes for partial frames and buffer updates.
Stefan Eissing [Fri, 11 Nov 2022 14:15:37 +0000 (15:15 +0100)] 
Websocket: fixes for partial frames and buffer updates.

- buffers updated correctly when handling partial frames
- callbacks no longer invoked for incomplete payload data of 0 length
- curl_ws_recv no longer returns with 0 length partial payload

Closes #9890

3 years agotool_operate: provide better errmsg for -G with bad URL
Daniel Stenberg [Fri, 11 Nov 2022 14:46:17 +0000 (15:46 +0100)] 
tool_operate: provide better errmsg for -G with bad URL

If the URL that -G would try to add a query to could not be parsed, it would
display

 curl: (27) Out of memory

It now instead shows:

 curl: (2) Could not parse the URL, failed to set query

Reported-by: Alex Xu
Fixes #9889
Closes #9892

3 years agovtls: fix build without proxy support
Daniel Stenberg [Fri, 11 Nov 2022 16:45:08 +0000 (17:45 +0100)] 
vtls: fix build without proxy support

Follow-up to dafdb20a26d0c890

Closes #9895

3 years agotool_getparam: make --no-get work as the opposite of --get
Daniel Stenberg [Fri, 11 Nov 2022 14:37:36 +0000 (15:37 +0100)] 
tool_getparam: make --no-get work as the opposite of --get

... as documented.

Closes #9891

3 years agohttp: mark it 'this_is_a_follow' in the Location: logic
Daniel Stenberg [Fri, 11 Nov 2022 07:47:12 +0000 (08:47 +0100)] 
http: mark it 'this_is_a_follow' in the Location: logic

To make regular auth "reloads" to not count as redirects.

Verified by test 3101

Fixes #9885
Closes #9887

3 years agoconfig-win32: fix SIZEOF_OFF_T for MSVC and old MinGW
Viktor Szakats [Fri, 11 Nov 2022 20:12:15 +0000 (20:12 +0000)] 
config-win32: fix SIZEOF_OFF_T for MSVC and old MinGW

The previously set default value of 8 (64-bit) is only correct for
mingw-w64 and only when we set `_FILE_OFFSET_BITS` to 64 (the default
when building curl). For MSVC, old MinGW and other Windows compilers,
the correct value is 4 (32-bit). Adjust condition accordingly. Also
drop the manual override option.

Regression in 7.86.0 (from 68fa9bf3f5d7b4fcbb57619f70cb4aabb79a51f6)

Bug: https://github.com/curl/curl/pull/9712#issuecomment-1307330551

Reported-by: Peter Piekarski
Reviewed-by: Jay Satiro
Closes #9872

3 years agolib: remove bad set.opt_no_body assignments
Daniel Stenberg [Fri, 11 Nov 2022 09:57:04 +0000 (10:57 +0100)] 
lib: remove bad set.opt_no_body assignments

This struct field MUST remain what the application set it to, so that
handle reuse and handle duplication work.

Instead, the request state bit 'no_body' is introduced for code flows
that need to change this in run-time.

Closes #9888

3 years agolib: connection filters (cfilter) addition to curl:
Stefan Eissing [Fri, 11 Nov 2022 10:45:34 +0000 (11:45 +0100)] 
lib: connection filters (cfilter) addition to curl:

 - general construct/destroy in connectdata
 - default implementations of callback functions
 - connect: cfilters for connect and accept
 - socks: cfilter for socks proxying
 - http_proxy: cfilter for http proxy tunneling
 - vtls: cfilters for primary and proxy ssl
 - change in general handling of data/conn
 - Curl_cfilter_setup() sets up filter chain based on data settings,
   if none are installed by the protocol handler setup
 - Curl_cfilter_connect() boot straps filters into `connected` status,
   used by handlers and multi to reach further stages
 - Curl_cfilter_is_connected() to check if a conn is connected,
   e.g. all filters have done their work
 - Curl_cfilter_get_select_socks() gets the sockets and READ/WRITE
   indicators for multi select to work
 - Curl_cfilter_data_pending() asks filters if the have incoming
   data pending for recv
 - Curl_cfilter_recv()/Curl_cfilter_send are the general callbacks
   installed in conn->recv/conn->send for io handling
 - Curl_cfilter_attach_data()/Curl_cfilter_detach_data() inform filters
   and addition/removal of a `data` from their connection
 - adding vtl functions to prevent use of Curl_ssl globals directly
   in other parts of the code.

Reviewed-by: Daniel Stenberg
Closes #9855

3 years agocurl-rustls.m4: on macOS, rustls also needs the Security framework
Stefan Eissing [Thu, 10 Nov 2022 15:30:16 +0000 (16:30 +0100)] 
curl-rustls.m4: on macOS, rustls also needs the Security framework

Closes #9883

3 years agortsp: only store first_host once
Daniel Stenberg [Thu, 10 Nov 2022 07:38:01 +0000 (08:38 +0100)] 
rtsp: only store first_host once

Suggested-by: Erik Janssen
URL: https://github.com/curl/curl/pull/9870#issuecomment-1309499744
Closes #9882

3 years agotest3028: verify PROXY
Fata Nugraha [Wed, 9 Nov 2022 11:11:05 +0000 (18:11 +0700)] 
test3028: verify PROXY

3 years agohttp: do not send PROXY more than once
Fata Nugraha [Wed, 9 Nov 2022 09:38:00 +0000 (16:38 +0700)] 
http: do not send PROXY more than once

Unlike `CONNECT`, currently we don't keep track whether `PROXY` is
already sent or not. This causes `PROXY` header to be sent twice during
`MSTATE_TUNNELING` and `MSTATE_PROTOCONNECT`.

Closes #9878
Fixes #9442

3 years agolib: add CURL_WRITEFUNC_ERROR to signal write callback error
Jay Satiro [Tue, 8 Nov 2022 23:49:21 +0000 (18:49 -0500)] 
lib: add CURL_WRITEFUNC_ERROR to signal write callback error

Prior to this change if the user wanted to signal an error from their
write callbacks they would have to use logic to return a value different
from the number of bytes (nmemb) passed to the callback. Also, the
inclination of some users has been to just return 0 to signal error,
which is incorrect as that may be the number of bytes passed to the
callback.

To remedy this the user can now return CURL_WRITEFUNC_ERROR instead.

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

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

3 years agoRevert "GHA: add scorecard.yml"
Daniel Stenberg [Wed, 9 Nov 2022 09:29:19 +0000 (10:29 +0100)] 
Revert "GHA: add scorecard.yml"

This reverts commit ca76c79b34f9d90105674a2151bf228ff7b13bef.

3 years agoGHA: add scorecard.yml
Daniel Stenberg [Wed, 9 Nov 2022 09:10:33 +0000 (10:10 +0100)] 
GHA: add scorecard.yml

add a "scorecard" scanner job

3 years agotest3100: RTSP Basic authentication
Lorenzo Miniero [Wed, 7 Sep 2022 14:02:57 +0000 (16:02 +0200)] 
test3100: RTSP Basic authentication

Closes #9449

3 years agortsp: fix RTSP auth
Daniel Stenberg [Tue, 8 Nov 2022 14:34:12 +0000 (15:34 +0100)] 
rtsp: fix RTSP auth

Verified with test 3100

Fixes #4750
Closes #9870

3 years agoKNOWN_BUGS: remove eight entries
Daniel Stenberg [Thu, 27 Oct 2022 08:21:27 +0000 (10:21 +0200)] 
KNOWN_BUGS: remove eight entries

- 1.2 Multiple methods in a single WWW-Authenticate: header

This is not considered a bug anymore but a restriction and one that we
keep because we have NEVER gotten this reported by users in the wild and
because of this I consider this a fringe edge case we don't need to
support.

- 1.6 Unnecessary close when 401 received waiting for 100

This is not a bug, but possibly an optimization that *can* be done.

- 1.7 Deflate error after all content was received

This is not a curl bug. This happens due to broken servers.

- 2.1 CURLINFO_SSL_VERIFYRESULT has limited support

This is not a bug. This is just the nature of the implementation.

- 2.2 DER in keychain

This is not a bug.

- 5.7 Visual Studio project gaps

This is not a bug.

- 15.14 cmake build is not thread-safe

Fixed in 109e9730ee5e2b

- 11.3 Disconnects do not do verbose

This is not a bug.

Closes #9871

3 years agoheaders: add endif comments
Hirotaka Tagawa [Sat, 5 Nov 2022 08:03:16 +0000 (17:03 +0900)] 
headers: add endif comments

Closes #9853

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