Skip to content
Permalink
Browse files

Update curl from 7.64.1 to 7.65.0 (#962)

* Update curl from 7.64.1 to 7.65.0

* Gets rid of our custom config-linux.h addition from curl_setup.h, we now have a clean version of curl package! 🙌
* Ran ./configure for fresh config-linux.h and config-macos.h

* Add missing curl files
  • Loading branch information...
patrikjuvonen committed May 26, 2019
1 parent 8475539 commit ac0715cd2d9fabfcc987682da202028acc8a9f39
Showing with 1,907 additions and 2,391 deletions.
  1. +5 −2 vendor/curl/include/curl/curl.h
  2. +6 −6 vendor/curl/include/curl/curlver.h
  3. +2 −8 vendor/curl/include/curl/typecheck-gcc.h
  4. +2 −1 vendor/curl/include/curl/urlapi.h
  5. +5 −7 vendor/curl/lib/altsvc.c
  6. +99 −6 vendor/curl/lib/asyn-ares.c
  7. +8 −1 vendor/curl/lib/base64.c
  8. +6 −0 vendor/curl/lib/config-linux.h
  9. +9 −3 vendor/curl/lib/config-macos.h
  10. +4 −1 vendor/curl/lib/config-win32.h
  11. +3 −2 vendor/curl/lib/conncache.c
  12. +1 −2 vendor/curl/lib/conncache.h
  13. +20 −14 vendor/curl/lib/connect.c
  14. +13 −37 vendor/curl/lib/cookie.c
  15. +0 −1 vendor/curl/lib/cookie.h
  16. +0 −9 vendor/curl/lib/curl_fnmatch.c
  17. +55 −0 vendor/curl/lib/curl_get_line.c
  18. +29 −0 vendor/curl/lib/curl_get_line.h
  19. +3 −1 vendor/curl/lib/curl_md4.h
  20. +5 −5 vendor/curl/lib/curl_md5.h
  21. +2 −2 vendor/curl/lib/curl_memory.h
  22. +6 −0 vendor/curl/lib/curl_ntlm_core.c
  23. +1 −3 vendor/curl/lib/curl_ntlm_core.h
  24. +59 −12 vendor/curl/lib/curl_ntlm_wb.c
  25. +7 −4 vendor/curl/lib/curl_ntlm_wb.h
  26. +1 −1 vendor/curl/lib/curl_path.c
  27. +17 −16 vendor/curl/lib/curl_sasl.c
  28. +4 −4 vendor/curl/lib/curl_setup.h
  29. +8 −3 vendor/curl/lib/doh.c
  30. +9 −1 vendor/curl/lib/doh.h
  31. +9 −7 vendor/curl/lib/easy.c
  32. +3 −2 vendor/curl/lib/fileinfo.c
  33. +7 −7 vendor/curl/lib/formdata.c
  34. +10 −1 vendor/curl/lib/formdata.h
  35. +4 −5 vendor/curl/lib/ftp.c
  36. +1 −4 vendor/curl/lib/ftplistparser.c
  37. +2 −4 vendor/curl/lib/hostcheck.c
  38. +8 −38 vendor/curl/lib/hostip.c
  39. +5 −2 vendor/curl/lib/hostip.h
  40. +3 −2 vendor/curl/lib/hostip6.c
  41. +78 −56 vendor/curl/lib/http.c
  42. +5 −7 vendor/curl/lib/http2.c
  43. +3 −2 vendor/curl/lib/http_digest.c
  44. +6 −6 vendor/curl/lib/http_digest.h
  45. +32 −18 vendor/curl/lib/http_negotiate.c
  46. +3 −3 vendor/curl/lib/http_negotiate.h
  47. +21 −16 vendor/curl/lib/http_ntlm.c
  48. +5 −5 vendor/curl/lib/http_ntlm.h
  49. +13 −10 vendor/curl/lib/if2ip.c
  50. +2 −2 vendor/curl/lib/if2ip.h
  51. +5 −9 vendor/curl/lib/imap.c
  52. +2 −1 vendor/curl/lib/inet_pton.c
  53. +1 −2 vendor/curl/lib/ldap.c
  54. +59 −54 vendor/curl/lib/md4.c
  55. +82 −81 vendor/curl/lib/md5.c
  56. +3 −4 vendor/curl/lib/memdebug.c
  57. +7 −73 vendor/curl/lib/mime.c
  58. +19 −1 vendor/curl/lib/mime.h
  59. +110 −208 vendor/curl/lib/multi.c
  60. +14 −34 vendor/curl/lib/multihandle.h
  61. +3 −14 vendor/curl/lib/multiif.h
  62. +4 −1 vendor/curl/lib/netrc.c
  63. +8 −1 vendor/curl/lib/netrc.h
  64. +0 −5 vendor/curl/lib/openldap.c
  65. +26 −15 vendor/curl/lib/parsedate.c
  66. +0 −404 vendor/curl/lib/pipeline.c
  67. +0 −56 vendor/curl/lib/pipeline.h
  68. +1 −0 vendor/curl/lib/pop3.c
  69. +63 −51 vendor/curl/lib/progress.c
  70. +0 −13 vendor/curl/lib/rtsp.c
  71. +3 −10 vendor/curl/lib/security.c
  72. +6 −34 vendor/curl/lib/sendf.c
  73. +161 −100 vendor/curl/lib/setopt.c
  74. +3 −7 vendor/curl/lib/smtp.c
  75. +17 −5 vendor/curl/lib/socks.c
  76. +2 −2 vendor/curl/lib/splay.c
  77. +5 −14 vendor/curl/lib/ssh-libssh.c
  78. +7 −19 vendor/curl/lib/ssh.c
  79. +1 −1 vendor/curl/lib/tftp.c
  80. +2 −0 vendor/curl/lib/timeval.c
  81. +22 −82 vendor/curl/lib/transfer.c
  82. +210 −454 vendor/curl/lib/url.c
  83. +1 −8 vendor/curl/lib/url.h
  84. +3 −4 vendor/curl/lib/urlapi-int.h
  85. +90 −16 vendor/curl/lib/urlapi.c
  86. +49 −38 vendor/curl/lib/urldata.h
  87. +25 −15 vendor/curl/lib/vauth/cleartext.c
  88. +2 −3 vendor/curl/lib/vauth/digest.c
  89. +3 −3 vendor/curl/lib/vauth/krb5_gssapi.c
  90. +3 −3 vendor/curl/lib/vauth/krb5_sspi.c
  91. +12 −12 vendor/curl/lib/vauth/ntlm.c
  92. +4 −4 vendor/curl/lib/vauth/ntlm_sspi.c
  93. +48 −8 vendor/curl/lib/vauth/oauth2.c
  94. +4 −5 vendor/curl/lib/vauth/spnego_gssapi.c
  95. +3 −4 vendor/curl/lib/vauth/spnego_sspi.c
  96. +21 −21 vendor/curl/lib/vauth/vauth.c
  97. +14 −6 vendor/curl/lib/vauth/vauth.h
  98. +7 −3 vendor/curl/lib/version.c
  99. +4 −1 vendor/curl/lib/vtls/cyassl.c
  100. +9 −9 vendor/curl/lib/vtls/gskit.c
  101. +26 −23 vendor/curl/lib/vtls/gtls.c
  102. +8 −9 vendor/curl/lib/vtls/mbedtls.c
  103. +1 −1 vendor/curl/lib/vtls/mesalink.c
  104. +13 −5 vendor/curl/lib/vtls/nss.c
  105. +14 −6 vendor/curl/lib/vtls/openssl.c
  106. +5 −4 vendor/curl/lib/vtls/polarssl.c
  107. +25 −34 vendor/curl/lib/vtls/polarssl_threadlock.c
  108. +2 −7 vendor/curl/lib/vtls/polarssl_threadlock.h
  109. +11 −9 vendor/curl/lib/vtls/schannel.c
  110. +6 −1 vendor/curl/lib/vtls/sectransp.c
  111. +17 −14 vendor/curl/lib/vtls/vtls.c
  112. +5 −1 vendor/curl/lib/wildcard.c
  113. +8 −2 vendor/curl/lib/wildcard.h
  114. +9 −8 vendor/curl/lib/x509asn1.c
@@ -114,7 +114,7 @@ typedef void CURLSH;

#ifdef CURL_STATICLIB
# define CURL_EXTERN
#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) || \
#elif defined(WIN32) || defined(__SYMBIAN32__) || \
(__has_declspec_attribute(dllexport) && \
__has_declspec_attribute(dllimport))
# if defined(BUILDING_LIBCURL)
@@ -290,7 +290,7 @@ typedef enum {
struct curl_fileinfo {
char *filename;
curlfiletype filetype;
time_t time;
time_t time; /* always zero! */
unsigned int perm;
int uid;
int gid;
@@ -1918,6 +1918,9 @@ typedef enum {
/* alt-svc cache file name to possibly read from/write to */
CINIT(ALTSVC, STRINGPOINT, 287),

/* maximum age of a connection to consider it for reuse (in seconds) */
CINIT(MAXAGE_CONN, LONG, 288),

CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

@@ -30,13 +30,13 @@

/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "7.64.1"
#define LIBCURL_VERSION "7.65.0"

/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 64
#define LIBCURL_VERSION_PATCH 1
#define LIBCURL_VERSION_MINOR 65
#define LIBCURL_VERSION_PATCH 0

/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
@@ -57,7 +57,7 @@
CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
#define LIBCURL_VERSION_NUM 0x074001
#define LIBCURL_VERSION_NUM 0x074100

/*
* This is the date and time when the full source package was created. The
@@ -68,9 +68,9 @@
*
* "2007-11-23"
*/
#define LIBCURL_TIMESTAMP "2019-03-27"
#define LIBCURL_TIMESTAMP "2019-05-22"

#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
#define CURL_AT_LEAST_VERSION(x,y,z) \
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))

@@ -113,7 +113,6 @@ __extension__ ({ \
})

/* wraps curl_easy_getinfo() with typechecking */
/* FIXME: don't allow const pointers */
#define curl_easy_getinfo(handle, info, arg) \
__extension__ ({ \
__typeof__(info) _curl_info = info; \
@@ -146,9 +145,8 @@ __extension__ ({ \
curl_easy_getinfo(handle, _curl_info, arg); \
})

/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
* for now just make sure that the functions are called with three
* arguments
/*
* For now, just make sure that the functions are called with three arguments
*/
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
@@ -506,10 +504,6 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
_curl_is_arr((expr), char) || \
_curl_is_arr((expr), unsigned char))

/* FIXME: the whole callback checking is messy...
* The idea is to tolerate char vs. void and const vs. not const
* pointers in arguments at least
*/
/* helper: __builtin_types_compatible_p distinguishes between functions and
* function pointers, hide it */
#define _curl_callback_compatible(func, type) \
@@ -60,7 +60,8 @@ typedef enum {
CURLUPART_PORT,
CURLUPART_PATH,
CURLUPART_QUERY,
CURLUPART_FRAGMENT
CURLUPART_FRAGMENT,
CURLUPART_ZONEID /* added in 7.65.0 */
} CURLUPart;

#define CURLU_DEFAULT_PORT (1<<0) /* return default port number */
@@ -29,7 +29,7 @@
#include <curl/curl.h>
#include "urldata.h"
#include "altsvc.h"
#include "cookie.h" /* for Curl_get_line() */
#include "curl_get_line.h"
#include "strcase.h"
#include "parsedate.h"
#include "sendf.h"
@@ -253,7 +253,6 @@ struct altsvcinfo *Curl_altsvc_init(void)
| CURLALTSVC_H2
#endif
#ifdef USE_HTTP3
/* TODO: adjust when known */
| CURLALTSVC_H3
#endif
;
@@ -349,7 +348,7 @@ static CURLcode getalnum(const char **ptr, char *alpnbuf, size_t buflen)
len = p - protop;

if(!len || (len >= buflen))
return CURLE_BAD_FUNCTION_ARGUMENT; /* TODO: improve error code */
return CURLE_BAD_FUNCTION_ARGUMENT;
memcpy(alpnbuf, protop, len);
alpnbuf[len] = 0;
*ptr = p;
@@ -425,7 +424,6 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,

/* "clear" is a magic keyword */
if(strcasecompare(alpnbuf, "clear")) {
/* TODO: clear whatever it is it should clear */
return CURLE_OK;
}

@@ -478,7 +476,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
p++;
len = p - hostp;
if(!len || (len >= MAX_ALTSVC_HOSTLEN))
return CURLE_BAD_FUNCTION_ARGUMENT; /* TODO: improve error code */
return CURLE_BAD_FUNCTION_ARGUMENT;
memcpy(namebuf, hostp, len);
namebuf[len] = 0;
dsthost = namebuf;
@@ -504,8 +502,8 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
srcalpnid, dstalpnid,
srcport, dstport);
if(as) {
/* TODO: the expires time also needs to take the Age: value (if any)
into account. [See RFC 7838 section 3.1] */
/* The expires time also needs to take the Age: value (if any) into
account. [See RFC 7838 section 3.1] */
as->expires = maxage + time(NULL);
as->persist = persist;
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
@@ -68,7 +68,7 @@
#include "progress.h"

# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
(defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
(defined(WIN32) || defined(__SYMBIAN32__))
# define CARES_STATICLIB
# endif
# include <ares.h>
@@ -89,8 +89,20 @@ struct ResolverResults {
int num_pending; /* number of ares_gethostbyname() requests */
Curl_addrinfo *temp_ai; /* intermediary result while fetching c-ares parts */
int last_status;
struct curltime happy_eyeballs_dns_time; /* when this timer started, or 0 */
};

/* How long we are willing to wait for additional parallel responses after
obtaining a "definitive" one.
This is intended to equal the c-ares default timeout. cURL always uses that
default value. Unfortunately, c-ares doesn't expose its default timeout in
its API, but it is officially documented as 5 seconds.
See query_completed_cb() for an explanation of how this is used.
*/
#define HAPPY_EYEBALLS_DNS_TIMEOUT 5000

/*
* Curl_resolver_global_init() - the generic low-level asynchronous name
* resolve API. Called from curl_global_init() to initialize global resolver
@@ -319,9 +331,9 @@ static int waitperform(struct connectdata *conn, int timeout_ms)
/* move through the descriptors and ask for processing on them */
for(i = 0; i < num; i++)
ares_process_fd((ares_channel)data->state.resolver,
pfd[i].revents & (POLLRDNORM|POLLIN)?
(pfd[i].revents & (POLLRDNORM|POLLIN))?
pfd[i].fd:ARES_SOCKET_BAD,
pfd[i].revents & (POLLWRNORM|POLLOUT)?
(pfd[i].revents & (POLLWRNORM|POLLOUT))?
pfd[i].fd:ARES_SOCKET_BAD);
}
return nfds;
@@ -347,6 +359,29 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,

waitperform(conn, 0);

/* Now that we've checked for any last minute results above, see if there are
any responses still pending when the EXPIRE_HAPPY_EYEBALLS_DNS timer
expires. */
if(res
&& res->num_pending
/* This is only set to non-zero if the timer was started. */
&& (res->happy_eyeballs_dns_time.tv_sec
|| res->happy_eyeballs_dns_time.tv_usec)
&& (Curl_timediff(Curl_now(), res->happy_eyeballs_dns_time)
>= HAPPY_EYEBALLS_DNS_TIMEOUT)) {
/* Remember that the EXPIRE_HAPPY_EYEBALLS_DNS timer is no longer
running. */
memset(
&res->happy_eyeballs_dns_time, 0, sizeof(res->happy_eyeballs_dns_time));

/* Cancel the raw c-ares request, which will fire query_completed_cb() with
ARES_ECANCELLED synchronously for all pending responses. This will
leave us with res->num_pending == 0, which is perfect for the next
block. */
ares_cancel((ares_channel)data->state.resolver);
DEBUGASSERT(res->num_pending == 0);
}

if(res && !res->num_pending) {
if(dns) {
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
@@ -455,9 +490,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,

if(result)
/* close the connection, since we can't return failure here without
cleaning up this connection properly.
TODO: remove this action from here, it is not a name resolver decision.
*/
cleaning up this connection properly. */
connclose(conn, "c-ares resolve failed");

return result;
@@ -517,6 +550,66 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
/* A successful result overwrites any previous error */
if(res->last_status != ARES_SUCCESS)
res->last_status = status;

/* If there are responses still pending, we presume they must be the
complementary IPv4 or IPv6 lookups that we started in parallel in
Curl_resolver_getaddrinfo() (for Happy Eyeballs). If we've got a
"definitive" response from one of a set of parallel queries, we need to
think about how long we're willing to wait for more responses. */
if(res->num_pending
/* Only these c-ares status values count as "definitive" for these
purposes. For example, ARES_ENODATA is what we expect when there is
no IPv6 entry for a domain name, and that's not a reason to get more
aggressive in our timeouts for the other response. Other errors are
either a result of bad input (which should affect all parallel
requests), local or network conditions, non-definitive server
responses, or us cancelling the request. */
&& (status == ARES_SUCCESS || status == ARES_ENOTFOUND)) {
/* Right now, there can only be up to two parallel queries, so don't
bother handling any other cases. */
DEBUGASSERT(res->num_pending == 1);

/* It's possible that one of these parallel queries could succeed
quickly, but the other could always fail or timeout (when we're
talking to a pool of DNS servers that can only successfully resolve
IPv4 address, for example).
It's also possible that the other request could always just take
longer because it needs more time or only the second DNS server can
fulfill it successfully. But, to align with the philosophy of Happy
Eyeballs, we don't want to wait _too_ long or users will think
requests are slow when IPv6 lookups don't actually work (but IPv4 ones
do).
So, now that we have a usable answer (some IPv4 addresses, some IPv6
addresses, or "no such domain"), we start a timeout for the remaining
pending responses. Even though it is typical that this resolved
request came back quickly, that needn't be the case. It might be that
this completing request didn't get a result from the first DNS server
or even the first round of the whole DNS server pool. So it could
already be quite some time after we issued the DNS queries in the
first place. Without modifying c-ares, we can't know exactly where in
its retry cycle we are. We could guess based on how much time has
gone by, but it doesn't really matter. Happy Eyeballs tells us that,
given usable information in hand, we simply don't want to wait "too
much longer" after we get a result.
We simply wait an additional amount of time equal to the default
c-ares query timeout. That is enough time for a typical parallel
response to arrive without being "too long". Even on a network
where one of the two types of queries is failing or timing out
constantly, this will usually mean we wait a total of the default
c-ares timeout (5 seconds) plus the round trip time for the successful
request, which seems bearable. The downside is that c-ares might race
with us to issue one more retry just before we give up, but it seems
better to "waste" that request instead of trying to guess the perfect
timeout to prevent it. After all, we don't even know where in the
c-ares retry cycle each request is.
*/
res->happy_eyeballs_dns_time = Curl_now();
Curl_expire(
conn->data, HAPPY_EYEBALLS_DNS_TIMEOUT, EXPIRE_HAPPY_EYEBALLS_DNS);
}
}
}

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -23,6 +23,11 @@
/* Base64 encoding/decoding */

#include "curl_setup.h"

#if !defined(CURL_DISABLE_HTTP_AUTH) || defined(USE_LIBSSH2) || \
defined(USE_LIBSSH) || !defined(CURL_DISABLE_LDAP) || \
!defined(CURL_DISABLE_DOH) || defined(USE_SSL)

#include "urldata.h" /* for the Curl_easy definition */
#include "warnless.h"
#include "curl_base64.h"
@@ -317,3 +322,5 @@ CURLcode Curl_base64url_encode(struct Curl_easy *data,
{
return base64_encode(base64url, data, inputbuff, insize, outptr, outlen);
}

#endif /* no users so disabled */
@@ -263,6 +263,9 @@
/* Define to 1 if you have the `getpass_r' function. */
/* #undef HAVE_GETPASS_R */

/* Define to 1 if you have the getpeername function. */
#define HAVE_GETPEERNAME 1

/* Define to 1 if you have the `getppid' function. */
#define HAVE_GETPPID 1

@@ -278,6 +281,9 @@
/* Define to 1 if you have the getservbyport_r function. */
#define HAVE_GETSERVBYPORT_R 1

/* Define to 1 if you have the getsockname function. */
#define HAVE_GETSOCKNAME 1

/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1

1 comment on commit ac0715c

@patrikjuvonen

This comment has been minimized.

Copy link
Member Author

commented on ac0715c Jun 2, 2019

Please sign in to comment.
You can’t perform that action at this time.