118 lines
4.2 KiB
Diff
118 lines
4.2 KiB
Diff
Index: curl-7.65.3/lib/connect.c
|
|
===================================================================
|
|
--- curl-7.65.3.orig/lib/connect.c 2021-01-07 17:18:20.075781504 +0800
|
|
+++ curl-7.65.3/lib/connect.c 2021-01-07 17:35:29.759365377 +0800
|
|
@@ -1239,15 +1239,15 @@
|
|
}
|
|
|
|
struct connfind {
|
|
- struct connectdata *tofind;
|
|
- bool found;
|
|
+ long id_tofind;
|
|
+ struct connectdata *found;
|
|
};
|
|
|
|
static int conn_is_conn(struct connectdata *conn, void *param)
|
|
{
|
|
struct connfind *f = (struct connfind *)param;
|
|
- if(conn == f->tofind) {
|
|
- f->found = TRUE;
|
|
+ if(conn->connection_id == f->id_tofind) {
|
|
+ f->found = conn;
|
|
return 1;
|
|
}
|
|
return 0;
|
|
@@ -1269,21 +1269,22 @@
|
|
* - that is associated with a multi handle, and whose connection
|
|
* was detached with CURLOPT_CONNECT_ONLY
|
|
*/
|
|
- if(data->state.lastconnect && (data->multi_easy || data->multi)) {
|
|
- struct connectdata *c = data->state.lastconnect;
|
|
+ if((data->state.lastconnect_id != -1) && (data->multi_easy || data->multi)) {
|
|
+ struct connectdata *c;
|
|
struct connfind find;
|
|
- find.tofind = data->state.lastconnect;
|
|
- find.found = FALSE;
|
|
+ find.id_tofind = data->state.lastconnect_id;
|
|
+ find.found = NULL;
|
|
|
|
Curl_conncache_foreach(data, data->multi_easy?
|
|
&data->multi_easy->conn_cache:
|
|
&data->multi->conn_cache, &find, conn_is_conn);
|
|
|
|
if(!find.found) {
|
|
- data->state.lastconnect = NULL;
|
|
+ data->state.lastconnect_id = -1;
|
|
return CURL_SOCKET_BAD;
|
|
}
|
|
|
|
+ c = find.found;
|
|
if(connp) {
|
|
/* only store this if the caller cares for it */
|
|
*connp = c;
|
|
Index: curl-7.65.3/lib/easy.c
|
|
===================================================================
|
|
--- curl-7.65.3.orig/lib/easy.c 2021-01-07 17:18:20.055781504 +0800
|
|
+++ curl-7.65.3/lib/easy.c 2021-01-07 17:35:52.349178075 +0800
|
|
@@ -859,7 +859,7 @@
|
|
/* the connection cache is setup on demand */
|
|
outcurl->state.conn_cache = NULL;
|
|
|
|
- outcurl->state.lastconnect = NULL;
|
|
+ outcurl->state.lastconnect_id = -1;
|
|
|
|
outcurl->progress.flags = data->progress.flags;
|
|
outcurl->progress.callback = data->progress.callback;
|
|
Index: curl-7.65.3/lib/multi.c
|
|
===================================================================
|
|
--- curl-7.65.3.orig/lib/multi.c 2021-01-07 17:18:20.063781504 +0800
|
|
+++ curl-7.65.3/lib/multi.c 2021-01-07 17:36:59.301713317 +0800
|
|
@@ -434,6 +434,7 @@
|
|
data->state.conn_cache = &data->share->conn_cache;
|
|
else
|
|
data->state.conn_cache = &multi->conn_cache;
|
|
+ data->state.lastconnect_id = -1;
|
|
|
|
#ifdef USE_LIBPSL
|
|
/* Do the same for PSL. */
|
|
@@ -639,11 +640,11 @@
|
|
/* the connection is no longer in use by this transfer */
|
|
if(Curl_conncache_return_conn(conn)) {
|
|
/* remember the most recently used connection */
|
|
- data->state.lastconnect = conn;
|
|
+ data->state.lastconnect_id = conn->connection_id;
|
|
infof(data, "%s\n", buffer);
|
|
}
|
|
else
|
|
- data->state.lastconnect = NULL;
|
|
+ data->state.lastconnect_id = -1;
|
|
}
|
|
|
|
Curl_free_request_state(data);
|
|
Index: curl-7.65.3/lib/url.c
|
|
===================================================================
|
|
--- curl-7.65.3.orig/lib/url.c 2021-01-07 17:18:20.091781504 +0800
|
|
+++ curl-7.65.3/lib/url.c 2021-01-07 17:39:32.029219004 +0800
|
|
@@ -609,7 +609,7 @@
|
|
Curl_initinfo(data);
|
|
|
|
/* most recent connection is not yet defined */
|
|
- data->state.lastconnect = NULL;
|
|
+ data->state.lastconnect_id = -1;
|
|
|
|
data->progress.flags |= PGRS_HIDE;
|
|
data->state.current_speed = -1; /* init to negative == impossible */
|
|
Index: curl-7.65.3/lib/urldata.h
|
|
===================================================================
|
|
--- curl-7.65.3.orig/lib/urldata.h 2021-01-07 17:18:20.083781504 +0800
|
|
+++ curl-7.65.3/lib/urldata.h 2021-01-07 17:40:16.830792026 +0800
|
|
@@ -1262,7 +1262,7 @@
|
|
/* buffers to store authentication data in, as parsed from input options */
|
|
struct curltime keeps_speed; /* for the progress meter really */
|
|
|
|
- struct connectdata *lastconnect; /* The last connection, NULL if undefined */
|
|
+ long lastconnect_id; /* The last connection, -1 if undefined */
|
|
|
|
char *headerbuff; /* allocated buffer to store headers in */
|
|
size_t headersize; /* size of the allocation */
|