diff options
author | Brad King <brad.king@kitware.com> | 2021-02-03 16:55:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-03 16:55:06 (GMT) |
commit | 426ef61cc8d850ad6877d0598a9917ce9a4f2b20 (patch) | |
tree | 139e0e0af11012c1cd5e9c89d90305bf6d68e916 /Utilities/cmcurl/lib/easy.c | |
parent | 0341888c006c19d0057017231ed43279d53e6034 (diff) | |
parent | 076b3219f58ca16afa52fe095019a05537ade0f3 (diff) | |
download | CMake-426ef61cc8d850ad6877d0598a9917ce9a4f2b20.zip CMake-426ef61cc8d850ad6877d0598a9917ce9a4f2b20.tar.gz CMake-426ef61cc8d850ad6877d0598a9917ce9a4f2b20.tar.bz2 |
Merge branch 'upstream-curl' into update-curl
* upstream-curl:
curl 2021-02-03 (2f33be81)
Diffstat (limited to 'Utilities/cmcurl/lib/easy.c')
-rw-r--r-- | Utilities/cmcurl/lib/easy.c | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/Utilities/cmcurl/lib/easy.c b/Utilities/cmcurl/lib/easy.c index dc790b0..0fb255a 100644 --- a/Utilities/cmcurl/lib/easy.c +++ b/Utilities/cmcurl/lib/easy.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, 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 @@ -124,6 +124,10 @@ curl_wcsdup_callback Curl_cwcsdup = (curl_wcsdup_callback)_wcsdup; # pragma warning(default:4232) /* MSVC extension, dllimport identity */ #endif +#ifdef DEBUGBUILD +static char *leakpointer; +#endif + /** * curl_global_init() globally initializes curl given a bitwise set of the * different features of what to initialize. @@ -190,6 +194,12 @@ static CURLcode global_init(long flags, bool memoryfuncs) init_flags = flags; +#ifdef DEBUGBUILD + if(getenv("CURL_GLOBAL_INIT")) + /* alloc data that will leak if *cleanup() is not called! */ + leakpointer = malloc(1); +#endif + return CURLE_OK; fail: @@ -265,6 +275,9 @@ void curl_global_cleanup(void) #ifdef USE_WOLFSSH (void)wolfSSH_Cleanup(); #endif +#ifdef DEBUGBUILD + free(leakpointer); +#endif init_flags = 0; } @@ -895,8 +908,8 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data) #endif /* Clone the resolver handle, if present, for the new handle */ if(Curl_resolver_duphandle(outcurl, - &outcurl->state.resolver, - data->state.resolver)) + &outcurl->state.async.resolver, + data->state.async.resolver)) goto fail; #ifdef USE_ARES @@ -1059,7 +1072,7 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) /* even if one function returns error, this loops through and frees all buffers */ if(!result) - result = Curl_client_write(conn, writebuf[i].type, + result = Curl_client_write(data, writebuf[i].type, Curl_dyn_ptr(&writebuf[i].b), Curl_dyn_len(&writebuf[i].b)); Curl_dyn_free(&writebuf[i].b); @@ -1080,6 +1093,9 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) { Curl_expire(data, 0, EXPIRE_RUN_NOW); /* get this handle going again */ + /* reset the too-slow time keeper */ + data->state.keeps_speed.tv_sec = 0; + if(!data->state.tempcount) /* if not pausing again, force a recv/send check of this connection as the data might've been read off the socket already */ @@ -1140,8 +1156,13 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen, if(result) return result; + if(!data->conn) + /* on first invoke, the transfer has been detached from the connection and + needs to be reattached */ + Curl_attach_connnection(data, c); + *n = 0; - result = Curl_read(c, sfd, buffer, buflen, &n1); + result = Curl_read(data, sfd, buffer, buflen, &n1); if(result) return result; @@ -1170,8 +1191,13 @@ CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, if(result) return result; + if(!data->conn) + /* on first invoke, the transfer has been detached from the connection and + needs to be reattached */ + Curl_attach_connnection(data, c); + *n = 0; - result = Curl_write(c, sfd, buffer, buflen, &n1); + result = Curl_write(data, sfd, buffer, buflen, &n1); if(n1 == -1) return CURLE_SEND_ERROR; @@ -1190,16 +1216,16 @@ CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, * * Returns always 0. */ -static int conn_upkeep(struct connectdata *conn, +static int conn_upkeep(struct Curl_easy *data, + struct connectdata *conn, void *param) { /* Param is unused. */ (void)param; - if(conn->handler->connection_check) { + if(conn->handler->connection_check) /* Do a protocol-specific keepalive check on the connection. */ - conn->handler->connection_check(conn, CONNCHECK_KEEPALIVE); - } + conn->handler->connection_check(data, conn, CONNCHECK_KEEPALIVE); return 0; /* continue iteration */ } |