summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@cool.haxx.se>2021-09-22 06:10:23 (GMT)
committerBrad King <brad.king@kitware.com>2021-09-24 14:03:55 (GMT)
commitc4f76b28dcabdf9513a244eb1ce7d1431ae4d84d (patch)
treee6c32f13cdc2b226f2a69720b87b7f4b65ec32e8
parent386467c9dc939cd20711c451dd7d60341fd0e802 (diff)
downloadCMake-c4f76b28dcabdf9513a244eb1ce7d1431ae4d84d.zip
CMake-c4f76b28dcabdf9513a244eb1ce7d1431ae4d84d.tar.gz
CMake-c4f76b28dcabdf9513a244eb1ce7d1431ae4d84d.tar.bz2
curl 2021-09-22 (c7aef0a9)
Code extracted from: https://github.com/curl/curl.git at commit c7aef0a945f9b6fb6d3f91716a21dfe2f4ea635f (curl-7_79_1).
-rw-r--r--include/curl/curlver.h6
-rw-r--r--lib/hsts.c42
-rw-r--r--lib/hsts.h2
-rw-r--r--lib/http.c10
-rw-r--r--lib/http2.c12
-rw-r--r--lib/multi.c10
-rw-r--r--lib/select.h24
-rw-r--r--lib/strerror.c4
-rw-r--r--lib/transfer.c2
9 files changed, 65 insertions, 47 deletions
diff --git a/include/curl/curlver.h b/include/curl/curlver.h
index 3e2de3e..393ba12 100644
--- a/include/curl/curlver.h
+++ b/include/curl/curlver.h
@@ -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-DEV"
+#define LIBCURL_VERSION "7.79.1-DEV"
/* 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
diff --git a/lib/hsts.c b/lib/hsts.c
index 853c7df..052dc11 100644
--- a/lib/hsts.c
+++ b/lib/hsts.c
@@ -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;
diff --git a/lib/hsts.h b/lib/hsts.h
index baa5828..653c053 100644
--- a/lib/hsts.h
+++ b/lib/hsts.h
@@ -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 */
diff --git a/lib/http.c b/lib/http.c
index d5c36dd..648583c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -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:
diff --git a/lib/http2.c b/lib/http2.c
index a3de607..6d63f43 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -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;
diff --git a/lib/multi.c b/lib/multi.c
index 8509781..518ceb5 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -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];
}
diff --git a/lib/select.h b/lib/select.h
index 19da1e7..59a571d 100644
--- a/lib/select.h
+++ b/lib/select.h
@@ -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 */
diff --git a/lib/strerror.c b/lib/strerror.c
index 431ff1c..8a27197 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -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);
diff --git a/lib/transfer.c b/lib/transfer.c
index 3e650b5..05fec79 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -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);
}
/*