]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
5 years agoopenssl: Don't ignore CA paths when using Windows CA store 5585/head
Jay Satiro [Mon, 22 Jun 2020 16:01:32 +0000 (12:01 -0400)] 
openssl: Don't ignore CA paths when using Windows CA store

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

The change is due to the impending release. The issue is still being
discussed. The behavior of CURLSSLOPT_NATIVE_CA is subject to change and
is now documented as experimental.

Ref: bc052cc (parent commit)
Ref: https://github.com/curl/curl/issues/5585

5 years agotool_operate: Don't use Windows CA store as a fallback
Jay Satiro [Sat, 20 Jun 2020 06:39:37 +0000 (02:39 -0400)] 
tool_operate: Don't use Windows CA store as a fallback

Background:

148534d added CURLSSLOPT_NATIVE_CA to use the Windows OS certificate
store in libcurl w/ OpenSSL on Windows. CURLSSLOPT_NATIVE_CA overrides
CURLOPT_CAINFO if both are set. The curl tool will fall back to
CURLSSLOPT_NATIVE_CA if it could not find a certificate bundle to set
via CURLOPT_CAINFO.

Problem:

libcurl may be built with hardcoded paths to a certificate bundle or
directory, and if CURLSSLOPT_NATIVE_CA is used then those paths are
ignored.

Solution:

A solution is still being discussed but since there's an impending
release this commit removes using CURLSSLOPT_NATIVE_CA in the curl tool.

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

5 years agoopenssl: Fix CA fallback logic for OpenSSL 3.0 build
Jay Satiro [Mon, 22 Jun 2020 16:13:55 +0000 (12:13 -0400)] 
openssl: Fix CA fallback logic for OpenSSL 3.0 build

Prior to this change I assume a build error would occur when
CURL_CA_FALLBACK was used.

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

5 years agocopyright: update mismatched copyright years
Daniel Stenberg [Mon, 22 Jun 2020 09:55:03 +0000 (11:55 +0200)] 
copyright: update mismatched copyright years

5 years agotest1460: verify that -Ji is not ok
Daniel Stenberg [Sun, 31 May 2020 21:10:22 +0000 (23:10 +0200)] 
test1460: verify that -Ji is not ok

5 years agotool_getparam: -i is not OK if -J is used
Daniel Stenberg [Sun, 31 May 2020 21:09:59 +0000 (23:09 +0200)] 
tool_getparam: -i is not OK if -J is used

Reported-by: sn on hackerone
Bug: https://curl.haxx.se/docs/CVE-2020-8177.html

5 years agoCMake: ignore INTERFACE_LIBRARY targets for pkg-config file
Peter Wu [Thu, 4 Jun 2020 09:28:01 +0000 (11:28 +0200)] 
CMake: ignore INTERFACE_LIBRARY targets for pkg-config file

Reviewed-by: Marcel Raad
Fixes #5512
Closes #5517

5 years agomultibyte: Fixed access-> waccess to file for Windows Plarform
Valentyn Korniienko [Thu, 18 Jun 2020 13:26:13 +0000 (16:26 +0300)] 
multibyte: Fixed access-> waccess to file for Windows Plarform

Reviewed-by: Marcel Raad
Closes #5580

5 years agoaltsvc: bump to h3-29
Daniel Stenberg [Fri, 19 Jun 2020 14:32:43 +0000 (16:32 +0200)] 
altsvc: bump to h3-29

Closes #5584

5 years agourlglob: treat literal IPv6 addresses with zone IDs as a host name
Daniel Stenberg [Thu, 18 Jun 2020 11:27:59 +0000 (13:27 +0200)] 
urlglob: treat literal IPv6 addresses with zone IDs as a host name

... and not as a "glob". Now done by passing the supposed host to the
URL parser which supposedly will do a better job at identifying "real"
numerical IPv6 addresses.

Reported-by: puckipedia on github
Fixes #5576
Closes #5579

5 years agotest1179: verify error message for non-existing cmdline option
Daniel Stenberg [Thu, 18 Jun 2020 06:45:02 +0000 (08:45 +0200)] 
test1179: verify error message for non-existing cmdline option

5 years agotool_getparam: repair the error message for unknown flag
Daniel Stenberg [Wed, 17 Jun 2020 22:51:37 +0000 (00:51 +0200)] 
tool_getparam: repair the error message for unknown flag

Follow-up to 9e5669f3880674
Detected by Coverity CID 1464582 ("Logically dead code")

Closes #5577

5 years agoFILEFORMAT: describe verify/stderr
Daniel Stenberg [Thu, 18 Jun 2020 07:46:38 +0000 (09:46 +0200)] 
FILEFORMAT: describe verify/stderr

5 years agoconnect: improve happy eyeballs handling
Daniel Stenberg [Mon, 15 Jun 2020 14:17:55 +0000 (16:17 +0200)] 
connect: improve happy eyeballs handling

