Daniel Stenberg [Sat, 5 Sep 2020 19:21:26 +0000 (21:21 +0200)]
altsvc: clone setting in curl_easy_duphandle
The cache content is not duplicated, like other caches, but the setting
and specified file name are.
Test 1908 is extended to verify this somewhat. Since the duplicated
handle gets the same file name, the test unfortunately overwrites the
same file twice (with different contents) which makes it hard to check
automatically.
Daniel Stenberg [Sat, 5 Sep 2020 18:30:26 +0000 (20:30 +0200)]
test1541: remove since it is a known bug
A shared connection cache is not thread-safe is a known issue. Stop
testing this until we believe this issue is addressed. Reduces
occasional test failures we don't care about.
The test code in lib1541.c is left in git to allow us to restore it when
we get to fix this.
Daniel Stenberg [Sat, 5 Sep 2020 15:44:24 +0000 (17:44 +0200)]
curl: retry delays in parallel mode no longer sleeps blocking
The previous sleep for retries would block all other concurrent
transfers. Starting now, the retry will instead be properly marked to
not get restarted until after the delay time but other transfers can
still continue in the mean time.
Samuel Marks [Thu, 21 May 2020 10:21:50 +0000 (20:21 +1000)]
CMake: remove explicit `CMAKE_ANSI_CFLAGS`
This variable was removed from cmake in commit
https://gitlab.kitware.com/cmake/cmake/commit/5a834b0bb0bc288. A later
CMake commit removes the variable from the tests, claiming that it was
removed in CMake 2.6
Marc Hoersken [Mon, 31 Aug 2020 08:49:20 +0000 (10:49 +0200)]
select: align poll emulation to return all relevant events
The poll emulation via select already consumes POLLRDNORM,
POLLWRNORM and POLLRDBAND as input events. Therefore it
should also return them as output events if signaled.
Also fix indentation in input event handling block.
Assisted-by: Jay Satiro Reviewed-by: Daniel Stenberg
Replaces #5852
Closes #5883
Marcel Raad [Sat, 22 Aug 2020 08:16:13 +0000 (10:16 +0200)]
AppVeyor: switch 64-bit Schannel Debug CMake builds to Unicode
The Schannel builds are the most useful to verify as they make the most
use of the Windows API. Classic MinGW doesn't support Unicode at all,
only MinGW-w64 and MSVC do.
Marc Hoersken [Fri, 28 Aug 2020 20:30:39 +0000 (22:30 +0200)]
sockfilt: handle FD_CLOSE winsock event on write socket
Learn from the way Cygwin handles and maps the WinSock events
to simulate correct and complete poll and select behaviour
according to Richard W. Stevens Network Programming book.
Marc Hoersken [Wed, 26 Aug 2020 20:13:21 +0000 (22:13 +0200)]
multi: handle connection state winsock events
Learn from the way Cygwin handles and maps the WinSock events
to simulate correct and complete poll and select behaviour
according to Richard W. Stevens Network Programming book.
Reviewed-by: Jay Satiro Reviewed-by: Marcel Raad
Follow up to #5634
Closes #5867
Daniel Stenberg [Mon, 24 Aug 2020 09:07:59 +0000 (11:07 +0200)]
Curl_pgrsTime - return new time to avoid timeout integer overflow
Setting a timeout to INT_MAX could cause an immediate error to get
returned as timeout because of an overflow when different values of
'now' were used.
This is primarily fixed by having Curl_pgrsTime() return the "now" when
TIMER_STARTSINGLE is set so that the parent function will continue using
that time.
The purpose is to provide detailed enough information to allow for
example libcurl bindings to get option information at run-time about
what easy options that exist and what arguments they expect.
Jay Satiro [Wed, 26 Aug 2020 05:49:47 +0000 (01:49 -0400)]
openssl: Fix wincrypt symbols conflict with BoringSSL
OpenSSL undefines the conflicting symbols but BoringSSL does not so we
must do it ourselves.
Reported-by: Samuel Tranchet Assisted-by: Javier Blazquez
Ref: https://bugs.chromium.org/p/boringssl/issues/detail?id=371
Ref: https://github.com/openssl/openssl/blob/OpenSSL_1_1_1g/include/openssl/ossl_typ.h#L66-L73
fullincome [Wed, 26 Aug 2020 10:15:15 +0000 (13:15 +0300)]
schannel: fix memory leak when using get_cert_location
The get_cert_location function allocates memory only on success.
Previously get_cert_location was able to allocate memory and return
error. It wasn't obvious and in this case the memory wasn't
released.
Marc Hoersken [Sun, 26 Jul 2020 19:26:46 +0000 (21:26 +0200)]
multi: expand pre-check for socket readiness
Check readiness of all sockets before waiting on them
to avoid locking in case the one-time event FD_WRITE
was already consumed by a previous wait operation.
More information about WinSock network events:
https://docs.microsoft.com/en-us/windows/win32/api/
winsock2/nf-winsock2-wsaeventselect#return-value
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.
A previous version of this patch failed to account for how in WinSock,
FD_WRITE is set only once when writing becomes possible and not again
until after a send has failed due to the buffer filling. This contrasts
to how FD_READ and FD_OOB continue to be set until the conditions they
refer to no longer apply. This meant that if a user wrote some data to
a socket, but not enough data to completely fill its send buffer, then
waited on that socket to become writable, we'd erroneously stall until
their configured timeout rather than returning immediately.
This version of the patch addresses that issue by checking each socket
we're waiting on to become writable with select() before the wait, and
zeroing the timeout if it's already writable.
Assisted-by: Marc Hörsken Reviewed-by: Marcel Raad Reviewed-by: Daniel Stenberg Tested-by: Gergely Nagy Tested-by: Rasmus Melchior Jacobsen Tested-by: Tomas Berger
Replaces #5397
Reverts #5632
Closes #5634
Marc Hoersken [Tue, 21 Jul 2020 18:17:01 +0000 (20:17 +0200)]
select: fix poll-based check not detecting connect failure
This commit changes Curl_socket_check to use POLLPRI to
check for connect failure on the write socket, because
POLLPRI maps to fds_err. This is in line with select(2).
The select-based socket check correctly checks for connect
failures by adding the write socket also to fds_err.
The poll-based implementation (which internally can itself
fallback to select again) did not previously check for
connect failure by using POLLPRI with the write socket.
See the follow up commit to this for more information.
This commit makes sure connect failures can be detected
and handled if HAVE_POLL_FINE is defined, eg. on msys2-devel.
Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro
Replaces #5509
Prepares #5707
Daniel Stenberg [Mon, 24 Aug 2020 14:28:34 +0000 (16:28 +0200)]
configure: fix pkg-config detecting wolfssl
When amending the include path with "/wolfssl", this now properly strips
off all whitespace from the path variable! Previously this would lead to
pkg-config builds creating bad command lines.
Daniel Stenberg [Mon, 24 Aug 2020 06:39:29 +0000 (08:39 +0200)]
CURLE_PROXY: new error code
Failures clearly returned from a (SOCKS) proxy now causes this return
code. Previously the situation was not very clear as what would be
returned and when.
In addition: when this error code is returned, an application can use
CURLINFO_PROXY_ERROR to query libcurl for the detailed error, which then
returns a value from the new 'CURLproxycode' enum.