]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
4 years agoCurl_timeleft: check both timeouts during connect 6745/head
Daniel Stenberg [Mon, 15 Mar 2021 07:11:26 +0000 (08:11 +0100)] 
Curl_timeleft: check both timeouts during connect

The duration of a connect and the total transfer are calculated from two
different time-stamps. It can end up with the total timeout triggering
before the connect timeout expires and we should make sure to
acknowledge whichever timeout that is reached first.

This is especially notable when a transfer first sits in PENDING, as
that time is counted in the total time but the connect timeout is based
on the time since the handle changed to the CONNECT state.

The CONNECTTIMEOUT is per connect attempt. The TIMEOUT is for the entire
operation.

Fixes #6744
Closes #6745
Reported-by: Andrei Bica
Assisted-by: Jay Satiro
4 years agoconfigure: remove use of deprecated macros
Daniel Stenberg [Mon, 15 Mar 2021 17:16:36 +0000 (18:16 +0100)] 
configure: remove use of deprecated macros

AC_HEADER_TIME, AC_HEADER_STDC and AC_TYPE_SIGNAL

4 years agoconfigure: make AC_TRY_* into AC_*_IFELSE
Daniel Stenberg [Mon, 15 Mar 2021 22:11:29 +0000 (23:11 +0100)] 
configure: make AC_TRY_* into AC_*_IFELSE

... as the former versions are deprecated.

4 years agoconfigure: s/AC_HELP_STRING/AS_HELP_STRING
Daniel Stenberg [Mon, 15 Mar 2021 16:32:26 +0000 (17:32 +0100)] 
configure: s/AC_HELP_STRING/AS_HELP_STRING

AC_HELP_STRING is deprecated in 2.70+ and I believe AS_HELP_STRING works
already since 2.59 so bump the minimum required version to that.

Reported-by: Emil Engler
Fixes #6647
Closes #6748

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 16 Mar 2021 16:27:22 +0000 (17:27 +0100)] 
RELEASE-NOTES: synced

4 years agotravis: use ubuntu nghttp2 package instead of build our own
Daniel Stenberg [Tue, 16 Mar 2021 09:06:34 +0000 (10:06 +0100)] 
travis: use ubuntu nghttp2 package instead of build our own

Closes #6751

4 years agotravis: bump wolfssl to 4.7.0
Daniel Stenberg [Tue, 16 Mar 2021 09:05:21 +0000 (10:05 +0100)] 
travis: bump wolfssl to 4.7.0

4 years agotravis: only build wolfssl when needed
Daniel Stenberg [Tue, 16 Mar 2021 09:04:35 +0000 (10:04 +0100)] 
travis: only build wolfssl when needed

Closes #6751

4 years agorustls: allocate a buffer for TLS data.
Jacob Hoffman-Andrews [Sun, 14 Mar 2021 01:54:43 +0000 (17:54 -0800)] 
rustls: allocate a buffer for TLS data.

Previously, rustls was using an on-stack array for TLS data. However,
crustls has an (unusual) requirement that buffers it deals with are
initialized before writing to them. By using calloc, we can ensure the
buffer is initialized once and then reuse it across calls.

Closes #6742

4 years agotravis: add a rustls build
Daniel Stenberg [Tue, 16 Mar 2021 08:51:17 +0000 (09:51 +0100)] 
travis: add a rustls build

... that doesn't run any tests (yet)

Closes #6750

4 years agoHTTP2: remove the outdated remark about multiplexing for the tool
Daniel Stenberg [Mon, 15 Mar 2021 23:35:38 +0000 (00:35 +0100)] 
HTTP2: remove the outdated remark about multiplexing for the tool

4 years agohttp2: don't set KEEP_SEND when there's no more data to be sent
Robert Ronto [Mon, 15 Mar 2021 14:35:10 +0000 (15:35 +0100)] 
http2: don't set KEEP_SEND when there's no more data to be sent

this should fix an issue where curl sometimes doesn't send out a request
with authorization info after a 401 is received over http2

Closes #6747

4 years agoconfig: fix building SMB with configure using Win32 Crypto
Marc Hoersken [Sat, 6 Mar 2021 14:52:09 +0000 (15:52 +0100)] 
config: fix building SMB with configure using Win32 Crypto

Align conditions for NTLM features between CMake and configure
builds by differentiating between USE_NTLM and USE_CURL_NTLM_CORE,
just like curl_setup.h does internally to detect support of:

- USE_NTLM: required for NTLM crypto authentication feature
- USE_CURL_NTLM_CORE: required for SMB protocol

Implement USE_WIN32_CRYPTO detection by checking for Crypt functions
in wincrypt.h which are not available in the Windows App environment.

Link advapi32 and crypt32 for Crypto API and Schannel SSL backend.
Fix condition of Schannel SSL backend in CMake build accordingly.

Reviewed-by: Marcel Raad
Closes #6277

4 years agoconfig: fix detection of restricted Windows App environment
Marc Hoersken [Thu, 4 Mar 2021 21:10:45 +0000 (22:10 +0100)] 
config: fix detection of restricted Windows App environment

Move the detection of the restricted Windows App environment
in curl_setup.h before the definition of USE_WIN32_CRYPTO
via included config-win32.h in case no build system is used.