For QUIC but also for regular TCP when the second family runs out of IPs
with a failure while the first family is still trying to connect.

Separated the timeout handling for IPv4 and IPv6 connections when they
both have a number of addresses to iterate over.

5 years agongtcp2: never call fprintf() in lib code in release version
Daniel Stenberg [Mon, 15 Jun 2020 11:19:17 +0000 (13:19 +0200)] 
ngtcp2: never call fprintf() in lib code in release version

5 years agongtcp2: fix happy eyeballs quic connect crash
Daniel Stenberg [Mon, 15 Jun 2020 08:36:32 +0000 (10:36 +0200)] 
ngtcp2: fix happy eyeballs quic connect crash

Reported-by: Peter Wu
Fixes #5565
Closes #5568

5 years agoselect: remove the unused ELAPSED_MS() macro
Daniel Stenberg [Wed, 17 Jun 2020 06:44:41 +0000 (08:44 +0200)] 
select: remove the unused ELAPSED_MS() macro

Closes #5573

5 years agomulti: implement wait using winsock events
rcombs [Wed, 13 May 2020 23:49:57 +0000 (18:49 -0500)] 
multi: implement wait using winsock events

This avoids using a pair of TCP ports to provide wakeup functionality
for every multi instance on Windows, where socketpair() is emulated
using a TCP socket on loopback which could in turn lead to socket
resource exhaustion.

Reviewed-by: Gergely Nagy
Reviewed-by: Marc Hörsken
Closes #5397

5 years agomanpage: add three missing environment variables
Daniel Stenberg [Tue, 16 Jun 2020 15:36:50 +0000 (17:36 +0200)] 
manpage: add three missing environment variables

CURL_SSL_BACKEND, QLOGDIR and SSLKEYLOGFILE

Closes #5571

5 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 16 Jun 2020 07:30:35 +0000 (09:30 +0200)] 
RELEASE-NOTES: synced

5 years agoconfigure: for wolfSSL, check for the DES func needed for NTLM
Daniel Stenberg [Thu, 11 Jun 2020 21:36:19 +0000 (23:36 +0200)] 
configure: for wolfSSL, check for the DES func needed for NTLM

Also adds pkg-config support for the wolfSSL detection.

5 years agontlm: enable NTLM support with wolfSSL
Ruurd Beerstra [Thu, 11 Jun 2020 15:14:43 +0000 (17:14 +0200)] 
ntlm: enable NTLM support with wolfSSL

When wolfSSL is built with its OpenSSL API layer, it fetures the same DES*
functions that OpenSSL has. This change take advantage of that.

Co-authored-by: Daniel Stenberg
Closes #5556
Fixes #5548

5 years agohttp: move header storage to Curl_easy from connectdata
Daniel Stenberg [Mon, 15 Jun 2020 09:28:17 +0000 (11:28 +0200)] 
http: move header storage to Curl_easy from connectdata

Since the connection can be used by many independent requests (using
HTTP/2 or HTTP/3), things like user-agent and other transfer-specific
data MUST NOT be kept connection oriented as it could lead to requests
getting the wrong string for their requests. This struct data was
lingering like this due to old HTTP1 legacy thinking where it didn't
mattered..

Fixes #5566
Closes #5567

5 years agoCODE_REVIEW.md: how to do code reviews in curl
Daniel Stenberg [Thu, 11 Jun 2020 10:04:05 +0000 (12:04 +0200)] 
CODE_REVIEW.md: how to do code reviews in curl

Assisted-by: Daniel Gustafsson
Assisted-by: Rich Salz
Assisted-by: Hugo van Kemenade
Assisted-by: James Fuller
Assisted-by: Marc Hörsken
Assisted-by: Jay Satiro
Closes #5555

5 years agoaltsvc: remove the num field from the altsvc struct
Daniel Stenberg [Fri, 12 Jun 2020 15:35:35 +0000 (17:35 +0200)] 
altsvc: remove the num field from the altsvc struct

It was superfluous since we have the list.size alredy

Reported-by: Jay Satiro
Fixes #5553
Closes #5563

5 years agoversion.d: expanded and alpha-sorted
Daniel Stenberg [Fri, 12 Jun 2020 08:30:20 +0000 (10:30 +0200)] 
version.d: expanded and alpha-sorted

Added a few missing features not previously mentioned. Ordered them
alphabetically.

Closes #5558

5 years agoABI.md: rename to .md and polish the markdown
Daniel Stenberg [Fri, 12 Jun 2020 11:26:20 +0000 (13:26 +0200)] 
ABI.md: rename to .md and polish the markdown

Closes #5562

5 years agoHELP-US: add a section for "smaller tasks"
Daniel Stenberg [Fri, 12 Jun 2020 10:01:49 +0000 (12:01 +0200)] 
HELP-US: add a section for "smaller tasks"

