Daniel Stenberg [Tue, 10 Aug 2021 14:11:51 +0000 (16:11 +0200)]
ares: use ares_getaddrinfo()
ares_getaddrinfo() is the getaddrinfo() cloned provided by c-ares, introduced
in version 1.16.0.
With older c-ares versions, curl invokes ares_gethostbyname() twice - once for
IPv4 and once for IPv6 to resolve both addresses, and then combines the
returned results.
Jay Satiro [Tue, 3 Aug 2021 07:03:00 +0000 (03:03 -0400)]
hostip: Make Curl_ipv6works function independent of getaddrinfo
- Do not assume IPv6 is not working when getaddrinfo is not present.
The check to see if IPv6 actually works is now independent of whether
there is any resolver that can potentially resolve a hostname to IPv6.
Prior to this change if getaddrinfo() was not found at compile time then
Curl_ipv6works() would be defined as a macro that returns FALSE.
When getaddrinfo is not found then libcurl is built with CURLRES_IPV4
defined instead of CURLRES_IPV6, meaning that it cannot do IPv6 lookups
in the traditional way. With this commit if libcurl is built with IPv6
support (ENABLE_IPV6) but without getaddrinfo (CURLRES_IPV6), and the
IPv6 stack is actually working, then it is possible for libcurl to
resolve IPv6 addresses by using DoH.
Bin Lan [Wed, 21 Jul 2021 02:23:05 +0000 (10:23 +0800)]
tool/tests: fix potential year 2038 issues
The length of 'long' in a 32-bit system is 32 bits, which cannot be used
to save timestamps after 2038. Most operating systems have extended
time_t to 64 bits.
Commit dbd16c3e2 cleaned up the logic for traversing the addrinfos,
but the move left a conditional on ai which no longer is needed as
the while loop reevaluation will cover it.
Closes #7511 Reviewed-by: Carlo Marcelo Arenas Belón Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Daniel Stenberg [Wed, 28 Jul 2021 15:41:05 +0000 (17:41 +0200)]
curl.1: mention "global" flags
Mention options that are "global". A global command line option is one
that doesn't get reset at --next uses and therefore don't need to be
used again.
time_t representation is undefined and varies on bitsize and signedness,
and as of C11 could be even non integer.
instead of casting to unsigned long (which would truncate in systems
with a 32bit long after 2106) use difftime to get the elapsed time as a
double and print that (without decimals) instead.
alternatively a cast to curl_off_t and its corresponding print
formatting could have been used (at least in POSIX) but portability and
curl agnostic code was prioritized.
Daniel Stenberg [Fri, 23 Jul 2021 21:52:12 +0000 (23:52 +0200)]
http_proxy: clear 'sending' when the outgoing request is sent
... so that Curl_connect_getsock() will know how to wait for the socket
to become readable and not writable after the entire CONNECT request has
been issued.
Regression added in 7.77.0
Reported-by: zloi-user on github Assisted-by: Jay Satiro
Fixes #7155
Closes #7484
Jay Satiro [Fri, 23 Jul 2021 06:56:52 +0000 (02:56 -0400)]
docs: change max-filesize caveat again
- Add protocols field to max-filesize.d.
- Revert wording on unknown file size caveat and do not discuss specific
protocols in that section.
Partial revert of ecf0225. All max-filesize options now have the list of
protocols and it's clearer just to have that list without discussing
specific protocols in the caveat.
commit 29c7cf79e8b44cf (shipped in 7.78.0) introduced a problem by
assuming that LIB_H2 does not have any leading whitespace. At least
OpenBSD's native pkg-config can produce such whitespace, though:
$ pkg-config --libs-only-l libnghttp2
-lnghttp2
As a result, the configure check for libnghttp2 will erroneously fail.
Jay Satiro [Mon, 19 Jul 2021 23:06:30 +0000 (19:06 -0400)]
connect: fix wrong format specifier in connect error string
0842175 (not in any release) used the wrong format specifier (long int)
for timediff_t. On an OS such as Windows libcurl's timediff_t (usually
64-bit) is bigger than long int (32-bit). In 32-bit Windows builds the
upper 32-bits of the timediff_t were erroneously then used by the next
format specifier. Usually since the timeout isn't larger than 32-bits
this would result in null as a pointer to the string with the reason for
the connection failing. On other OSes or maybe other compilers it could
probably result in garbage values (ie crash on deref).
Before:
Failed to connect to localhost port 12345 after 1201 ms: (nil)
After:
Failed to connect to localhost port 12345 after 1203 ms: Connection refused
docs: spell out directories instead of dirs in create-dirs
Write out directories rather than using the dirs abbrevation. Also
use plural form consistently, even if the code in the end might just
create a single directory.
Closes #7406 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Max Zettlmeißl [Sun, 18 Jul 2021 08:42:54 +0000 (10:42 +0200)]
docs: make the documentation for --etag-save match the program behaviour
When using curl with the option `--etag-save` I expected it to save the
ETag without its surrounding quotes, as stated by the documentation in
the repository and by the generated man pages.
My first endeavour was to fix the program, but while investigating the
history of the relevant parts, I discovered that curl once saved the
ETag without the quotes. This was undone by Daniel Stenberg in commit
`98c94596f5928840177b6bd3c7b0f0dd03a431af`, therefore I decided that in
this case the documentation should be adjusted to match the behaviour of
curl.
The changed save behaviour also made parts of the `--etag-compare`
documentation wrong or superfluous, so I adjusted those accordingly.
easy: during upkeep, attach Curl_easy to connections in the cache
During the protocol-specific parts of connection upkeep, some code
assumes that the data->conn pointer already is set correctly. However,
there's currently no guarantee of that in the code.
This fix temporarily attaches each connection to the Curl_easy object
before performing the protocol-specific connection check on it, in a
similar manner to the connection checking in extract_if_dead().
- curl_setup.h: all references to mbedtls_md4* functions and structures
are in the md4.c. This file already includes the <mbedtls/md4.h> file
along with the file existence control (defined (MBEDTLS_MD4_C))
- curl_ntlm_core.c: unnecessary include - repeated below
Wyatt OʼDay reported in #7385 that mbedTLS isn't backwards compatible
and curl no longer builds with it. Document the need to fix our support
until so has been done.
docs: fix inconsistencies in EGDSOCKET documentation
Only the OpenSSL backend actually use the EGDSOCKET, and also use
TLS consistently rather than mixing SSL and TLS. While there, also
fix a minor spelling nit.
Closes: #7391 Reviewed-by: Jay Satiro <raysatiro@yahoo.com>