Reviewed-by: Marcel Raad
Part of #6277

4 years agoHISTORY: curl 7.7.2 was the first version used in Mac OS X 10.1
Daniel Stenberg [Mon, 15 Mar 2021 08:00:50 +0000 (09:00 +0100)] 
HISTORY: curl 7.7.2 was the first version used in Mac OS X 10.1

4 years agogen.pl: quote "bare" minuses in the nroff curl.1
Daniel Stenberg [Thu, 11 Mar 2021 07:50:11 +0000 (08:50 +0100)] 
gen.pl: quote "bare" minuses in the nroff curl.1

Reported-by: Alejandro Colomar
Fixes #6698
Closes #6722

4 years agohsts: remove unused defines
Daniel Gustafsson [Sun, 14 Mar 2021 22:18:27 +0000 (23:18 +0100)] 
hsts: remove unused defines

MAX_HSTS_SUBLEN and MAX_HSTS_SUBLENSTR were unused from the initial commit,
and mostly likely leftovers from early development.  Remove as they're not
used for anything.

Closes #6741
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agogithub: add torture-ftp for FTP-only torture testing
Daniel Stenberg [Fri, 12 Mar 2021 10:55:47 +0000 (11:55 +0100)] 
github: add torture-ftp for FTP-only torture testing

and at 20% to try to keep the run-time reasonable

Closes #6728

4 years agotravis: split "torture" into a separate "events" build as well
Daniel Stenberg [Thu, 11 Mar 2021 15:18:53 +0000 (16:18 +0100)] 
travis: split "torture" into a separate "events" build as well

Run torture without FTP and reducing coverage to 20%

For some reason the torture tests now run a lot slower on travis and run
into the 50 minute limit all the time.

Closes #6728

4 years agoftp: fix memory leak in ftp_done
Daniel Stenberg [Fri, 12 Mar 2021 15:15:13 +0000 (16:15 +0100)] 
ftp: fix memory leak in ftp_done

If after a transfer is complete Curl_GetFTPResponse() returns an error,
curl would not free the ftp->pathalloc block.

Found by torture-testing test 576

Closes #6737

4 years agohttp2: fail if connection terminated without END_STREAM
oxalica [Fri, 12 Mar 2021 13:11:08 +0000 (21:11 +0800)] 
http2: fail if connection terminated without END_STREAM

Closes #6736

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 12 Mar 2021 15:35:46 +0000 (16:35 +0100)] 
RELEASE-NOTES: synced

4 years agorustls: support CURLOPT_SSL_VERIFYPEER
Jacob Hoffman-Andrews [Sat, 27 Feb 2021 01:29:36 +0000 (17:29 -0800)] 
rustls: support CURLOPT_SSL_VERIFYPEER

This requires the latest main branch of crustls, which provides
rustls_client_config_builder_dangerous_set_certificate_verifier and
rustls_client_config_builder_set_enable_sni.

This refactors the session setup into its own function, and adds a new
function cr_hostname_is_ip. Because crustls doesn't support verification
of IP addresses, special handling is needed: We disable SNI and set a
placeholder hostname (which never actually gets sent on the wire).

Closes #6719

4 years agocookies: Fix potential NULL pointer deref with PSL
Daniel Gustafsson [Fri, 12 Mar 2021 01:34:03 +0000 (02:34 +0100)] 
cookies: Fix potential NULL pointer deref with PSL

Curl_cookie_init can be called with data being NULL, and this can in turn
be passed to Curl_cookie_add, meaning that both functions must be careful
to only use data where it's checked for being a NULL pointer.  The libpsl
support code does however dereference data without checking, so if we are
indeed having an unset data pointer we cannot PSL check the cookiedomain.

This is currently not a reachable dereference, as the only caller with a
NULL data isn't passing a file to initialize cookies from, but since the
API has this contract let's ensure we hold it.

Closes #6731
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agoconfigure: only add OpenSSL paths if they are defined
Michael Hordijk [Tue, 9 Mar 2021 20:04:06 +0000 (15:04 -0500)] 
configure: only add OpenSSL paths if they are defined

Add paths for OpenSSL compiling and linking only if they have been
defined.  If they haven't been defined, we'll assume that the paths are
already available to the toolchain.

Closes #6730

4 years agoretry.d: Clarify transient 5xx HTTP response codes
Jay Satiro [Thu, 11 Mar 2021 08:08:13 +0000 (03:08 -0500)] 
retry.d: Clarify transient 5xx HTTP response codes

- Clarify the only 5xx response codes that are treated as transient are
  500, 502, 503 and 504.

Prior to this change it said it treated all 5xx as transient, but the
code says otherwise.

Ref: https://github.com/curl/curl/blob/curl-7_75_0/src/tool_operate.c#L462-L495

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

4 years agoretry-all-errors.d: Explain curl errors versus HTTP response errors
Jay Satiro [Thu, 11 Mar 2021 07:36:37 +0000 (02:36 -0500)] 
retry-all-errors.d: Explain curl errors versus HTTP response errors

- Add a paragraph explaining that curl does not consider HTTP response
  errors as curl errors, and how that behavior can be modified by using
  --retry and --fail.