The point of this section is to meet the CII Best Practices gold level
critera:

 "The project MUST clearly identify small tasks that can be performed by
  new or casual contributors"

Closes #5560

5 years agoTODO: retry on the redirected-to URL
Daniel Stenberg [Fri, 12 Jun 2020 12:41:35 +0000 (14:41 +0200)] 
TODO: retry on the redirected-to URL

Closes #5462

5 years agomailmap: Nicolas Sterchele
Daniel Stenberg [Fri, 12 Jun 2020 11:41:52 +0000 (13:41 +0200)] 
mailmap: Nicolas Sterchele

5 years agoTODO: remove 19.3 section title
Sterchele Nicolas [Fri, 12 Jun 2020 11:21:04 +0000 (13:21 +0200)] 
TODO: remove 19.3 section title

Follow-up to ad6416986755e417c66e2c6, which caused wrong formatting on
curl documentation website

Closes #5561

5 years agotest1560: avoid possibly negative association in wording
Martin V [Wed, 10 Jun 2020 18:14:59 +0000 (20:14 +0200)] 
test1560: avoid possibly negative association in wording

Closes #5549

5 years agoshare: don't set the share flag it something fails
Daniel Stenberg [Thu, 11 Jun 2020 08:16:32 +0000 (10:16 +0200)] 
share: don't set the share flag it something fails

When asking for a specific feature to be shared in the share object,
that bit was previously set unconditionally even if the shared feature
failed or otherwise wouldn't work.

Closes #5554

5 years agobuildconf: remove -print from the find command that removes files
Daniel Stenberg [Wed, 10 Jun 2020 21:40:00 +0000 (23:40 +0200)] 
buildconf: remove -print from the find command that removes files

It's just too annoying and unnecessary to get a long list of files shown

5 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 10 Jun 2020 07:38:54 +0000 (09:38 +0200)] 
RELEASE-NOTES: synced

5 years agowording: avoid blacklist/whitelist stereotypes
Daniel Stenberg [Tue, 9 Jun 2020 14:08:11 +0000 (16:08 +0200)] 
wording: avoid blacklist/whitelist stereotypes

Instead of discussing if there's value or meaning (implied or not) in
the colors, let's use words without the same possibly negative
associations.

Closes #5546

5 years agotool_getparam: fix memory leak in parse_args
Jay Satiro [Tue, 9 Jun 2020 15:49:44 +0000 (11:49 -0400)] 
tool_getparam: fix memory leak in parse_args

Prior to this change in Windows Unicode builds most parsed options would
not be freed.

Found using _CrtDumpMemoryLeaks().

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

5 years agosocks: detect connection close during handshake
Daniel Stenberg [Mon, 8 Jun 2020 12:05:22 +0000 (14:05 +0200)] 
socks: detect connection close during handshake

The SOCKS4/5 state machines weren't properly terminated when the proxy
connection got closed, leading to a busy-loop.

Reported-By: zloi-user on github
Fixes #5532
Closes #5542

5 years agomulti: add defensive check on data->multi->num_alive
xquery [Mon, 8 Jun 2020 11:25:56 +0000 (13:25 +0200)] 
multi: add defensive check on data->multi->num_alive

Closes #5540

5 years agoCurl_addrinfo: use one malloc instead of three
Daniel Stenberg [Sat, 6 Jun 2020 21:10:18 +0000 (23:10 +0200)] 
Curl_addrinfo: use one malloc instead of three

To reduce the amount of allocations needed for creating a Curl_addrinfo
struct, make a single larger malloc instead of three separate smaller
ones.

Closes #5533

5 years agoquiche: update SSLKEYLOGFILE support
Alessandro Ghedini [Mon, 8 Jun 2020 11:47:05 +0000 (12:47 +0100)] 
quiche: update SSLKEYLOGFILE support

quiche now requires the application to explicitly set the keylog path
for each connection, rather than reading the environment variable
itself.

Closes #5541

5 years agotests: add two simple tests for --login-options
Daniel Stenberg [Mon, 8 Jun 2020 08:46:32 +0000 (10:46 +0200)] 
tests: add two simple tests for --login-options

Test 895 and 896 - as a follow-up to a3e972313b

Closes #5539

5 years agongtcp2: update with recent API changes
Daniel Stenberg [Mon, 8 Jun 2020 07:33:51 +0000 (09:33 +0200)] 
ngtcp2: update with recent API changes

Syncs with ngtcp2 commit 7e9a917d386d98 merged June 7 2020.

Assisted-by: Tatsuhiro Tsujikawa
Closes #5538

5 years agosocks: remove unreachable breaks in socks.c and mime.c
xquery [Mon, 8 Jun 2020 06:42:25 +0000 (08:42 +0200)] 
socks: remove unreachable breaks in socks.c and mime.c

