diff --git a/lib/conncache.c b/lib/conncache.c index a831a94ce1..66f18ecb85 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -389,8 +389,16 @@ bool Curl_conncache_return_conn(struct Curl_easy *data, conn_candidate = Curl_conncache_extract_oldest(data); if(conn_candidate) { - /* the winner gets the honour of being disconnected */ - Curl_disconnect(data, conn_candidate, /* dead_connection */ FALSE); + /* Use the closure handle for this disconnect so that anything that + happens during the disconnect is not stored and associated with the + 'data' handle which already just finished a transfer and it is + important that details from this (unrelated) disconnect does not + taint meta-data in the data handle. */ + struct conncache *connc = data->state.conn_cache; + connc->closure_handle->state.buffer = data->state.buffer; + connc->closure_handle->set.buffer_size = data->set.buffer_size; + Curl_disconnect(connc->closure_handle, conn_candidate, + /* dead_connection */ FALSE); } } diff --git a/tests/data/test1506 b/tests/data/test1506 index 9eb38cf6d1..0a62c0c2a6 100644 --- a/tests/data/test1506 +++ b/tests/data/test1506 @@ -86,7 +86,6 @@ Accept: */* * Connection #0 to host server1.example.com left intact * Connection #1 to host server2.example.com left intact * Connection #2 to host server3.example.com left intact -* Closing connection * Connection #3 to host server4.example.com left intact