The --retry-all-errors doc says "Retry on any error" which some users
may find misleading without the added explanation.

Ref: https://curl.se/docs/faq.html#Why_do_I_get_downloaded_data_eve
Ref: https://curl.se/docs/faq.html#curl_doesn_t_return_error_for_HT

Reported-by: Lawrence Gripper
Fixes https://github.com/curl/curl/issues/6712
Closes https://github.com/curl/curl/pull/6720

4 years agotravis: switch ngtcp2 build over to quictls
Daniel Stenberg [Thu, 11 Mar 2021 15:49:49 +0000 (16:49 +0100)] 
travis: switch ngtcp2 build over to quictls

The ngtcp2 project switched over to using the quictls OpenSSL fork
instead of their own patched OpenSSL. We follow suit.

Closes #6729

4 years agotest220/314: adjust to run with Hyper
Daniel Stenberg [Thu, 11 Mar 2021 15:05:46 +0000 (16:05 +0100)] 
test220/314: adjust to run with Hyper

4 years agoc-hyper: support automatic content-encoding
Daniel Stenberg [Thu, 11 Mar 2021 15:05:15 +0000 (16:05 +0100)] 
c-hyper: support automatic content-encoding

Closes #6727

4 years agohttp: remove superfluous NULL assign
Daniel Stenberg [Thu, 11 Mar 2021 15:04:56 +0000 (16:04 +0100)] 
http: remove superfluous NULL assign

Closes #6727

4 years agotool_operate: bail if set CURLOPT_HTTP09_ALLOWED returns error
Daniel Stenberg [Thu, 11 Mar 2021 14:37:52 +0000 (15:37 +0100)] 
tool_operate: bail if set CURLOPT_HTTP09_ALLOWED returns error

Closes #6727

4 years agosetopt: error on CURLOPT_HTTP09_ALLOWED set true with Hyper
Daniel Stenberg [Thu, 11 Mar 2021 14:37:14 +0000 (15:37 +0100)] 
setopt: error on CURLOPT_HTTP09_ALLOWED set true with Hyper

Not supported.

Closes #6727

4 years agotest306: make it not run with Hyper
Daniel Stenberg [Thu, 11 Mar 2021 14:36:47 +0000 (15:36 +0100)] 
test306: make it not run with Hyper

... as it tests HTTP/0.9 which Hyper doesn't support.

4 years agotest304: header CRLF cleanup to work with Hyper
Daniel Stenberg [Thu, 11 Mar 2021 14:36:21 +0000 (15:36 +0100)] 
test304: header CRLF cleanup to work with Hyper

4 years agoFTP: allow SIZE to fail when doing (resumed) upload
Daniel Stenberg [Thu, 11 Mar 2021 09:00:02 +0000 (10:00 +0100)] 
FTP: allow SIZE to fail when doing (resumed) upload

Added test 362 to verify.

Reported-by: Jordan Brown
Regression since 7ea2e1d0c5a7f (7.73.0)
Fixes #6715
Closes #6725

4 years agoconfigure: provide Largefile feature for curl-config
Daniel Stenberg [Tue, 9 Mar 2021 23:38:21 +0000 (00:38 +0100)] 
configure: provide Largefile feature for curl-config

... as cmake now does it correctly, and make test1014 check for it

Closes #6702

4 years agoconfig: remove CURL_SIZEOF_CURL_OFF_T use only SIZEOF_CURL_OFF_T
Daniel Stenberg [Mon, 8 Mar 2021 11:30:56 +0000 (12:30 +0100)] 
config: remove CURL_SIZEOF_CURL_OFF_T use only SIZEOF_CURL_OFF_T

Make the code consistently use a single name for the size of the
"curl_off_t" type.

Closes #6702

4 years agongtcp2: Fix build error due to change in ngtcp2_addr_init
Jun-ya Kato [Wed, 10 Mar 2021 14:26:16 +0000 (14:26 +0000)] 
ngtcp2: Fix build error due to change in ngtcp2_addr_init

ngtcp2/ngtcp2@b8d90a9 changed the function prototype.

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

4 years agomulti: update pending list when removing handle
ejanchivdorj [Tue, 9 Mar 2021 21:23:43 +0000 (13:23 -0800)] 
multi: update pending list when removing handle

when removing a handle, most of the lists are updated but pending list
is not updated. Updating now.

Closes #6713

4 years agolib1536: check ptr against NULL before dereferencing it
kokke [Tue, 9 Mar 2021 13:25:04 +0000 (14:25 +0100)] 
lib1536: check ptr against NULL before dereferencing it

Closes #6710

4 years agolib1537: check ptr against NULL before dereferencing it
kokke [Tue, 9 Mar 2021 13:10:41 +0000 (14:10 +0100)] 
lib1537: check ptr against NULL before dereferencing it

Fixes #6707
Closes #6708

4 years agotravis: make torture tests skip TLS-SRP tests
Daniel Stenberg [Tue, 9 Mar 2021 07:07:46 +0000 (08:07 +0100)] 
travis: make torture tests skip TLS-SRP tests

... as it seems to often hang.

Also: skip the "normal" tests as they're already run by many other
builds.

Closes #6705