Closes #5537

5 years agotool_cfgable: free login_options at exit
Daniel Stenberg [Sun, 7 Jun 2020 22:05:12 +0000 (00:05 +0200)] 
tool_cfgable: free login_options at exit

Memory leak
Reported-by: Geeknik Labs
Fixes #5535
Closes #5536

5 years agolibssh2: keep sftp errors as 'unsigned long'
Daniel Stenberg [Sat, 6 Jun 2020 22:30:50 +0000 (00:30 +0200)] 
libssh2: keep sftp errors as 'unsigned long'

Remove weird work-around for storing the SFTP errors as int instead of
the "unsigned long" that libssh2 actually returns for SFTP errors.

Closes #5534

5 years agotimeouts: move ms timeouts to timediff_t from int and long
Marc Hoersken [Mon, 1 Jun 2020 06:49:20 +0000 (08:49 +0200)] 
timeouts: move ms timeouts to timediff_t from int and long

Now that all functions in select.[ch] take timediff_t instead
of the limited int or long, we can remove type conversions
and related preprocessor checks to silence compiler warnings.

Avoiding conversions from time_t was already done in 842f73de.

Based upon #5262
Supersedes #5214, #5220 and #5221
Follow up to #5343 and #5479
Closes #5490

5 years agoopenssl: set FLAG_TRUSTED_FIRST unconditionally
François Rigault [Fri, 5 Jun 2020 20:00:58 +0000 (22:00 +0200)] 
openssl: set FLAG_TRUSTED_FIRST unconditionally

On some systems, openssl 1.0.x is still the default, but it has been
patched to contain all the recent security fixes. As a result of this
patching, it is possible for macro X509_V_FLAG_NO_ALT_CHAINS to be
defined, while the previous behavior of openssl to not look at trusted
chains first, remains.

Fix it: ensure X509_V_FLAG_TRUSTED_FIRST is always set, do not try to
probe for the behavior of openssl based on the existence ofmacros.

Closes #5530

5 years agoserver/util: fix logmsg format using curl_off_t argument
Daniel Stenberg [Fri, 5 Jun 2020 21:03:04 +0000 (23:03 +0200)] 
server/util: fix logmsg format using curl_off_t argument

... this caused segfaults on armv7.

Regression added in dd0365d560aea5a (7.70.0)

Reviewed-by: Jay Satiro
Closes #5529

5 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 5 Jun 2020 21:25:43 +0000 (23:25 +0200)] 
RELEASE-NOTES: synced

5 years agosocks: fix expected length of SOCKS5 reply
Cherish98 [Fri, 5 Jun 2020 17:36:11 +0000 (17:36 +0000)] 
socks: fix expected length of SOCKS5 reply

Commit 4a4b63d forgot to set the expected SOCKS5 reply length when the
reply ATYP is X'01'. This resulted in erroneously expecting more bytes
when the request length is greater than the reply length (e.g., when
remotely resolving the hostname).

Closes #5527

5 years ago.gitignore: add directory containing the stats repo
Marc Hoersken [Fri, 5 Jun 2020 17:54:34 +0000 (19:54 +0200)] 
.gitignore: add directory containing the stats repo

Since the new curl/stats repository is designed to be
checked out into the curl repository working tree as stats/
it should be on the ignore list to aid in commit staging.

5 years agoHTTP3.md: clarify cargo build directory
Adnan Khan [Thu, 4 Jun 2020 17:18:00 +0000 (13:18 -0400)] 
HTTP3.md: clarify cargo build directory

Cargo needs to be called from within the 'quiche' directory.

Closes #5522

5 years agouser-agent.d: spell out what happens given a blank argument
Daniel Stenberg [Fri, 5 Jun 2020 12:10:52 +0000 (14:10 +0200)] 
user-agent.d: spell out what happens given a blank argument

Closes #5525

5 years agotrailers: switch h1-trailer logic to use dynbuf
Daniel Stenberg [Fri, 5 Jun 2020 12:04:22 +0000 (14:04 +0200)] 
trailers: switch h1-trailer logic to use dynbuf

In the continued effort to remove "manual" realloc schemes.

Closes #5524

5 years agoCURLINFO_ACTIVESOCKET.3: clarify the description
Daniel Stenberg [Thu, 4 Jun 2020 15:20:17 +0000 (17:20 +0200)] 
CURLINFO_ACTIVESOCKET.3: clarify the description

Reported-by: Jay Satiro
Fixes #5299
Closes #5520

5 years agomailmap: Don J Olmstead
Daniel Stenberg [Thu, 4 Jun 2020 21:53:44 +0000 (23:53 +0200)] 
mailmap: Don J Olmstead

