Jay Satiro [Wed, 29 Jan 2020 08:23:55 +0000 (03:23 -0500)]
tool_homedir: Change GetEnv() to use libcurl's curl_getenv()
- Deduplicate GetEnv() code.
- On Windows change ultimate call to use Windows API
GetEnvironmentVariable() instead of C runtime getenv().
Prior to this change both libcurl and the tool had their own GetEnv
which over time diverged. Now the tool's GetEnv is a wrapper around
curl_getenv (libcurl API function which is itself a wrapper around
libcurl's GetEnv).
Furthermore this change fixes a bug in that Windows API
GetEnvironmentVariable() is called instead of C runtime getenv() to get
the environment variable since some changes aren't always visible to the
latter.
Reported-by: Christoph M. Becker
Fixes https://github.com/curl/curl/issues/4774
Closes https://github.com/curl/curl/pull/4863
Jay Satiro [Sun, 9 Feb 2020 08:15:13 +0000 (03:15 -0500)]
multi: fix outdated comment
- Do not say that conn->data is "cleared" by multi_done().
If the connection is in use then multi_done assigns another easy handle
still using the connection to conn->data, therefore in that case it is
not cleared.
Steve Holme [Sun, 9 Feb 2020 15:50:57 +0000 (15:50 +0000)]
smtp: Simplify the MAIL command and avoid a duplication of send strings
This avoids the duplication of strings when the optional AUTH and SIZE
parameters are required. It also assists with the modifications that
are part of #4892.
Daniel Stenberg [Sun, 9 Feb 2020 14:28:03 +0000 (15:28 +0100)]
altsvc: keep a copy of the file name to survive handle reset
The alt-svc cache survives a call to curl_easy_reset fine, but the file
name to use for saving the cache was cleared. Now the alt-svc cache has
a copy of the file name to survive handle resets.
Steve Holme [Fri, 7 Feb 2020 16:51:09 +0000 (16:51 +0000)]
checksrc.bat: Fix not being able to run script from the main curl directory
If the script was ran from the main curl directory rather then the
projects directory then the script would simply exit without error:
C:\url> projects\checksrc.bat
The user would either need to change to the projects directory,
explicitly specify the current working directory, or perform a
oneline hacky workaround:
digest: Do not quote algorithm in HTTP authorisation
RFC 7616 section 3.4 (The Authorization Header Field) states that "For
historical reasons, a sender MUST NOT generate the quoted string syntax
for the following parameters: algorithm, qop, and nc". This removes the
quoting for the algorithm parameter.
Harry Sintonen [Tue, 4 Feb 2020 04:21:58 +0000 (06:21 +0200)]
altsvc: improved header parser
- Fixed the flag parsing to apply to specific alternative entry only, as
per RFC. The earlier code would also get totally confused by
multiprotocol header, parsing flags from the wrong part of the header.
- Fixed the parser terminating on unknown protocols, instead of skipping
them.
- Fixed a busyloop when protocol-id was present without an equal sign.
Dan Fandrich [Mon, 3 Feb 2020 11:27:30 +0000 (12:27 +0100)]
cirrus: Add some missing semicolons
Newlines aren't preserved in this section so they're needed to separate
commands. The exports luckily worked anyway as a single long line, but
erroneously exported a variable called "export"
[skip ci]
Daniel Stenberg [Mon, 27 Jan 2020 21:50:33 +0000 (22:50 +0100)]
multi_done: if multiplexed, make conn->data point to another transfer
... since the current transfer is being killed. Setting to NULL is
wrong, leaving it pointing to 'data' is wrong since that handle might be
about to get freed.
Fixes #4845
Closes #4858 Reported-by: dmitrmax on github
Daniel Stenberg [Sun, 26 Jan 2020 16:51:01 +0000 (17:51 +0100)]
global_init: move the IPv6 works status bool to multi handle
Previously it was stored in a global state which contributed to
curl_global_init's thread unsafety. This boolean is now instead figured
out in curl_multi_init() and stored in the multi handle. Less effective,
but thread safe.
Daniel Stenberg [Sat, 25 Jan 2020 15:46:41 +0000 (16:46 +0100)]
curl: make the -# spaceship bar not wrap the line
The fixed-point math made us lose precision and thus a too high index
value could be used for outputting the hashtags which could overwrite
the newline.
The fix increases the precision in the sine table (*100) and the
associated position math.
Reported-by: Andrew Potter
Fixes #4849
Closes #4850
Daniel Stenberg [Thu, 23 Jan 2020 12:39:27 +0000 (13:39 +0100)]
global_init: assume the EINTR bit by default
- Removed from global_init since it isn't thread-safe. The symbol will
still remain to not break compiles, it just won't have any effect going
forward.
- make the internals NOT loop on EINTR (the opposite from previously).
It only risks returning from the select/poll/wait functions early, and that
should be risk-free.
Daniel Stenberg [Wed, 22 Jan 2020 09:29:44 +0000 (10:29 +0100)]
openssl: make CURLINFO_CERTINFO not truncate x509v3 fields
Avoid "reparsing" the content and instead deliver more exactly what is
provided in the certificate and avoid truncating the data after 512
bytes as done previously. This no longer removes embedded newlines.
Fixes #4837 Reported-by: bnfp on github
Closes #4841
Marcel Raad [Tue, 14 Jan 2020 19:28:20 +0000 (20:28 +0100)]
CMake: support specifying the target Windows version
Previously, it was only possible to set it to Windows Vista or XP by
setting the option `ENABLE_INET_PTON` to `ON` resp. `OFF`.
Use a new cache variable `CURL_TARGET_WINDOWS_VERSION` to be able to
explicitly set the target Windows version. `ENABLE_INET_PTON` is
ignored in this case.
Daniel Stenberg [Thu, 16 Jan 2020 07:17:04 +0000 (08:17 +0100)]
polarssl: removed
As detailed in DEPRECATE.md, the polarssl support is now removed after
having been disabled for 6 months and nobody has missed it.
The threadlock files used by mbedtls are renamed to an 'mbedtls' prefix
instead of the former 'polarssl' and the common functions that
previously were shared between mbedtls and polarssl and contained the
name 'polarssl' have now all been renamed to instead say 'mbedtls'.
Marcel Raad [Sat, 11 Jan 2020 10:20:38 +0000 (11:20 +0100)]
CMake: use check_symbol_exists also for inet_pton
It doesn't make much sense to only check if the function can be linked
when it's not declared in any header and that is treated as an error.
With the correct target Windows version set, the function is declared
in ws2tcpip.h and the comment above the modified block is invalid.
Also, move the definition of `_WIN32_WINNT` up to before all symbol
availability checks so that we don't have to care which ones must be
done after it.
Tested with Visual Studio 2019 and current MinGW-w64.
Daniel Stenberg [Sun, 5 Jan 2020 09:34:19 +0000 (10:34 +0100)]
ConnectionExists: respect the max_concurrent_streams limits
A regression made the code use 'multiplexed' as a boolean instead of the
counter it is intended to be. This made curl try to "over-populate"
connections with new streams.
This regression came with 41fcdf71a1, shipped in curl 7.65.0.
Also, respect the CURLMOPT_MAX_CONCURRENT_STREAMS value in the same
check.