4 years agoopenssl: adapt to v3's new const for a few API calls
Daniel Stenberg [Mon, 8 Mar 2021 22:11:19 +0000 (23:11 +0100)] 
openssl: adapt to v3's new const for a few API calls

Closes #6703

4 years agoquiche: fix crash when failing to connect
Daniel Stenberg [Mon, 8 Mar 2021 10:28:41 +0000 (11:28 +0100)] 
quiche: fix crash when failing to connect

Reported-by: ウさん
Fixes #6664
Closes #6701

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 8 Mar 2021 09:10:59 +0000 (10:10 +0100)] 
RELEASE-NOTES: synced

Fixed the release counter and added a missing contributor

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sat, 6 Mar 2021 21:51:31 +0000 (22:51 +0100)] 
RELEASE-NOTES: synced

4 years agodynbuf: bump the max HTTP request to 1MB
Daniel Stenberg [Wed, 3 Mar 2021 17:46:29 +0000 (18:46 +0100)] 
dynbuf: bump the max HTTP request to 1MB

Raised from 128KB to allow longer request headers.

Reported-by: Carl Zogheib
Fixes #6681
Closes #6685

4 years agoschannel: Evaluate CURLOPT_SSL_OPTIONS via SSL_SET_OPTION macro
Jay Satiro [Thu, 4 Mar 2021 08:02:38 +0000 (03:02 -0500)] 
schannel: Evaluate CURLOPT_SSL_OPTIONS via SSL_SET_OPTION macro

- Change use of those options from CURLOPT_SSL_OPTIONS that are not
  already evaluated via SSL_SET_OPTION in schannel and secure transport
  to use that instead of data->set.ssl.optname.

Example:

Evaluate SSL_SET_OPTION(no_revoke) instead of data->set.ssl.no_revoke.

This change is because options set via CURLOPT_SSL_OPTIONS
(data->set.ssl.optname) are separate from those set for HTTPS proxy via
CURLOPT_PROXY_SSL_OPTIONS (data->set.proxy_ssl.optname). The
SSL_SET_OPTION macro determines whether the connection is for HTTPS
proxy and based on that which option to evaluate.

Since neither Schannel nor Secure Transport backends currently support
HTTPS proxy in libcurl, this change is for posterity and has no other
effect.

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

4 years agoc-hyper: Remove superfluous pointer check
kokke [Fri, 5 Mar 2021 21:18:31 +0000 (22:18 +0100)] 
c-hyper: Remove superfluous pointer check

`n` pointer is never NULL once set. Found by static analysis.

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

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

4 years agoversion.d: Add missing features to the features list
Jay Satiro [Thu, 4 Mar 2021 04:44:54 +0000 (23:44 -0500)] 
version.d: Add missing features to the features list

- Add missing entries for gsasl, Kerberos, NTLM_WB, TrackMemory,
  Unicode and zstd.

- Remove krb4 since it's no longer a feature.

Reported-by: Ádler Jonas Gross
Fixes https://github.com/curl/curl/issues/6677
Closes https://github.com/curl/curl/pull/6687

4 years agodocs: add missing Arg tag to --stderr
Vladimir Varlamov [Thu, 4 Mar 2021 20:39:47 +0000 (23:39 +0300)] 
docs: add missing Arg tag to --stderr

Prior to this change the required argument was not shown.

curl.1 before: --stderr
curl.1 after: --stderr <file>

curl --help before:
     --stderr        Where to redirect stderr

curl --help after:
     --stderr <file>  Where to redirect stderr

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

4 years agoprojects: Update VS projects for OpenSSL 1.1.x
Jay Satiro [Mon, 1 Mar 2021 08:20:58 +0000 (03:20 -0500)] 
projects: Update VS projects for OpenSSL 1.1.x

- Update VS project templates to use the OpenSSL lib names and include
  directories for OpenSSL 1.1.x.

This change means the VS project files will now build only with OpenSSL
1.1.x when an OpenSSL configuration is chosen. Prior to this change the
project files built only with OpenSSL 1.0.x (end-of-life) when an
OpenSSL configuration was chosen.

The template changes in this commit were made by script:

libeay32.lib => libcrypto.lib
ssleay32.lib => libssl.lib
..\..\..\..\..\openssl\inc32 => ..\..\..\..\..\openssl\include

And since the output directory now contains the includes it's prepended:
..\..\..\..\..\openssl\build\Win{32,64}\VC{6..15}\{DLL,LIB}
{Debug,Release}\include

- Change build-openssl.bat to copy the build's include directory to the
  output directory (as seen above).

Each build has its own opensslconf.h which is different so we can't just
include the source include directory any longer.

Note the include directory in the output directory is a full copy from
the build so technically we don't need to include the OpenSSL source
include directory in the template. However, I left it last in case the
user made a custom OpenSSL build using the old method which would put
opensslconf in the OpenSSL source include directory.

- Change build-openssl.bat to use a temporary install directory that is
  different from the temporary build directory.

For OpenSSL 1.1.x the temporary paths must be separate not a descendant
of the other, otherwise pdb files will be lost between builds.

Ref: https://curl.se/mail/lib-2018-10/0049.html
Ref: https://gist.github.com/jay/125191c35bbeb894444eff827651f755
Ref; https://github.com/openssl/openssl/issues/10005