5 years agoconfigure: only strip first -L from LDFLAGS
Daniel Stenberg [Thu, 4 Jun 2020 16:11:36 +0000 (18:11 +0200)] 
configure: only strip first -L from LDFLAGS

In the logic that works out if a given OpenSSL path works, it stripped
off a possibly leading -L flag using an incorrect sed pattern which
would remove all instances of -L in the string, including if the path
itself contained that two-letter sequence!

The same pattern was used and is now updated in multiple places. Now it
only removes -L if it starts the strings.

Reported-by: Mohamed Osama
Fixes #5519
Closes #5521

5 years agoquiche: advertise draft 28 support
Peter Wu [Thu, 4 Jun 2020 09:54:01 +0000 (11:54 +0200)] 
quiche: advertise draft 28 support

Fix the verbose message while at it, quiche currently supports draft
27 and draft 28 simultaneously.

Closes #5518

5 years agoKNOWN_BUGS: RTSP authentication breaks without redirect support
Daniel Stenberg [Thu, 4 Jun 2020 08:40:32 +0000 (10:40 +0200)] 
KNOWN_BUGS: RTSP authentication breaks without redirect support

Closes #4750

5 years agoprojects: Add crypt32.lib to dependencies for all OpenSSL configs
Jay Satiro [Thu, 4 Jun 2020 05:21:28 +0000 (01:21 -0400)] 
projects: Add crypt32.lib to dependencies for all OpenSSL configs

Windows project configurations that use OpenSSL with USE_WIN32_CRYPTO
need crypt32.

Follow-up to 148534d which added CURLSSLOPT_NATIVE_CA for 7.71.0.

The changes that are in this commit were made by script.

Ref: https://gist.github.com/jay/a1861b50ecce2b32931237180f856e28

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

5 years agoCI/macos: fix 'is already installed' errors by using bundle
Marc Hoersken [Wed, 3 Jun 2020 17:58:14 +0000 (19:58 +0200)] 
CI/macos: fix 'is already installed' errors by using bundle

Avoid failing CI builds due to nghttp2 being already installed.

Closes #5513

5 years agoaltsvc: fix 'dsthost' may be used uninitialized in this function
Daniel Stenberg [Wed, 3 Jun 2020 14:28:41 +0000 (16:28 +0200)] 
altsvc: fix 'dsthost' may be used uninitialized in this function

5 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 2 Jun 2020 15:00:54 +0000 (17:00 +0200)] 
RELEASE-NOTES: synced

5 years agourldata: let the HTTP method be in the set.* struct
Daniel Stenberg [Mon, 1 Jun 2020 20:58:46 +0000 (22:58 +0200)] 
urldata: let the HTTP method be in the set.* struct

When the method is updated inside libcurl we must still not change the
method as set by the user as then repeated transfers with that same
handle might not execute the same operation anymore!

This fixes the libcurl part of #5462

Test 1633 added to verify.

Closes #5499

5 years agohostip: fix the memory-leak introduced in 67d2802
Daniel Stenberg [Tue, 2 Jun 2020 08:45:35 +0000 (10:45 +0200)] 
hostip: fix the memory-leak introduced in 67d2802

Fixes #5503
Closes #5504

5 years agotest970: make it require proxy support
Daniel Stenberg [Tue, 2 Jun 2020 07:21:03 +0000 (09:21 +0200)] 
test970: make it require proxy support

This test verifies the -w %json output and the test case includes a full
generated "blob". If there's no proxy support built into libcurl, it
will return an error for proxy related info variables and they will not
be included in the json, thus causing a mismatch and this test fails.

Reported-by: Marc Hörsken
Fixes #5501
Closes #5502

5 years agoexamples/http2-down/upload: add error checks
Radoslav Georgiev [Tue, 26 May 2020 16:42:07 +0000 (19:42 +0300)] 
examples/http2-down/upload: add error checks

If `index.html` does not exist in the directory from which the example
is invoked, the fopen(upload, "rb") invocation in `setup` would fail,
returning NULL.  This value is subsequently passed as the FILE* argument
of the `fread` invocation in the `read_callback` function, which is the
actual cause of the crash (apparently `fread` assumes that argument to
be non-null).

In addition, mitigate some possible crashes of similar origin.

Closes #5463

5 years agoexamples/ephiperfifo: turn off interval when setting timerfd
kotoriのねこ [Mon, 1 Jun 2020 17:51:34 +0000 (10:51 -0700)] 
examples/ephiperfifo: turn off interval when setting timerfd

Reported-by: therealhirudo on github
Fixes #5485
Closes #5497

5 years agovtls: repair the build with `CURL_DISABLE_PROXY`
Saleem Abdulrasool [Mon, 1 Jun 2020 18:20:47 +0000 (11:20 -0700)] 
vtls: repair the build with `CURL_DISABLE_PROXY`

