Skip to content

Commit

Permalink
Upgrade bundled libcurl to version 7.77.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
enzo1982 committed Jun 24, 2021
1 parent f0105fe commit eb1d573
Show file tree
Hide file tree
Showing 118 changed files with 3,840 additions and 2,981 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dd.mm.21 hh:mm - smooth alpha 0.9.8

- fixed several instances of undefined behavior found with -fsanitize=undefined
- fixed translation field not being focused after selecting entries in Translator utility
- upgraded libcurl to version 7.76.1
- upgraded libcurl to version 7.77.0

14.02.21 14:56 - smooth alpha 0.9.7

Expand Down
29 changes: 23 additions & 6 deletions include/support/curl/curl.h
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ typedef enum {
CURLE_HTTP3, /* 95 - An HTTP/3 layer problem */
CURLE_QUIC_CONNECT_ERROR, /* 96 - QUIC connection error */
CURLE_PROXY, /* 97 - proxy handshake error */
CURLE_SSL_CLIENTCERT, /* 98 - client-side certificate required */
CURL_LAST /* never use! */
} CURLcode;

Expand Down Expand Up @@ -888,6 +889,10 @@ typedef enum {
operating system. Currently implemented under MS-Windows. */
#define CURLSSLOPT_NATIVE_CA (1<<4)

/* - CURLSSLOPT_AUTO_CLIENT_CERT tells libcurl to automatically locate and use
a client certificate for authentication. (Schannel) */
#define CURLSSLOPT_AUTO_CLIENT_CERT (1<<5)

/* The default connection attempt delay in milliseconds for happy eyeballs.
CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.3 and happy-eyeballs-timeout-ms.d document
this value, keep them in sync. */
Expand Down Expand Up @@ -1461,8 +1466,8 @@ typedef enum {
#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT

/* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
tell libcurl to resolve names to those IP versions only. This only has
affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
tell libcurl to use those IP versions only. This only has effect on
systems with support for more than one, i.e IPv4 _and_ IPv6. */
CURLOPT(CURLOPT_IPRESOLVE, CURLOPTTYPE_VALUES, 113),

/* Set this option to limit the size of a file that will be downloaded from
Expand Down Expand Up @@ -2088,6 +2093,14 @@ typedef enum {
/* Same as CURLOPT_SSL_VERIFYSTATUS but for DOH (DNS-over-HTTPS) servers. */
CURLOPT(CURLOPT_DOH_SSL_VERIFYSTATUS, CURLOPTTYPE_LONG, 308),

/* The CA certificates as "blob" used to validate the peer certificate
this option is used only if SSL_VERIFYPEER is true */
CURLOPT(CURLOPT_CAINFO_BLOB, CURLOPTTYPE_BLOB, 309),

/* The CA certificates as "blob" used to validate the proxy certificate
this option is used only if PROXY_SSL_VERIFYPEER is true */
CURLOPT(CURLOPT_PROXY_CAINFO_BLOB, CURLOPTTYPE_BLOB, 310),

CURLOPT_LASTENTRY /* the last unused */
} CURLoption;

Expand Down Expand Up @@ -2122,10 +2135,10 @@ typedef enum {
/* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
name resolves addresses using more than one IP protocol version, this
option might be handy to force libcurl to use a specific IP version. */
#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
#define CURL_IPRESOLVE_WHATEVER 0 /* default, uses addresses to all IP
versions that your system allows */
#define CURL_IPRESOLVE_V4 1 /* resolve to IPv4 addresses */
#define CURL_IPRESOLVE_V6 2 /* resolve to IPv6 addresses */
#define CURL_IPRESOLVE_V4 1 /* uses only IPv4 addresses/connections */
#define CURL_IPRESOLVE_V6 2 /* uses only IPv6 addresses/connections */

/* three convenient "aliases" that follow the name scheme better */
#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
Expand Down Expand Up @@ -2866,6 +2879,7 @@ typedef enum {
CURLVERSION_SEVENTH,
CURLVERSION_EIGHTH,
CURLVERSION_NINTH,
CURLVERSION_TENTH,
CURLVERSION_LAST /* never actually use this */
} CURLversion;

Expand All @@ -2874,7 +2888,7 @@ typedef enum {
meant to be a built-in version number for what kind of struct the caller
expects. If the struct ever changes, we redefine the NOW to another enum
from above. */
#define CURLVERSION_NOW CURLVERSION_NINTH
#define CURLVERSION_NOW CURLVERSION_TENTH

struct curl_version_info_data {
CURLversion age; /* age of the returned struct */
Expand Down Expand Up @@ -2927,6 +2941,9 @@ struct curl_version_info_data {

/* These fields were added in CURLVERSION_NINTH */
const char *hyper_version; /* human readable string. */

/* These fields were added in CURLVERSION_TENTH */
const char *gsasl_version; /* human readable string. */
};
typedef struct curl_version_info_data curl_version_info_data;

Expand Down
10 changes: 5 additions & 5 deletions include/support/curl/curlver.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@

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

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

/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
Expand All @@ -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 0x074c01
#define LIBCURL_VERSION_NUM 0x074d00

/*
* This is the date and time when the full source package was created. The
Expand All @@ -68,7 +68,7 @@
*
* "2007-11-23"
*/
#define LIBCURL_TIMESTAMP "2021-04-14"
#define LIBCURL_TIMESTAMP "2021-05-26"

#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
#define CURL_AT_LEAST_VERSION(x,y,z) \
Expand Down
2 changes: 1 addition & 1 deletion libraries/libcurl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ifeq ($(BUILD_OSX),True)
endif

# Enter object files here:
OBJECTS = altsvc.o asyn-ares.o asyn-thread.o base64.o c-hyper.o conncache.o connect.o content_encoding.o cookie.o curl_addrinfo.o curl_ctype.o curl_des.o curl_endian.o curl_fnmatch.o curl_get_line.o curl_gethostname.o curl_gssapi.o curl_memrchr.o curl_multibyte.o curl_ntlm_core.o curl_ntlm_wb.o curl_path.o curl_range.o curl_rtmp.o curl_sasl.o curl_sspi.o curl_threads.o dict.o doh.o dotdot.o dynbuf.o easy.o easygetopt.o easyoptions.o escape.o file.o fileinfo.o formdata.o ftp.o ftplistparser.o getenv.o getinfo.o gopher.o hash.o hmac.o hostasyn.o hostcheck.o hostip.o hostip4.o hostip6.o hostsyn.o hsts.o http.o http_aws_sigv4.o http_chunks.o http_digest.o http_negotiate.o http_ntlm.o http_proxy.o http2.o idn_win32.o if2ip.o imap.o inet_ntop.o inet_pton.o krb5.o ldap.o llist.o md4.o md5.o memdebug.o mime.o mprintf.o mqtt.o multi.o netrc.o non-ascii.o nonblock.o openldap.o parsedate.o pingpong.o pop3.o progress.o psl.o rand.o rename.o rtsp.o select.o sendf.o setopt.o sha256.o share.o slist.o smb.o smtp.o socks.o socks_gssapi.o socks_sspi.o speedcheck.o socketpair.o splay.o strcase.o strdup.o strerror.o strtok.o strtoofft.o telnet.o tftp.o timeval.o transfer.o url.o urlapi.o version.o warnless.o wildcard.o x509asn1.o
OBJECTS = altsvc.o asyn-ares.o asyn-thread.o base64.o bufref.o c-hyper.o conncache.o connect.o content_encoding.o cookie.o curl_addrinfo.o curl_ctype.o curl_des.o curl_endian.o curl_fnmatch.o curl_get_line.o curl_gethostname.o curl_gssapi.o curl_memrchr.o curl_multibyte.o curl_ntlm_core.o curl_ntlm_wb.o curl_path.o curl_range.o curl_rtmp.o curl_sasl.o curl_sspi.o curl_threads.o dict.o doh.o dotdot.o dynbuf.o easy.o easygetopt.o easyoptions.o escape.o file.o fileinfo.o formdata.o ftp.o ftplistparser.o getenv.o getinfo.o gopher.o hash.o hmac.o hostasyn.o hostcheck.o hostip.o hostip4.o hostip6.o hostsyn.o hsts.o http.o http_aws_sigv4.o http_chunks.o http_digest.o http_negotiate.o http_ntlm.o http_proxy.o http2.o idn_win32.o if2ip.o imap.o inet_ntop.o inet_pton.o krb5.o ldap.o llist.o md4.o md5.o memdebug.o mime.o mprintf.o mqtt.o multi.o netrc.o non-ascii.o nonblock.o openldap.o parsedate.o pingpong.o pop3.o progress.o psl.o rand.o rename.o rtsp.o select.o sendf.o setopt.o sha256.o share.o slist.o smb.o smtp.o socks.o socks_gssapi.o socks_sspi.o speedcheck.o socketpair.o splay.o strcase.o strdup.o strerror.o strtok.o strtoofft.o telnet.o tftp.o timeval.o transfer.o url.o urlapi.o version.o warnless.o wildcard.o x509asn1.o

ifeq ($(BUILD_WIN32),True)
OBJECTS += system_win32.o version_win32.o
Expand Down
53 changes: 14 additions & 39 deletions libraries/libcurl/asyn-ares.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
pfd[i].fd = socks[i];
pfd[i].events |= POLLWRNORM|POLLOUT;
}
if(pfd[i].events != 0)
if(pfd[i].events)
num++;
else
break;
Expand Down Expand Up @@ -620,28 +620,9 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
int *waitp)
{
char *bufp;
int family = PF_INET;

*waitp = 0; /* default to synchronous response */

#ifdef ENABLE_IPV6
switch(data->set.ipver) {
default:
#if ARES_VERSION >= 0x010601
family = PF_UNSPEC; /* supported by c-ares since 1.6.1, so for older
c-ares versions this just falls through and defaults
to PF_INET */
break;
#endif
case CURL_IPRESOLVE_V4:
family = PF_INET;
break;
case CURL_IPRESOLVE_V6:
family = PF_INET6;
break;
}
#endif /* ENABLE_IPV6 */

bufp = strdup(hostname);
if(bufp) {
struct thread_data *res = NULL;
Expand All @@ -661,33 +642,27 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,

/* initial status - failed */
res->last_status = ARES_ENOTFOUND;
#ifdef ENABLE_IPV6
if(family == PF_UNSPEC) {
if(Curl_ipv6works(data)) {
res->num_pending = 2;

/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.async.resolver, hostname,
PF_INET, query_completed_cb, data);
ares_gethostbyname((ares_channel)data->state.async.resolver, hostname,
PF_INET6, query_completed_cb, data);
}
else {
res->num_pending = 1;

/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.async.resolver, hostname,
PF_INET, query_completed_cb, data);
}
#if ARES_VERSION >= 0x010601
/* IPv6 supported by c-ares since 1.6.1 */
if(Curl_ipv6works(data)) {
/* The stack seems to be IPv6-enabled */
res->num_pending = 2;

/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.async.resolver, hostname,
PF_INET, query_completed_cb, data);
ares_gethostbyname((ares_channel)data->state.async.resolver, hostname,
PF_INET6, query_completed_cb, data);
}
else
#endif /* ENABLE_IPV6 */
#endif /* ARES_VERSION >= 0x010601 */
{
res->num_pending = 1;

/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.async.resolver,
hostname, family,
hostname, PF_INET,
query_completed_cb, data);
}

Expand Down
23 changes: 4 additions & 19 deletions libraries/libcurl/asyn-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ int init_thread_sync_data(struct thread_data *td,
#endif

tsd->mtx = malloc(sizeof(curl_mutex_t));
if(tsd->mtx == NULL)
if(!tsd->mtx)
goto err_exit;

Curl_mutex_init(tsd->mtx);
Expand Down Expand Up @@ -305,7 +305,7 @@ static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)

rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);