Fixes https://github.com/curl/curl/issues/984
Closes https://github.com/curl/curl/pull/6675

4 years agodoh: Inherit CURLOPT_STDERR from user's easy handle
Jay Satiro [Thu, 25 Feb 2021 20:49:00 +0000 (15:49 -0500)] 
doh: Inherit CURLOPT_STDERR from user's easy handle

Prior to this change if the user set their easy handle's error stream
to something other than stderr it was not inherited by the doh handles,
which meant that they would still write to the default standard error
stream (stderr) for verbose output.

Bug: https://github.com/curl/curl/issues/6605
Reported-by: arvids-kokins-bidstack@users.noreply.github.com
Closes https://github.com/curl/curl/pull/6661

4 years agoCI/azure: replace python-impacket with python3-impacket 6678/head
Marc Hoersken [Mon, 1 Mar 2021 20:37:25 +0000 (21:37 +0100)] 
CI/azure: replace python-impacket with python3-impacket

As of this month Azure DevOps uses Ubuntu 20.04 LTS which
no longer supports Python 2 and instead ships Python 3.

Closes #6678

4 years agoruntests.pl: kill processes locking test log files
Marc Hoersken [Sun, 28 Feb 2021 21:06:17 +0000 (22:06 +0100)] 
runtests.pl: kill processes locking test log files

Introduce a new runtests.pl command option: -rm

For now only required and implemented for Windows.
Ignore stunnel logs due to long running processes.

Requires Sysinternals handle[64].exe to be on PATH.

Reviewed-by: Jay Satiro
Ref: #6058
Closes #6179

4 years agopathhelp.pm: fix use of pwd -L in Msys environment
Marc Hoersken [Wed, 11 Nov 2020 20:20:20 +0000 (21:20 +0100)] 
pathhelp.pm: fix use of pwd -L in Msys environment

While Msys2 has a pwd binary which supports -L,
Msys1 only has a shell built-in with that feature.

Reviewed-by: Jay Satiro
Part of #6179

4 years agoldap: use correct memory free function
Daniel Gustafsson [Mon, 1 Mar 2021 08:31:33 +0000 (09:31 +0100)] 
ldap: use correct memory free function

unescaped is coming from Curl_urldecode and not a unicode conversion
function, so reclaiming its memory should be performed with a normal
call to free rather than curlx_unicodefree.  In reality, this is the
same thing as curlx_unicodefree is implemented as a call to free but
that's not guaranteed to always hold.  Using the curlx macro present
issues with memory debugging as well.

Closes #6671
Reviewed-by: Jay Satiro <raysatiro@yahoo.com>
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agourl: fix typo in comment
Daniel Gustafsson [Sun, 28 Feb 2021 20:13:26 +0000 (21:13 +0100)] 
url: fix typo in comment

Correct a small typo which snuck in with a304051620.

4 years agotool_help: Increase space between option and description
Jay Satiro [Sat, 27 Feb 2021 23:08:53 +0000 (18:08 -0500)] 
tool_help: Increase space between option and description

- Increase the minimum number of spaces between the option and the
  description from 1 to 2.

Before:
~~~
 -u, --user <user:password> Server user and password
 -A, --user-agent <name> Send User-Agent <name> to server
 -v, --verbose       Make the operation more talkative
 -V, --version       Show version number and quit
 -w, --write-out <format> Use output FORMAT after completion
     --xattr         Store metadata in extended file attributes
~~~

After:
~~~
 -u, --user <user:password>  Server user and password
 -A, --user-agent <name>  Send User-Agent <name> to server
 -v, --verbose       Make the operation more talkative
 -V, --version       Show version number and quit
 -w, --write-out <format>  Use output FORMAT after completion
     --xattr         Store metadata in extended file attributes
~~~

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

4 years agocurl: set CURLOPT_NEW_FILE_PERMS if requested
Daniel Stenberg [Fri, 26 Feb 2021 10:18:09 +0000 (11:18 +0100)] 
curl: set CURLOPT_NEW_FILE_PERMS if requested

The --create-file-mode code logic accepted the value but never actually
passed it on to libcurl!

Follow-up to a7696c73436f (shipped in 7.75.0)
Reported-by: Johannes Lesr
Fixes #6657
Closes #6666

4 years agotool_operate: check argc before accessing argv[1]
Daniel Stenberg [Fri, 26 Feb 2021 14:00:51 +0000 (15:00 +0100)] 
tool_operate: check argc before accessing argv[1]

Follow-up to 09363500b
Reported-by: Emil Engler
Reviewed-by: Daniel Gustafsson
Closes #6668

4 years agoopenssl: remove get_ssl_version_txt in favor of SSL_get_version
Jean-Philippe Menil [Fri, 26 Feb 2021 08:10:18 +0000 (09:10 +0100)] 
openssl: remove get_ssl_version_txt in favor of SSL_get_version

openssl: use SSL_get_version to get connection protocol

Replace our bespoke get_ssl_version_txt in favor of SSL_get_version.
We can get rid of few lines of code, since SSL_get_version achieve
the exact same thing

Closes #6665
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Signed-off-by: Jean-Philippe Menil <jpmenil@gmail.com>
4 years agognutls: Fix nettle discovery
Daniel Gustafsson [Thu, 25 Feb 2021 17:20:33 +0000 (18:20 +0100)] 
gnutls: Fix nettle discovery