`http_proxy` will not be available in `conndata` if `CURL_DISABLE_PROXY`
is enabled.  Repair the build with that configuration.

Follow-up to f3d501dc67

Closes #5498

5 years agotransfer: remove k->str NULL check
Daniel Stenberg [Mon, 1 Jun 2020 07:34:36 +0000 (09:34 +0200)] 
transfer: remove k->str NULL check

"Null-checking k->str suggests that it may be null, but it has already
been dereferenced on all paths leading to the check" - and it can't
legally be NULL at this point. Remove check.

Detected by Coverity CID 1463884

Closes #5495

5 years agoselect: always use Sleep in Curl_wait_ms on Win32
Marc Hoersken [Mon, 1 Jun 2020 06:32:21 +0000 (08:32 +0200)] 
select: always use Sleep in Curl_wait_ms on Win32

Since Win32 almost always will also have USE_WINSOCK,
we can reduce complexity and always use Sleep there.

Assisted-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Follow up to #5343
Closes #5489

5 years agoconncache: download buffer needs +1 size for trailing zero
Daniel Stenberg [Sun, 31 May 2020 15:44:47 +0000 (17:44 +0200)] 
conncache: download buffer needs +1 size for trailing zero

Follow-up to c4e6968127e
Detected by OSS-Fuzz: https://oss-fuzz.com/testcase-detail/5727799779524608

5 years agoazure: use matrix strategy to avoid configuration redundancy
Marc Hoersken [Thu, 28 May 2020 20:11:32 +0000 (22:11 +0200)] 
azure: use matrix strategy to avoid configuration redundancy

This also includes the following changes:

- Use the same timeout for all jobs on Linux (60 minutes)
  and Windows (90 minutes)
- Use CLI stable apt-get install -y instead of apt install
  which warns about that and run apt-get update first
- Enable MQTT for Windows msys2 builds instead of
  legacy msys1 builds
- Add ./configure --prefix parameter to the msys2 builds
- The MSYSTEM environment variable is now preset inside
  the container images for the msys2 builds

Note: on Azure Pipelines the matrix strategy is basically
just a simple list of job copies and not really a matrix.

Closes #5468

5 years agobuild: disable more code/data when built without proxy support
Daniel Stenberg [Wed, 27 May 2020 09:51:34 +0000 (11:51 +0200)] 
build: disable more code/data when built without proxy support

Added build to travis to verify

Closes #5466

5 years agourl: alloc the download buffer at transfer start
Daniel Stenberg [Thu, 28 May 2020 16:30:47 +0000 (18:30 +0200)] 
url: alloc the download buffer at transfer start

... and free it as soon as the transfer is done. It removes the extra
alloc when a new size is set with setopt() and reduces memory for unused
easy handles.

In addition: the closure_handle now doesn't use an allocated buffer at
all but the smallest supported size as a stack based one.

Closes #5472

5 years agotimeouts: change millisecond timeouts to timediff_t from time_t
Daniel Stenberg [Thu, 28 May 2020 22:08:03 +0000 (00:08 +0200)] 
timeouts: change millisecond timeouts to timediff_t from time_t

For millisecond timers we like timediff_t better. Also, time_t can be
unsigned so returning a negative value doesn't work then.

Closes #5479

5 years agoselect: add overflow checks for timeval conversions
Marc Hoersken [Wed, 27 May 2020 15:24:21 +0000 (17:24 +0200)] 
select: add overflow checks for timeval conversions

Using time_t and suseconds_t if suseconds_t is available,
long on Windows (maybe others in the future) and int elsewhere.

Also handle case of ULONG_MAX being greater or equal to INFINITE.

Assisted-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Part of #5343

5 years agoselect: use timediff_t instead of time_t and int for timeout_ms
Marc Hoersken [Tue, 5 May 2020 19:39:39 +0000 (21:39 +0200)] 
select: use timediff_t instead of time_t and int for timeout_ms

Make all functions in select.[ch] take timeout_ms as timediff_t
which should always be large enough and signed on all platforms
to take all possible timeout values and avoid type conversions.

Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Replaces #5107 and partially #5262
Related to #5240 and #5286
Closes #5343

5 years agounit1604.c: fix implicit conv from 'SANITIZEcode' to 'CURLcode'
Marc Hoersken [Thu, 28 May 2020 19:51:25 +0000 (21:51 +0200)] 
unit1604.c: fix implicit conv from 'SANITIZEcode' to 'CURLcode'

GCC 10 warns about this with warning: implicit conversion
  from 'SANITIZEcode' to 'CURLcode' [-Wenum-conversion]

Since 'expected_result' is not really of type 'CURLcode' and
it is not exposed in any way, we can just use 'SANITIZEcode'.

Reviewed-by: Daniel Stenberg
Reviewed-by: Marcel Raad
Closes #5476

