mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-19 05:30:59 -06:00
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2021-09-22 (c7aef0a9)
This commit is contained in:
@@ -30,13 +30,13 @@
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.79.0"
|
||||
#define LIBCURL_VERSION "7.79.1"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 79
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
#define LIBCURL_VERSION_PATCH 1
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparisons 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 0x074f00
|
||||
#define LIBCURL_VERSION_NUM 0x074f01
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#define MAX_HSTS_HOSTLENSTR "256"
|
||||
#define MAX_HSTS_DATELEN 64
|
||||
#define MAX_HSTS_DATELENSTR "64"
|
||||
#define UNLIMITED "unlimited"
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
/* to play well with debug builds, we can *set* a fixed time this will
|
||||
@@ -283,13 +284,17 @@ static CURLcode hsts_push(struct Curl_easy *data,
|
||||
e.namelen = strlen(sts->host);
|
||||
e.includeSubDomains = sts->includeSubDomains;
|
||||
|
||||
result = Curl_gmtime((time_t)sts->expires, &stamp);
|
||||
if(result)
|
||||
return result;
|
||||
if(sts->expires != TIME_T_MAX) {
|
||||
result = Curl_gmtime((time_t)sts->expires, &stamp);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
|
||||
stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
|
||||
stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
|
||||
msnprintf(e.expire, sizeof(e.expire), "%d%02d%02d %02d:%02d:%02d",
|
||||
stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
|
||||
stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
|
||||
}
|
||||
else
|
||||
strcpy(e.expire, UNLIMITED);
|
||||
|
||||
sc = data->set.hsts_write(data, &e, i,
|
||||
data->set.hsts_write_userp);
|
||||
@@ -303,14 +308,18 @@ static CURLcode hsts_push(struct Curl_easy *data,
|
||||
static CURLcode hsts_out(struct stsentry *sts, FILE *fp)
|
||||
{
|
||||
struct tm stamp;
|
||||
CURLcode result = Curl_gmtime((time_t)sts->expires, &stamp);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
fprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
|
||||
sts->includeSubDomains ? ".": "", sts->host,
|
||||
stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
|
||||
stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
|
||||
if(sts->expires != TIME_T_MAX) {
|
||||
CURLcode result = Curl_gmtime((time_t)sts->expires, &stamp);
|
||||
if(result)
|
||||
return result;
|
||||
fprintf(fp, "%s%s \"%d%02d%02d %02d:%02d:%02d\"\n",
|
||||
sts->includeSubDomains ? ".": "", sts->host,
|
||||
stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
|
||||
stamp.tm_hour, stamp.tm_min, stamp.tm_sec);
|
||||
}
|
||||
else
|
||||
fprintf(fp, "%s%s \"%s\"\n",
|
||||
sts->includeSubDomains ? ".": "", sts->host, UNLIMITED);
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -403,7 +412,8 @@ static CURLcode hsts_add(struct hsts *h, char *line)
|
||||
"%" MAX_HSTS_HOSTLENSTR "s \"%" MAX_HSTS_DATELENSTR "[^\"]\"",
|
||||
host, date);
|
||||
if(2 == rc) {
|
||||
time_t expires = Curl_getdate_capped(date);
|
||||
time_t expires = strcmp(date, UNLIMITED) ? Curl_getdate_capped(date) :
|
||||
TIME_T_MAX;
|
||||
CURLcode result;
|
||||
char *p = host;
|
||||
bool subdomain = FALSE;
|
||||
@@ -456,7 +466,7 @@ static CURLcode hsts_pull(struct Curl_easy *data, struct hsts *h)
|
||||
return result;
|
||||
}
|
||||
else if(sc == CURLSTS_FAIL)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
return CURLE_ABORTED_BY_CALLBACK;
|
||||
} while(sc == CURLSTS_OK);
|
||||
}
|
||||
return CURLE_OK;
|
||||
|
||||
@@ -59,7 +59,7 @@ CURLcode Curl_hsts_loadcb(struct Curl_easy *data,
|
||||
struct hsts *h);
|
||||
#else
|
||||
#define Curl_hsts_cleanup(x)
|
||||
#define Curl_hsts_loadcb(x,y)
|
||||
#define Curl_hsts_loadcb(x,y) CURLE_OK
|
||||
#define Curl_hsts_save(x,y,z)
|
||||
#endif /* CURL_DISABLE_HTTP || CURL_DISABLE_HSTS */
|
||||
#endif /* HEADER_CURL_HSTS_H */
|
||||
|
||||
@@ -4232,9 +4232,9 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
||||
char separator;
|
||||
char twoorthree[2];
|
||||
int httpversion = 0;
|
||||
int digit4 = -1; /* should remain untouched to be good */
|
||||
char digit4 = 0;
|
||||
nc = sscanf(HEADER1,
|
||||
" HTTP/%1d.%1d%c%3d%1d",
|
||||
" HTTP/%1d.%1d%c%3d%c",
|
||||
&httpversion_major,
|
||||
&httpversion,
|
||||
&separator,
|
||||
@@ -4250,13 +4250,13 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
||||
|
||||
/* There can only be a 4th response code digit stored in 'digit4' if
|
||||
all the other fields were parsed and stored first, so nc is 5 when
|
||||
digit4 is not -1 */
|
||||
else if(digit4 != -1) {
|
||||
digit4 a digit */
|
||||
else if(ISDIGIT(digit4)) {
|
||||
failf(data, "Unsupported response code in HTTP response");
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
}
|
||||
|
||||
if((nc == 4) && (' ' == separator)) {
|
||||
if((nc >= 4) && (' ' == separator)) {
|
||||
httpversion += 10 * httpversion_major;
|
||||
switch(httpversion) {
|
||||
case 10:
|
||||
|
||||
@@ -2221,12 +2221,6 @@ CURLcode Curl_http2_setup(struct Curl_easy *data,
|
||||
stream->mem = data->state.buffer;
|
||||
stream->len = data->set.buffer_size;
|
||||
|
||||
httpc->inbuflen = 0;
|
||||
httpc->nread_inbuf = 0;
|
||||
|
||||
httpc->pause_stream_id = 0;
|
||||
httpc->drain_total = 0;
|
||||
|
||||
multi_connchanged(data->multi);
|
||||
/* below this point only connection related inits are done, which only needs
|
||||
to be done once per connection */
|
||||
@@ -2252,6 +2246,12 @@ CURLcode Curl_http2_setup(struct Curl_easy *data,
|
||||
conn->httpversion = 20;
|
||||
conn->bundle->multiuse = BUNDLE_MULTIPLEX;
|
||||
|
||||
httpc->inbuflen = 0;
|
||||
httpc->nread_inbuf = 0;
|
||||
|
||||
httpc->pause_stream_id = 0;
|
||||
httpc->drain_total = 0;
|
||||
|
||||
infof(data, "Connection state changed (HTTP/2 confirmed)");
|
||||
|
||||
return CURLE_OK;
|
||||
|
||||
@@ -1052,11 +1052,17 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
|
||||
for(i = 0; i< MAX_SOCKSPEREASYHANDLE; i++) {
|
||||
curl_socket_t s = CURL_SOCKET_BAD;
|
||||
|
||||
if((bitmap & GETSOCK_READSOCK(i)) && VALID_SOCK((sockbunch[i]))) {
|
||||
if((bitmap & GETSOCK_READSOCK(i)) && VALID_SOCK(sockbunch[i])) {
|
||||
if(!FDSET_SOCK(sockbunch[i]))
|
||||
/* pretend it doesn't exist */
|
||||
continue;
|
||||
FD_SET(sockbunch[i], read_fd_set);
|
||||
s = sockbunch[i];
|
||||
}
|
||||
if((bitmap & GETSOCK_WRITESOCK(i)) && VALID_SOCK((sockbunch[i]))) {
|
||||
if((bitmap & GETSOCK_WRITESOCK(i)) && VALID_SOCK(sockbunch[i])) {
|
||||
if(!FDSET_SOCK(sockbunch[i]))
|
||||
/* pretend it doesn't exist */
|
||||
continue;
|
||||
FD_SET(sockbunch[i], write_fd_set);
|
||||
s = sockbunch[i];
|
||||
}
|
||||
|
||||
@@ -97,8 +97,10 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
|
||||
#if defined(TPF)
|
||||
#define VALID_SOCK(x) 1
|
||||
#define VERIFY_SOCK(x) Curl_nop_stmt
|
||||
#define FDSET_SOCK(x) 1
|
||||
#elif defined(USE_WINSOCK)
|
||||
#define VALID_SOCK(s) ((s) < INVALID_SOCKET)
|
||||
#define FDSET_SOCK(x) 1
|
||||
#define VERIFY_SOCK(x) do { \
|
||||
if(!VALID_SOCK(x)) { \
|
||||
SET_SOCKERRNO(WSAEINVAL); \
|
||||
@@ -106,17 +108,17 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#ifdef HAVE_POLL_FINE
|
||||
#define VALID_SOCK(s) ((s) >= 0) /* FD_SETSIZE is irrelevant for poll */
|
||||
#else
|
||||
#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
|
||||
#endif
|
||||
#define VERIFY_SOCK(x) do { \
|
||||
if(!VALID_SOCK(x)) { \
|
||||
SET_SOCKERRNO(EINVAL); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
#define VALID_SOCK(s) ((s) >= 0)
|
||||
|
||||
/* If the socket is small enough to get set or read from an fdset */
|
||||
#define FDSET_SOCK(s) ((s) < FD_SETSIZE)
|
||||
|
||||
#define VERIFY_SOCK(x) do { \
|
||||
if(!VALID_SOCK(x) || !FDSET_SOCK(x)) { \
|
||||
SET_SOCKERRNO(EINVAL); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_SELECT_H */
|
||||
|
||||
@@ -731,12 +731,11 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
|
||||
max = buflen - 1;
|
||||
*buf = '\0';
|
||||
|
||||
/* !checksrc! disable STRERROR 2 */
|
||||
#if defined(WIN32) || defined(_WIN32_WCE)
|
||||
#if defined(WIN32)
|
||||
/* 'sys_nerr' is the maximum errno number, it is not widely portable */
|
||||
if(err >= 0 && err < sys_nerr)
|
||||
strncpy(buf, strerror(err), max);
|
||||
strncpy(buf, sys_errlist[err], max);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -787,6 +786,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* !checksrc! disable STRERROR 1 */
|
||||
const char *msg = strerror(err);
|
||||
if(msg)
|
||||
strncpy(buf, msg, max);
|
||||
|
||||
@@ -1503,7 +1503,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
|
||||
}
|
||||
#endif
|
||||
Curl_http2_init_state(&data->state);
|
||||
Curl_hsts_loadcb(data, data->hsts);
|
||||
result = Curl_hsts_loadcb(data, data->hsts);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user