Skip to content

Commit ac0715c

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
1 parent 8475539 commit ac0715c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1907
-2391
lines changed

vendor/curl/include/curl/curl.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ typedef void CURLSH;
114114

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

1921+
/* maximum age of a connection to consider it for reuse (in seconds) */
1922+
CINIT(MAXAGE_CONN, LONG, 288),
1923+
19211924
CURLOPT_LASTENTRY /* the last unused */
19221925
} CURLoption;
19231926

vendor/curl/include/curl/curlver.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131
/* This is the version number of the libcurl package from which this header
3232
file origins: */
33-
#define LIBCURL_VERSION "7.64.1"
33+
#define LIBCURL_VERSION "7.65.0"
3434

3535
/* The numeric version number is also available "in parts" by using these
3636
defines: */
3737
#define LIBCURL_VERSION_MAJOR 7
38-
#define LIBCURL_VERSION_MINOR 64
39-
#define LIBCURL_VERSION_PATCH 1
38+
#define LIBCURL_VERSION_MINOR 65
39+
#define LIBCURL_VERSION_PATCH 0
4040

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

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

73-
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
73+
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
7474
#define CURL_AT_LEAST_VERSION(x,y,z) \
7575
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
7676

vendor/curl/include/curl/typecheck-gcc.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ __extension__ ({ \
113113
})
114114

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

149-
/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
150-
* for now just make sure that the functions are called with three
151-
* arguments
148+
/*
149+
* For now, just make sure that the functions are called with three arguments
152150
*/
153151
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
154152
#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,
506504
_curl_is_arr((expr), char) || \
507505
_curl_is_arr((expr), unsigned char))
508506

509-
/* FIXME: the whole callback checking is messy...
510-
* The idea is to tolerate char vs. void and const vs. not const
511-
* pointers in arguments at least
512-
*/
513507
/* helper: __builtin_types_compatible_p distinguishes between functions and
514508
* function pointers, hide it */
515509
#define _curl_callback_compatible(func, type) \

vendor/curl/include/curl/urlapi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ typedef enum {
6060
CURLUPART_PORT,
6161
CURLUPART_PATH,
6262
CURLUPART_QUERY,
63-
CURLUPART_FRAGMENT
63+
CURLUPART_FRAGMENT,
64+
CURLUPART_ZONEID /* added in 7.65.0 */
6465
} CURLUPart;
6566

6667
#define CURLU_DEFAULT_PORT (1<<0) /* return default port number */

vendor/curl/lib/altsvc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <curl/curl.h>
3030
#include "urldata.h"
3131
#include "altsvc.h"
32-
#include "cookie.h" /* for Curl_get_line() */
32+
#include "curl_get_line.h"
3333
#include "strcase.h"
3434
#include "parsedate.h"
3535
#include "sendf.h"
@@ -253,7 +253,6 @@ struct altsvcinfo *Curl_altsvc_init(void)
253253
| CURLALTSVC_H2
254254
#endif
255255
#ifdef USE_HTTP3
256-
/* TODO: adjust when known */
257256
| CURLALTSVC_H3
258257
#endif
259258
;
@@ -349,7 +348,7 @@ static CURLcode getalnum(const char **ptr, char *alpnbuf, size_t buflen)
349348
len = p - protop;
350349

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

426425
/* "clear" is a magic keyword */
427426
if(strcasecompare(alpnbuf, "clear")) {
428-
/* TODO: clear whatever it is it should clear */
429427
return CURLE_OK;
430428
}
431429

@@ -478,7 +476,7 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
478476
p++;
479477
len = p - hostp;
480478
if(!len || (len >= MAX_ALTSVC_HOSTLEN))
481-
return CURLE_BAD_FUNCTION_ARGUMENT; /* TODO: improve error code */
479+
return CURLE_BAD_FUNCTION_ARGUMENT;
482480
memcpy(namebuf, hostp, len);
483481
namebuf[len] = 0;
484482
dsthost = namebuf;
@@ -504,8 +502,8 @@ CURLcode Curl_altsvc_parse(struct Curl_easy *data,
504502
srcalpnid, dstalpnid,
505503
srcport, dstport);
506504
if(as) {
507-
/* TODO: the expires time also needs to take the Age: value (if any)
508-
into account. [See RFC 7838 section 3.1] */
505+
/* The expires time also needs to take the Age: value (if any) into
506+
account. [See RFC 7838 section 3.1] */
509507
as->expires = maxage + time(NULL);
510508
as->persist = persist;
511509
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);