5 years agotests/libtest: fix undefined reference to 'curlx_win32_fopen'
Marc Hoersken [Thu, 28 May 2020 19:04:07 +0000 (21:04 +0200)] 
tests/libtest: fix undefined reference to 'curlx_win32_fopen'

Since curl_setup.h now makes use of curlx_win32_fopen for Win32
builds with USE_WIN32_LARGE_FILES or USE_WIN32_SMALL_FILES defined,
we need to include the relevant files for tests using fopen,
because the libtest sources are also including curl_setup.h

Reviewed-by: Marcel Raad
Reviewed-by: Daniel Stenberg
Follow up to #3784 (ffdddb45d9)
Closes #5475

5 years agoappveyor: add non-debug plain autotools-based build
Marc Hoersken [Sat, 30 May 2020 07:46:04 +0000 (09:46 +0200)] 
appveyor: add non-debug plain autotools-based build

This should enable us to catch linking issues with the
testsuite early, like the one described/fixed in #5475.

Reviewed-by: Daniel Stenberg
Reviewed-by: Marcel Raad
Closes #5477

5 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 29 May 2020 21:59:44 +0000 (23:59 +0200)] 
RELEASE-NOTES: synced

5 years agoRevert "buildconf: use find -execdir"
Daniel Stenberg [Fri, 29 May 2020 15:34:06 +0000 (17:34 +0200)] 
Revert "buildconf: use find -execdir"

This partially reverts commit c712009838f44211958854de431315586995bc61.

Keep the ares_ files removed but bring back the older way to run find,
to make it work with busybox's find, as apparently that's being used.

Reported-by: Max Peal
Fixes #5483
Closes #5484

5 years agoserver/sws: fix asan warning on use of uninitialized variable
Daniel Stenberg [Fri, 29 May 2020 11:04:25 +0000 (13:04 +0200)] 
server/sws: fix asan warning on use of uninitialized variable

5 years agolibssh2: improved error output for wrong quote syntax
Daniel Stenberg [Thu, 28 May 2020 18:34:20 +0000 (20:34 +0200)] 
libssh2: improved error output for wrong quote syntax

Reported-by: Werner Stolz
Closes #5474

5 years agomk-lib1521: generate code for testing BLOB options as well
Daniel Stenberg [Thu, 28 May 2020 20:42:49 +0000 (22:42 +0200)] 
mk-lib1521: generate code for testing BLOB options as well

Follow-up to cac5374298b3

Closes #5478

5 years agoconfigure: repair the check if argv can be written to
Daniel Stenberg [Thu, 28 May 2020 14:32:07 +0000 (16:32 +0200)] 
configure: repair the check if argv can be written to

Due to bad escaping of the test code, the test wouldn't build and thus
result in a negative test result, which would lead to the unconditional
assumption that overwriting the arguments doesn't work and thus curl
would never hide credentials given in the command line, even when it
would otherwise be possible.

Regression from commit 2d4c2152c (7.60.0)

Reported-by: huzunhao on github
Fixes #5470
Closes #5471

5 years agoCMake: rebuild Makefile.inc.cmake when Makefile.inc changes
Peter Wu [Wed, 27 May 2020 20:36:22 +0000 (22:36 +0200)] 
CMake: rebuild Makefile.inc.cmake when Makefile.inc changes

Otherwise the build might fail due to missing source files, as
demonstrated by the recent keylog.c addition on an existing build dir.

Closes #5469

5 years agourldata: fix comments: Curl_done() is called multi_done() now
Daniel Stenberg [Thu, 28 May 2020 08:12:05 +0000 (10:12 +0200)] 
urldata: fix comments: Curl_done() is called multi_done() now

... since 575e885db

5 years agongtcp2: use common key log routine for better thread-safety
Peter Wu [Sun, 3 May 2020 23:41:46 +0000 (01:41 +0200)] 
ngtcp2: use common key log routine for better thread-safety

Tested with ngtcp2 built against the OpenSSL library. Additionally
tested with MultiSSL (NSS for TLS and ngtcp2+OpenSSL for QUIC).

The TLS backend (independent of QUIC) may or may not already have opened
the keylog file before. Therefore Curl_tls_keylog_open is always called
to ensure the file is open.

5 years agowolfssl: add SSLKEYLOGFILE support
Peter Wu [Sun, 3 May 2020 22:16:40 +0000 (00:16 +0200)] 
wolfssl: add SSLKEYLOGFILE support

Tested following the same curl and tshark commands as in commit
"vtls: Extract and simplify key log file handling from OpenSSL" using
WolfSSL v4.4.0-stable-128-g5179503e8 from git master built with
`./configure --enable-all --enable-debug CFLAGS=-DHAVE_SECRET_CALLBACK`.

Full support for this feature requires certain wolfSSL build options,
see "Availability note" in lib/vtls/wolfssl.c for details.

Closes #5327