Commit e06fa7462ac258c removed support for libgcrypt leaving only
support for nettle which has been the default crypto library in
GnuTLS for a long time. There were however a few conditionals on
USE_GNUTLS_NETTLE which cause compilation errors in the metalink
code (as it used the gcrypt fallback instead as a result). See the
below autobuild for an example of the error:

  https://curl.se/dev/log.cgi?id=20210225123226-30704#prob1

This removes all uses of USE_GNUTLS_NETTLE and also removes the
gcrypt support from the metalink code while at it.

Closes #6656
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agocookies: Support multiple -b parameters
Daniel Gustafsson [Thu, 25 Feb 2021 17:12:28 +0000 (18:12 +0100)] 
cookies: Support multiple -b parameters

Previously only a single -b cookie parameter was supported with the last
one winning.  This adds support for supplying multiple -b params to have
them serialized semicolon separated.  Both cookiefiles and cookies can be
entered multiple times.

Closes #6649
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agobuild: remove all traces of USE_BLOCKING_SOCKETS
Daniel Stenberg [Thu, 25 Feb 2021 11:45:21 +0000 (12:45 +0100)] 
build: remove all traces of USE_BLOCKING_SOCKETS

libcurl doesn't behave properly with the define set

Closes #6655

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 25 Feb 2021 10:39:44 +0000 (11:39 +0100)] 
RELEASE-NOTES: synced

4 years agodocs: Fix typos
Daniel Gustafsson [Thu, 25 Feb 2021 08:28:00 +0000 (09:28 +0100)] 
docs: Fix typos

Random typos spotted when skimming docs.

4 years agocookies: Use named parameters in header prototypes
Daniel Gustafsson [Tue, 23 Feb 2021 21:00:02 +0000 (22:00 +0100)] 
cookies: Use named parameters in header prototypes

Align header with project style of using named parameters in the
function prototypes to aid readability and self-documentation.

Closes #6653
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agourldata: make 'actions[]' use unsigned char instead of int
Daniel Stenberg [Wed, 24 Feb 2021 07:15:17 +0000 (08:15 +0100)] 
urldata: make 'actions[]' use unsigned char instead of int

... as it only needs a few bits per index anyway.

Reviewed-by: Daniel Gustafsson
Closes #6648

4 years agoconfigure: fail if --with-quiche is used and quiche isn't found
Daniel Stenberg [Wed, 24 Feb 2021 10:26:52 +0000 (11:26 +0100)] 
configure: fail if --with-quiche is used and quiche isn't found

Closes #6652

4 years agocmake: use CMAKE_INSTALL_INCLUDEDIR indirection
Gregor Jasny [Tue, 12 Jan 2021 13:11:07 +0000 (14:11 +0100)] 
cmake: use CMAKE_INSTALL_INCLUDEDIR indirection

Reviewed-by: Sergei Nikulov
Closes #6440

4 years agomingw: enable using strcasecmp()
Viktor Szakats [Tue, 23 Feb 2021 12:06:55 +0000 (12:06 +0000)] 
mingw: enable using strcasecmp()

This makes the 'Features:' list sorted case-insensitively,
bringing output in-line with *nix builds.

Reviewed-by: Jay Satiro
Closes #6644

4 years agobuild: delete unused feature guards
Viktor Szakats [Tue, 23 Feb 2021 12:04:29 +0000 (12:04 +0000)] 
build: delete unused feature guards

- `HAVE_STRNCASECMP`
- `HAVE_TCGETATTR`
- `HAVE_TCSETATTR`

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

4 years agodocs: add CURLOPT_CURLU to 'See also' in curl_url_ functions
Jay Satiro [Sun, 21 Feb 2021 22:46:14 +0000 (17:46 -0500)] 
docs: add CURLOPT_CURLU to 'See also' in curl_url_ functions

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

4 years agoconfigure: make hyper opt-in, and fail if missing
Jacob Hoffman-Andrews [Fri, 12 Feb 2021 01:14:28 +0000 (17:14 -0800)] 
configure: make hyper opt-in, and fail if missing

Previously, configure would look for hyper by default, and use it if
found; otherwise it would not use hyper, and not error.

Now, configure will not look for hyper unless --with-hyper is passed. If
configure looks for hyper and fails, it will error.

Also, add -ld -lpthread -lm to Hyper's libs. I think they are required.

Closes #6598

4 years agomulti: do once-per-transfer inits in before_perform in DID state
Daniel Stenberg [Mon, 22 Feb 2021 12:03:02 +0000 (13:03 +0100)] 
multi: do once-per-transfer inits in before_perform in DID state

... since the state machine might go to RATELIMITING and then back to
PERFORMING doing once-per-transfer inits in that function is wrong and
it caused problems with receiving chunked HTTP and it set the
PRETRANSFER time much too often...

Regression from b68dc34af341805aeb7b3715 (shipped in 7.75.0)

Reported-by: Amaury Denoyelle
Fixes #6640
Closes #6641

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 21 Feb 2021 22:39:39 +0000 (23:39 +0100)] 
RELEASE-NOTES: synced