vendor/curl/lib/asyn-ares.c

Lines changed: 99 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#include "progress.h"
6969

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

95+
/* How long we are willing to wait for additional parallel responses after
96+
obtaining a "definitive" one.
97+
98+
This is intended to equal the c-ares default timeout. cURL always uses that
99+
default value. Unfortunately, c-ares doesn't expose its default timeout in
100+
its API, but it is officially documented as 5 seconds.
101+
102+
See query_completed_cb() for an explanation of how this is used.
103+
*/
104+
#define HAPPY_EYEBALLS_DNS_TIMEOUT 5000
105+
94106
/*
95107
* Curl_resolver_global_init() - the generic low-level asynchronous name
96108
* resolve API. Called from curl_global_init() to initialize global resolver
@@ -319,9 +331,9 @@ static int waitperform(struct connectdata *conn, int timeout_ms)
319331
/* move through the descriptors and ask for processing on them */
320332
for(i = 0; i < num; i++)
321333
ares_process_fd((ares_channel)data->state.resolver,
322-
pfd[i].revents & (POLLRDNORM|POLLIN)?
334+
(pfd[i].revents & (POLLRDNORM|POLLIN))?
323335
pfd[i].fd:ARES_SOCKET_BAD,
324-
pfd[i].revents & (POLLWRNORM|POLLOUT)?
336+
(pfd[i].revents & (POLLWRNORM|POLLOUT))?
325337
pfd[i].fd:ARES_SOCKET_BAD);
326338
}
327339
return nfds;
@@ -347,6 +359,29 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
347359

348360
waitperform(conn, 0);
349361

