summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/easy.c
diff options
context:
space:
mode:
authordartraiden <wowemuh@gmail.com>2021-02-07 18:49:47 +0300
committerdartraiden <wowemuh@gmail.com>2021-02-07 18:49:47 +0300
commit2f0eaffffe7e5d3ac074797f880480494dbcc6f3 (patch)
tree161fa6a6df8387d618530a684de9f61f58640596 /libs/libcurl/src/easy.c
parent061f5621d3f64835c376a7781af86a5e5ee1145c (diff)
libcurl: update to 7.75.0
Diffstat (limited to 'libs/libcurl/src/easy.c')
-rw-r--r--libs/libcurl/src/easy.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/libs/libcurl/src/easy.c b/libs/libcurl/src/easy.c
index dc790b01df..0fb255af49 100644
--- a/libs/libcurl/src/easy.c
+++ b/libs/libcurl/src/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 */
}