4 years agoCODE_STYLE.md: fix broken link to INTERNALS
Daniel Stenberg [Sun, 21 Feb 2021 22:32:59 +0000 (23:32 +0100)] 
CODE_STYLE.md: fix broken link to INTERNALS

... the link would only work if browsed on GitHub, while this link now
takes the user to the website instead and thus should work on either.

Reported-by: David Demelier
4 years agocurl_url_set.3: mention CURLU_PATH_AS_IS
Daniel Stenberg [Sun, 21 Feb 2021 12:58:47 +0000 (13:58 +0100)] 
curl_url_set.3: mention CURLU_PATH_AS_IS

... it has been supported since the URL API was added.

Bug: https://curl.se/mail/lib-2021-02/0046.html

Closes #6638

4 years agotime: enable 64-bit time_t in supported mingw environments
Viktor Szakats [Sun, 21 Feb 2021 02:00:36 +0000 (02:00 +0000)] 
time: enable 64-bit time_t in supported mingw environments

(Unless 32-bit `time_t` is selected manually via the `_USE_32BIT_TIME_T`
mingw macro.)

Previously, 64-bit `time_t` was enabled on VS2005 and newer only, and
32-bit `time_t` was used on all other Windows builds.

Assisted-by: Jay Satiro
Closes #6636

4 years agotest1188: Check for --fail HTTP status
Jay Satiro [Fri, 19 Feb 2021 23:30:18 +0000 (18:30 -0500)] 
test1188: Check for --fail HTTP status

- Change the test to check for curl error on HTTP 404 Not Found.

test1188 tests "--write-out with %{onerror} and %{urlnum} to stderr".
Prior to this change it did that by specifying a non-existent host which
would cause an error. ISPs may hijack DNS and resolve non-existent hosts
so the test would not work if that was the case.

Ref: https://en.wikipedia.org/wiki/DNS_hijacking#Manipulation_by_ISPs
Ref: https://github.com/curl/curl/issues/6621
Ref: https://github.com/curl/curl/pull/6623

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

4 years agomemdebug: close debug logfile explicitly on exit
Jay Satiro [Wed, 17 Feb 2021 22:46:16 +0000 (17:46 -0500)] 
memdebug: close debug logfile explicitly on exit

- Use atexit to register a dbg cleanup function that closes the logfile.

LeakSantizier (LSAN) calls _exit() instead of exit() when a leak is
detected on exit so the logfile must be closed explicitly or data could
be lost. Though _exit() does not call atexit handlers such as this,
LSAN's call to _exit() comes after the atexit handlers are called.

Prior to this change the logfile was not explicitly closed so it was
possible that if LSAN detected a leak and called _exit (which does
not flush or close files like exit) then the logfile could be missing
data. That could then cause curl's memanalyze to report false leaks
(eg a malloc was recorded to the logfile but the corresponding free was
discarded from the buffer instead of written to the logfile, then
memanalyze reports that as a leak).

Ref: https://github.com/google/sanitizers/issues/1374

Bug: https://github.com/curl/curl/pull/6591#issuecomment-780396541

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

4 years agocurl_multibyte: always return a heap-allocated copy of string
Jay Satiro [Sat, 13 Feb 2021 05:51:28 +0000 (00:51 -0500)] 
curl_multibyte: always return a heap-allocated copy of string

- Change the Windows char <-> UTF-8 conversion functions to return an
  allocated copy of the passed in string instead of the original.

Prior to this change the curlx_convert_ functions would, as what I
assume was an optimization, not make a copy of the passed in string if
no conversion was required. No conversion is required in non-UNICODE
Windows builds since our tchar strings are type char and remain in
whatever the passed in encoding is, which is assumed to be UTF-8 but may
be other encoding.

In contrast the UNICODE Windows builds require conversion
(wchar <-> char) and do return a copy. That inconsistency could lead to
programming errors where the developer expects a copy, and does not
realize that won't happen in all cases.

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

4 years agohttp: add new files missed from referrer commit
Viktor Szakats [Fri, 19 Feb 2021 16:17:44 +0000 (16:17 +0000)] 
http: add new files missed from referrer commit

Ref: 44872aefc2d54f297caf2b0cc887df321bc9d791
Ref: #6591

4 years agohttp: add support to read and store the referrer header
Viktor Szakats [Fri, 19 Feb 2021 13:57:19 +0000 (13:57 +0000)] 
http: add support to read and store the referrer header

- add CURLINFO_REFERER libcurl option
- add --write-out '%{referer}' command-line option
- extend --xattr command-line option to fill user.xdg.referrer.url extended
  attribute with the referrer (if there was any)

Closes #6591

4 years agourldata: remove the _ORIG suffix from string names
Daniel Stenberg [Thu, 18 Feb 2021 09:13:56 +0000 (10:13 +0100)] 
urldata: remove the _ORIG suffix from string names

It doesn't provide any useful info but only makes the names longer.

Closes #6624

4 years agourl: fix memory leak if OOM in the HSTS handling
Daniel Stenberg [Thu, 18 Feb 2021 22:24:30 +0000 (23:24 +0100)] 
url: fix memory leak if OOM in the HSTS handling