5 years agovtls: Extract and simplify key log file handling from OpenSSL
Peter Wu [Sun, 3 May 2020 15:10:40 +0000 (17:10 +0200)] 
vtls: Extract and simplify key log file handling from OpenSSL

Create a set of routines for TLS key log file handling to enable reuse
with other TLS backends. Simplify the OpenSSL backend as follows:

 - Drop the ENABLE_SSLKEYLOGFILE macro as it is unconditionally enabled.
 - Do not perform dynamic memory allocation when preparing a log entry.
   Unless the TLS specifications change we can suffice with a reasonable
   fixed-size buffer.
 - Simplify state tracking when SSL_CTX_set_keylog_callback is
   unavailable. My original sslkeylog.c code included this tracking in
   order to handle multiple calls to SSL_connect and detect new keys
   after renegotiation (via SSL_read/SSL_write). For curl however we can
   be sure that a single master secret eventually becomes available
   after SSL_connect, so a simple flag is sufficient. An alternative to
   the flag is examining SSL_state(), but this seems more complex and is
   not pursued. Capturing keys after server renegotiation was already
   unsupported in curl and remains unsupported.

Tested with curl built against OpenSSL 0.9.8zh, 1.0.2u, and 1.1.1f
(`SSLKEYLOGFILE=keys.txt curl -vkso /dev/null https://localhost:4433`)
against an OpenSSL 1.1.1f server configured with:

    # Force non-TLSv1.3, use TLSv1.0 since 0.9.8 fails with 1.1 or 1.2
    openssl s_server -www -tls1
    # Likewise, but fail the server handshake.
    openssl s_server -www -tls1 -Verify 2
    # TLS 1.3 test. No need to test the failing server handshake.
    openssl s_server -www -tls1_3

Verify that all secrets (1 for TLS 1.0, 4 for TLS 1.3) are correctly
written using Wireshark. For the first and third case, expect four
matches per connection (decrypted Server Finished, Client Finished, HTTP
Request, HTTP Response). For the second case where the handshake fails,
expect a decrypted Server Finished only.

    tshark -i lo -pf tcp -otls.keylog_file:keys.txt -Tfields \
        -eframe.number -eframe.time -etcp.stream -e_ws.col.Info \
        -dtls.port==4433,http -ohttp.desegment_body:FALSE \
        -Y 'tls.handshake.verify_data or http'

A single connection can easily be identified via the `tcp.stream` field.

5 years agoFILEFORMAT: add more features that tests can depend on
Daniel Stenberg [Wed, 27 May 2020 12:28:51 +0000 (14:28 +0200)] 
FILEFORMAT: add more features that tests can depend on

5 years agotransfer: close connection after excess data has been read
Michael Kaufmann [Thu, 21 May 2020 11:10:04 +0000 (13:10 +0200)] 
transfer: close connection after excess data has been read

For HTTP 1.x, it's a protocol error when the server sends more bytes
than announced. If this happens, don't reuse the connection, because the
start position of the next response is undefined.

Closes #5440

5 years agoRevert "ssh: ignore timeouts during disconnect"
Estanislau Augé-Pujadas [Tue, 26 May 2020 22:59:33 +0000 (15:59 -0700)] 
Revert "ssh: ignore timeouts during disconnect"

This reverts commit f31760e63b4e9ef1eb25f8f211390f8239388515. Shipped in
curl 7.54.1.

Bug: https://curl.haxx.se/mail/lib-2020-05/0068.html
Closes #5465

5 years agourldata: connect related booleans live in struct ConnectBits
Daniel Stenberg [Tue, 26 May 2020 12:42:47 +0000 (14:42 +0200)] 
urldata: connect related booleans live in struct ConnectBits

And remove a few unused booleans!

Closes #5461

5 years agohostip: on macOS avoid DoH when given a numerical IP address
Daniel Stenberg [Tue, 26 May 2020 09:07:06 +0000 (11:07 +0200)] 
hostip: on macOS avoid DoH when given a numerical IP address

When USE_RESOLVE_ON_IPS is set (defined on macOS), it means that
numerical IP addresses still need to get "resolved" - but not with DoH.

Reported-by: Viktor Szakats
Fixes #5454
Closes #5459

5 years agongtcp2: cleanup memory when failing to connect
Daniel Stenberg [Mon, 25 May 2020 15:55:16 +0000 (17:55 +0200)] 
ngtcp2: cleanup memory when failing to connect

Reported-by: Peter Wu
Fixes #5447 (the ngtcp2 side of it)
Closes #5451

5 years agoquiche: clean up memory properly when failing to connect
Daniel Stenberg [Mon, 25 May 2020 15:24:36 +0000 (17:24 +0200)] 
quiche: clean up memory properly when failing to connect

Addresses the quiche side of #5447
Reported-by: Peter Wu
Closes #5450