if(rc != 0) {
if(rc) {
tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;
if(tsd->sock_error == 0)
tsd->sock_error = RESOLVER_ENOMEM;
Expand Down Expand Up @@ -701,24 +701,9 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
*waitp = 0; /* default to synchronous response */

#ifdef CURLRES_IPV6
/*
* Check if a limited name resolve has been requested.
*/
switch(data->set.ipver) {
case CURL_IPRESOLVE_V4:
pf = PF_INET;
break;
case CURL_IPRESOLVE_V6:
pf = PF_INET6;
break;
default:
if(Curl_ipv6works(data))
/* The stack seems to be IPv6-enabled */
pf = PF_UNSPEC;
break;
}

if((pf != PF_INET) && !Curl_ipv6works(data))
/* The stack seems to be a non-IPv6 one */
pf = PF_INET;
#endif /* CURLRES_IPV6 */

memset(&hints, 0, sizeof(hints));
Expand Down
127 changes: 127 additions & 0 deletions libraries/libcurl/bufref.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2021, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/

#include "curl_setup.h"
#include "urldata.h"
#include "bufref.h"

#include "curl_memory.h"
#include "memdebug.h"

#define SIGNATURE 0x5c48e9b2 /* Random pattern. */

/*
* Init a bufref struct.
*/
void Curl_bufref_init(struct bufref *br)
{
DEBUGASSERT(br);
br->dtor = NULL;
br->ptr = NULL;
br->len = 0;

#ifdef DEBUGBUILD
br->signature = SIGNATURE;
#endif
}

/*
* Free the buffer and re-init the necessary fields. It doesn't touch the
* 'signature' field and thus this buffer reference can be reused.
*/

void Curl_bufref_free(struct bufref *br)
{
DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);

if(br->ptr && br->dtor)
br->dtor((void *) br->ptr);

br->dtor = NULL;
br->ptr = NULL;
br->len = 0;
}

/*
* Set the buffer reference to new values. The previously referenced buffer
* is released before assignment.
*/
void Curl_bufref_set(struct bufref *br, const void *ptr, size_t len,
void (*dtor)(void *))
{
DEBUGASSERT(ptr || !len);
DEBUGASSERT(len <= CURL_MAX_INPUT_LENGTH);

Curl_bufref_free(br);
br->ptr = (const unsigned char *) ptr;
br->len = len;
br->dtor = dtor;
}

/*
* Get a pointer to the referenced buffer.
*/
const unsigned char *Curl_bufref_ptr(const struct bufref *br)
{
DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);

return br->ptr;
}

/*
* Get the length of the referenced buffer data.
*/
size_t Curl_bufref_len(const struct bufref *br)
{
DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);

return br->len;
}

CURLcode Curl_bufref_memdup(struct bufref *br, const void *ptr, size_t len)
{
unsigned char *cpy = NULL;

DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);
DEBUGASSERT(ptr || !len);
DEBUGASSERT(len <= CURL_MAX_INPUT_LENGTH);

if(ptr) {
cpy = malloc(len + 1);
if(!cpy)
return CURLE_OUT_OF_MEMORY;
if(len)
memcpy(cpy, ptr, len);
cpy[len] = '\0';
}

Curl_bufref_set(br, cpy, len, curl_free);
return CURLE_OK;
}
Loading

0 comments on commit eb1d573

Please sign in to comment.