Reported-by: Viktor Szakats
Bug: https://github.com/curl/curl/pull/6627#issuecomment-781626205

Closes #6628

4 years agognutls: assume nettle crypto support
Daniel Stenberg [Thu, 18 Feb 2021 10:42:46 +0000 (11:42 +0100)] 
gnutls: assume nettle crypto support

nettle has been the default crypto library with GnuTLS since 2010. By
dropping support for the previous libcrypto, we simplify code.

Closes #6625

4 years agoasyn-ares: use consistent resolve error message
Daniel Stenberg [Thu, 18 Feb 2021 12:14:55 +0000 (13:14 +0100)] 
asyn-ares: use consistent resolve error message

... with the help of Curl_resolver_error() which now is moved from
asyn-thead.c and is provided globally for this purpose.

Follow-up to 35ca04ce1b77636

Makes test 1188 work for c-ares builds

Closes #6626

4 years agoci: stop building on freebsd-12-1
Viktor Szakats [Thu, 18 Feb 2021 11:18:36 +0000 (11:18 +0000)] 
ci: stop building on freebsd-12-1

An updated freebsd-12-2 image was added a few months ago, and this
older one is consistently failing to go past `pkginstall`:
```
Newer FreeBSD version for package py37-mlt:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1202000
- running kernel: 1201000
Ignore the mismatch and continue? [Y/n]: pkg: repository FreeBSD contains packages for wrong OS version: FreeBSD:12:amd64
```

FreeBSD thread suggests that 12.1 is EOL, and best to avoid.

Ref: https://forums.freebsd.org/threads/78856/

Reviewed-by: Daniel Stenberg
Closes #6622

4 years agotest1188: change error from connect to resolve error
Daniel Stenberg [Thu, 18 Feb 2021 07:30:35 +0000 (08:30 +0100)] 
test1188: change error from connect to resolve error

Using the %NOLISTENPORT to trigger a connection failure is somewhat
"risky" (since it isn't guaranteed to not be listened to) and caused
occasional CI problems. This fix changes the infused error to be a more
reliable one but still verifies the --write-out functionality properly -
which is the purpose of this test.

Reported-by: Jay Satiro
Fixes #6621
Closes #6623

4 years agourl.c: use consistent error message for failed resolve
Daniel Stenberg [Thu, 18 Feb 2021 08:57:30 +0000 (09:57 +0100)] 
url.c: use consistent error message for failed resolve

4 years agoBUGS: language polish
Daniel Stenberg [Thu, 18 Feb 2021 07:47:27 +0000 (08:47 +0100)] 
BUGS: language polish

4 years agowolfssl: don't store a NULL sessionid
Daniel Stenberg [Wed, 17 Feb 2021 13:19:57 +0000 (14:19 +0100)] 
wolfssl: don't store a NULL sessionid

This caused a memory leak as the session id cache entry was still
erroneously stored with a NULL sessionid and that would later be treated
as not needed to get freed.

Reported-by: Gisle Vanem
Fixes #6616
Closes #6617

4 years agoparse_proxy: fix a memory leak in the OOM path
Daniel Stenberg [Wed, 17 Feb 2021 10:53:32 +0000 (11:53 +0100)] 
parse_proxy: fix a memory leak in the OOM path

Reported-by: Jay Satiro
Reviewed-by: Jay Satiro
Reviewed-by: Emil Engler
Closes #6614
Bug: https://github.com/curl/curl/pull/6591#issuecomment-780396541

4 years agourl: fix possible use-after-free in default protocol
Jay Satiro [Tue, 16 Feb 2021 22:13:22 +0000 (17:13 -0500)] 
url: fix possible use-after-free in default protocol

Prior to this change if the user specified a default protocol and a
separately allocated non-absolute URL was used then it was freed
prematurely, before it was then used to make the replacement URL.

Bug: https://github.com/curl/curl/issues/6604#issuecomment-780138219
Reported-by: arvids-kokins-bidstack@users.noreply.github.com
Closes https://github.com/curl/curl/pull/6613

4 years agomulti: rename the multi transfer states
Daniel Stenberg [Tue, 16 Feb 2021 07:19:24 +0000 (08:19 +0100)] 
multi: rename the multi transfer states

While working on documenting the states it dawned on me that step one is
to use more descriptive names on the states. This also changes prefix on
the states to make them shorter in the source.

State names NOT ending with *ing are transitional ones.

Closes #6612

4 years agohttp: do not add a referrer header with empty value
Viktor Szakats [Tue, 16 Feb 2021 10:19:37 +0000 (10:19 +0000)] 
http: do not add a referrer header with empty value

Previously an empty 'Referer:' header was added to the HTTP request when
passing `--referer ';auto'` or `--referer ''` on the command-line. This
patch makes `--referer` work like `--header 'Referer:'` and will only add
the header if it has a non-zero length value.

Reviewed-by: Jay Satiro
Closes #6610

4 years agolib: remove 'conn->data' completely
Daniel Stenberg [Mon, 15 Feb 2021 09:15:46 +0000 (10:15 +0100)] 
lib: remove 'conn->data' completely

The Curl_easy pointer struct entry in connectdata is now gone. Just
before commit 215db086e0 landed on January 8, 2021 there were 919
references to conn->data.

Closes #6608