summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-01-19 10:24:35 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-01-19 17:07:02 +0100
commit219d9f8620d41134825db693500131db0305a325 (patch)
treeadc4fbbb3d96f2257e16dd0d8db1cf3aaab2ffdc
parent2bdec0b3636e1130316abeb7d7b4653329abc318 (diff)
downloadcurl-219d9f8620d41134825db693500131db0305a325.tar.gz
transfer: remove conn->data use
Closes #6486
-rw-r--r--lib/c-hyper.c3
-rw-r--r--lib/file.c3
-rw-r--r--lib/http.c2
-rw-r--r--lib/multi.c6
-rw-r--r--lib/smb.c2
-rw-r--r--lib/tftp.c3
-rw-r--r--lib/transfer.c33
-rw-r--r--lib/transfer.h6
8 files changed, 26 insertions, 32 deletions
diff --git a/lib/c-hyper.c b/lib/c-hyper.c
index 14b20be5d..7c735da71 100644
--- a/lib/c-hyper.c
+++ b/lib/c-hyper.c
@@ -541,8 +541,7 @@ static int uploadstreamed(void *userdata, hyper_context *ctx,
size_t fillcount;
struct Curl_easy *data = (struct Curl_easy *)userdata;
CURLcode result =
- Curl_fillreadbuffer(data->conn, data->set.upload_buffer_size,
- &fillcount);
+ Curl_fillreadbuffer(data, data->set.upload_buffer_size, &fillcount);
(void)ctx;
if(result)
return HYPER_POLL_ERROR;
diff --git a/lib/file.c b/lib/file.c
index 509e4836f..a90dc4b8e 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -301,8 +301,7 @@ static CURLcode file_upload(struct Curl_easy *data)
size_t nread;
size_t nwrite;
size_t readcount;
- result = Curl_fillreadbuffer(data->conn, data->set.buffer_size,
- &readcount);
+ result = Curl_fillreadbuffer(data, data->set.buffer_size, &readcount);
if(result)
break;
diff --git a/lib/http.c b/lib/http.c
index 520ac1070..83484d3af 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -555,7 +555,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
if(bytessent)
/* we rewind now at once since if we already sent something */
- return Curl_readrewind(conn);
+ return Curl_readrewind(data);
return CURLE_OK;
}
diff --git a/lib/multi.c b/lib/multi.c
index 5d4d45073..57c2ae8c0 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1947,7 +1947,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
followtype follow = FOLLOW_NONE;
CURLcode drc;
- drc = Curl_retry_request(data->conn, &newurl);
+ drc = Curl_retry_request(data, &newurl);
if(drc) {
/* a failure here pretty much implies an out of memory */
result = drc;
@@ -2154,7 +2154,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
* condition and the server closed the re-used connection exactly when
* we wanted to use it, so figure out if that is indeed the case.
*/
- CURLcode ret = Curl_retry_request(data->conn, &newurl);
+ CURLcode ret = Curl_retry_request(data, &newurl);
if(!ret)
retry = (newurl)?TRUE:FALSE;
else if(!result)
@@ -2169,7 +2169,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
}
else if((CURLE_HTTP2_STREAM == result) &&
Curl_h2_http_1_1_error(data->conn)) {
- CURLcode ret = Curl_retry_request(data->conn, &newurl);
+ CURLcode ret = Curl_retry_request(data, &newurl);
if(!ret) {
infof(data, "Downgrades to HTTP/1.1!\n");
diff --git a/lib/smb.c b/lib/smb.c
index 6af9b3ac2..dd4e4fdbf 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -631,7 +631,7 @@ static CURLcode smb_send_and_recv(struct Curl_easy *data, void **msg)
data->set.upload_buffer_size :
smbc->upload_size;
data->req.upload_fromhere = data->state.ulbuf;
- result = Curl_fillreadbuffer(conn, nread, &nread);
+ result = Curl_fillreadbuffer(data, nread, &nread);
if(result && result != CURLE_AGAIN)
return result;
if(!nread)
diff --git a/lib/tftp.c b/lib/tftp.c
index 0eee4ef88..b4bf129dd 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -799,8 +799,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
state->sbytes = 0;
state->data->req.upload_fromhere = (char *)state->spacket.data + 4;
do {
- result = Curl_fillreadbuffer(data->conn, state->blksize - state->sbytes,
- &cb);
+ result = Curl_fillreadbuffer(data, state->blksize - state->sbytes, &cb);
if(result)
return result;
state->sbytes += (int)cb;
diff --git a/lib/transfer.c b/lib/transfer.c
index ce5acfbc9..a8aa02c02 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -153,10 +153,9 @@ static size_t trailers_left(void *raw)
* This function will call the read callback to fill our buffer with data
* to upload.
*/
-CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
+CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
size_t *nreadp)
{
- struct Curl_easy *data = conn->data;
size_t buffersize = bytes;
size_t nread;
@@ -253,7 +252,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
if(nread == CURL_READFUNC_PAUSE) {
struct SingleRequest *k = &data->req;
- if(conn->handler->flags & PROTOPT_NONETWORK) {
+ if(data->conn->handler->flags & PROTOPT_NONETWORK) {
/* protocols that work without network cannot be paused. This is
actually only FILE:// just now, and it can't pause since the transfer
isn't done using the "normal" procedure. */
@@ -409,9 +408,9 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
* POST/PUT with multi-pass authentication when a sending was denied and a
* resend is necessary.
*/
-CURLcode Curl_readrewind(struct connectdata *conn)
+CURLcode Curl_readrewind(struct Curl_easy *data)
{
- struct Curl_easy *data = conn->data;
+ struct connectdata *conn = data->conn;
curl_mimepart *mimepart = &data->set.mimepost;
conn->bits.rewindaftersend = FALSE; /* we rewind now */
@@ -762,8 +761,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
dataleft = conn->chunk.dataleft;
if(dataleft != 0) {
- infof(conn->data, "Leftovers after chunking: %zu bytes\n",
- dataleft);
+ infof(data, "Leftovers after chunking: %zu bytes\n", dataleft);
}
}
/* If it returned OK, we just keep going */
@@ -830,7 +828,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
in http_chunks.c.
Make sure that ALL_CONTENT_ENCODINGS contains all the
encodings handled here. */
- if(conn->data->set.http_ce_skip || !k->writer_stack) {
+ if(data->set.http_ce_skip || !k->writer_stack) {
if(!k->ignorebody) {
#ifndef CURL_DISABLE_POP3
if(conn->handler->protocol & PROTO_FAMILY_POP3)
@@ -914,7 +912,7 @@ CURLcode Curl_done_sending(struct Curl_easy *data,
Curl_quic_done_sending(data);
if(conn->bits.rewindaftersend) {
- CURLcode result = Curl_readrewind(conn);
+ CURLcode result = Curl_readrewind(data);
if(result)
return result;
}
@@ -1002,7 +1000,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
sending_http_headers = FALSE;
}
- result = Curl_fillreadbuffer(conn, data->set.upload_buffer_size,
+ result = Curl_fillreadbuffer(data, data->set.upload_buffer_size,
&fillcount);
if(result)
return result;
@@ -1195,7 +1193,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
else
fd_write = CURL_SOCKET_BAD;
- if(conn->data->state.drain) {
+ if(data->state.drain) {
select_res |= CURL_CSELECT_IN;
DEBUGF(infof(data, "Curl_readwrite: forcibly told to drain data\n"));
}
@@ -1748,10 +1746,9 @@ CURLcode Curl_follow(struct Curl_easy *data,
/* Returns CURLE_OK *and* sets '*url' if a request retry is wanted.
NOTE: that the *url is malloc()ed. */
-CURLcode Curl_retry_request(struct connectdata *conn,
- char **url)
+CURLcode Curl_retry_request(struct Curl_easy *data, char **url)
{
- struct Curl_easy *data = conn->data;
+ struct connectdata *conn = data->conn;
bool retry = FALSE;
*url = NULL;
@@ -1781,7 +1778,7 @@ CURLcode Curl_retry_request(struct connectdata *conn,
to issue again, but the nghttp2 API can deliver the message to other
streams as well, which is why this adds the check the data counters
too. */
- infof(conn->data, "REFUSED_STREAM, retrying a fresh connect\n");
+ infof(data, "REFUSED_STREAM, retrying a fresh connect\n");
data->state.refused_stream = FALSE; /* clear again */
retry = TRUE;
}
@@ -1793,9 +1790,9 @@ CURLcode Curl_retry_request(struct connectdata *conn,
data->state.retrycount = 0;
return CURLE_SEND_ERROR;
}
- infof(conn->data, "Connection died, retrying a fresh connect\
+ infof(data, "Connection died, retrying a fresh connect\
(retry count: %d)\n", data->state.retrycount);
- *url = strdup(conn->data->change.url);
+ *url = strdup(data->change.url);
if(!*url)
return CURLE_OUT_OF_MEMORY;
@@ -1809,7 +1806,7 @@ CURLcode Curl_retry_request(struct connectdata *conn,
if(conn->handler->protocol&PROTO_FAMILY_HTTP) {
if(data->req.writebytecount) {
- CURLcode result = Curl_readrewind(conn);
+ CURLcode result = Curl_readrewind(data);
if(result) {
Curl_safefree(*url);
return result;
diff --git a/lib/transfer.h b/lib/transfer.h
index fbcdcb9d0..0fa3d55e8 100644
--- a/lib/transfer.h
+++ b/lib/transfer.h
@@ -47,10 +47,10 @@ CURLcode Curl_readwrite(struct connectdata *conn,
bool *comeback);
int Curl_single_getsock(struct Curl_easy *data,
struct connectdata *conn, curl_socket_t *socks);
-CURLcode Curl_readrewind(struct connectdata *conn);
-CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
+CURLcode Curl_readrewind(struct Curl_easy *data);
+CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
size_t *nreadp);
-CURLcode Curl_retry_request(struct connectdata *conn, char **url);
+CURLcode Curl_retry_request(struct Curl_easy *data, char **url);
bool Curl_meets_timecondition(struct Curl_easy *data, time_t timeofdoc);
CURLcode Curl_get_upload_buffer(struct Curl_easy *data);