362+
/* Now that we've checked for any last minute results above, see if there are
363+
any responses still pending when the EXPIRE_HAPPY_EYEBALLS_DNS timer
364+
expires. */
365+
if(res
366+
&& res->num_pending
367+
/* This is only set to non-zero if the timer was started. */
368+
&& (res->happy_eyeballs_dns_time.tv_sec
369+
|| res->happy_eyeballs_dns_time.tv_usec)
370+
&& (Curl_timediff(Curl_now(), res->happy_eyeballs_dns_time)
371+
>= HAPPY_EYEBALLS_DNS_TIMEOUT)) {
372+
/* Remember that the EXPIRE_HAPPY_EYEBALLS_DNS timer is no longer
373+
running. */
374+
memset(
375+
&res->happy_eyeballs_dns_time, 0, sizeof(res->happy_eyeballs_dns_time));
376+
377+
/* Cancel the raw c-ares request, which will fire query_completed_cb() with
378+
ARES_ECANCELLED synchronously for all pending responses. This will
379+
leave us with res->num_pending == 0, which is perfect for the next
380+
block. */
381+
ares_cancel((ares_channel)data->state.resolver);
382+
DEBUGASSERT(res->num_pending == 0);
383+
}
384+
350385
if(res && !res->num_pending) {
351386
if(dns) {
352387
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
@@ -455,9 +490,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
455490

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

463496
return result;
@@ -517,6 +550,66 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
517550
/* A successful result overwrites any previous error */
518551
if(res->last_status != ARES_SUCCESS)
519552
res->last_status = status;
553+
554+
/* If there are responses still pending, we presume they must be the
555+
complementary IPv4 or IPv6 lookups that we started in parallel in
556+
Curl_resolver_getaddrinfo() (for Happy Eyeballs). If we've got a
557+
"definitive" response from one of a set of parallel queries, we need to
558+
think about how long we're willing to wait for more responses. */
559+
if(res->num_pending
560+
/* Only these c-ares status values count as "definitive" for these
561+
purposes. For example, ARES_ENODATA is what we expect when there is
562+
no IPv6 entry for a domain name, and that's not a reason to get more
563+
aggressive in our timeouts for the other response. Other errors are
564+
either a result of bad input (which should affect all parallel
565+
requests), local or network conditions, non-definitive server
566+
responses, or us cancelling the request. */
567+
&& (status == ARES_SUCCESS || status == ARES_ENOTFOUND)) {
568+
/* Right now, there can only be up to two parallel queries, so don't
569+
bother handling any other cases. */
570+
DEBUGASSERT(res->num_pending == 1);
571+
572+
/* It's possible that one of these parallel queries could succeed
573+
quickly, but the other could always fail or timeout (when we're
574+
talking to a pool of DNS servers that can only successfully resolve
575+
IPv4 address, for example).
576+
577+
It's also possible that the other request could always just take
578+
longer because it needs more time or only the second DNS server can
579+
fulfill it successfully. But, to align with the philosophy of Happy
580+
Eyeballs, we don't want to wait _too_ long or users will think
581+
requests are slow when IPv6 lookups don't actually work (but IPv4 ones
582+
do).
583+
584+
So, now that we have a usable answer (some IPv4 addresses, some IPv6
585+
addresses, or "no such domain"), we start a timeout for the remaining
586+
pending responses. Even though it is typical that this resolved
587+
request came back quickly, that needn't be the case. It might be that
588+
this completing request didn't get a result from the first DNS server
589+
or even the first round of the whole DNS server pool. So it could
590+
already be quite some time after we issued the DNS queries in the
591+
first place. Without modifying c-ares, we can't know exactly where in
592+
its retry cycle we are. We could guess based on how much time has
593+
gone by, but it doesn't really matter. Happy Eyeballs tells us that,
594+
given usable information in hand, we simply don't want to wait "too
595+
much longer" after we get a result.
596+
597+
We simply wait an additional amount of time equal to the default
598+
c-ares query timeout. That is enough time for a typical parallel
599+
response to arrive without being "too long". Even on a network
600+
where one of the two types of queries is failing or timing out
601+
constantly, this will usually mean we wait a total of the default
602+
c-ares timeout (5 seconds) plus the round trip time for the successful
603+
request, which seems bearable. The downside is that c-ares might race
604+
with us to issue one more retry just before we give up, but it seems
605+
better to "waste" that request instead of trying to guess the perfect
606+
timeout to prevent it. After all, we don't even know where in the
607+
c-ares retry cycle each request is.
608+
*/
609+
res->happy_eyeballs_dns_time = Curl_now();
610+
Curl_expire(
611+
conn->data, HAPPY_EYEBALLS_DNS_TIMEOUT, EXPIRE_HAPPY_EYEBALLS_DNS);
612+
}
520613
}
521614
}
522615

vendor/curl/lib/base64.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* | (__| |_| | _ <| |___
66
* \___|\___/|_| \_\_____|
77
*
8-
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
8+
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
99
*
1010
* This software is licensed as described in the file COPYING, which
1111
* you should have received as part of this distribution. The terms
@@ -23,6 +23,11 @@
2323
/* Base64 encoding/decoding */
2424

2525
#include "curl_setup.h"
26+
27+
#if !defined(CURL_DISABLE_HTTP_AUTH) || defined(USE_LIBSSH2) || \
28+
defined(USE_LIBSSH) || !defined(CURL_DISABLE_LDAP) || \
29+
!defined(CURL_DISABLE_DOH) || defined(USE_SSL)
30+
2631
#include "urldata.h" /* for the Curl_easy definition */
2732
#include "warnless.h"
2833
#include "curl_base64.h"
@@ -317,3 +322,5 @@ CURLcode Curl_base64url_encode(struct Curl_easy *data,
317322
{
318323
return base64_encode(base64url, data, inputbuff, insize, outptr, outlen);
319324
}
325+
326+
#endif /* no users so disabled */

vendor/curl/lib/config-linux.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@
263263
/* Define to 1 if you have the `getpass_r' function. */
264264
/* #undef HAVE_GETPASS_R */
265265

266+
/* Define to 1 if you have the getpeername function. */
267+
#define HAVE_GETPEERNAME 1
268+
266269
/* Define to 1 if you have the `getppid' function. */
267270
#define HAVE_GETPPID 1
268271

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

284+
/* Define to 1 if you have the getsockname function. */
285+
#define HAVE_GETSOCKNAME 1
286+
281287
/* Define to 1 if you have the `gettimeofday' function. */
282288
#define HAVE_GETTIMEOFDAY 1
283289

0 commit comments

Comments
 (0)