mirror of
https://github.com/curl/curl.git
synced 2025-09-19 18:42:42 +03:00
parent
2bdec0b363
commit
219d9f8620
|
@ -541,8 +541,7 @@ static int uploadstreamed(void *userdata, hyper_context *ctx,
|
||||||
size_t fillcount;
|
size_t fillcount;
|
||||||
struct Curl_easy *data = (struct Curl_easy *)userdata;
|
struct Curl_easy *data = (struct Curl_easy *)userdata;
|
||||||
CURLcode result =
|
CURLcode result =
|
||||||
Curl_fillreadbuffer(data->conn, data->set.upload_buffer_size,
|
Curl_fillreadbuffer(data, data->set.upload_buffer_size, &fillcount);
|
||||||
&fillcount);
|
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
if(result)
|
if(result)
|
||||||
return HYPER_POLL_ERROR;
|
return HYPER_POLL_ERROR;
|
||||||
|
|
|
@ -301,8 +301,7 @@ static CURLcode file_upload(struct Curl_easy *data)
|
||||||
size_t nread;
|
size_t nread;
|
||||||
size_t nwrite;
|
size_t nwrite;
|
||||||
size_t readcount;
|
size_t readcount;
|
||||||
result = Curl_fillreadbuffer(data->conn, data->set.buffer_size,
|
result = Curl_fillreadbuffer(data, data->set.buffer_size, &readcount);
|
||||||
&readcount);
|
|
||||||
if(result)
|
if(result)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -555,7 +555,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
|
||||||
|
|
||||||
if(bytessent)
|
if(bytessent)
|
||||||
/* we rewind now at once since if we already sent something */
|
/* we rewind now at once since if we already sent something */
|
||||||
return Curl_readrewind(conn);
|
return Curl_readrewind(data);
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1947,7 +1947,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||||
followtype follow = FOLLOW_NONE;
|
followtype follow = FOLLOW_NONE;
|
||||||
CURLcode drc;
|
CURLcode drc;
|
||||||
|
|
||||||
drc = Curl_retry_request(data->conn, &newurl);
|
drc = Curl_retry_request(data, &newurl);
|
||||||
if(drc) {
|
if(drc) {
|
||||||
/* a failure here pretty much implies an out of memory */
|
/* a failure here pretty much implies an out of memory */
|
||||||
result = drc;
|
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
|
* 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.
|
* 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)
|
if(!ret)
|
||||||
retry = (newurl)?TRUE:FALSE;
|
retry = (newurl)?TRUE:FALSE;
|
||||||
else if(!result)
|
else if(!result)
|
||||||
|
@ -2169,7 +2169,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||||
}
|
}
|
||||||
else if((CURLE_HTTP2_STREAM == result) &&
|
else if((CURLE_HTTP2_STREAM == result) &&
|
||||||
Curl_h2_http_1_1_error(data->conn)) {
|
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) {
|
if(!ret) {
|
||||||
infof(data, "Downgrades to HTTP/1.1!\n");
|
infof(data, "Downgrades to HTTP/1.1!\n");
|
||||||
|
|
|
@ -631,7 +631,7 @@ static CURLcode smb_send_and_recv(struct Curl_easy *data, void **msg)
|
||||||
data->set.upload_buffer_size :
|
data->set.upload_buffer_size :
|
||||||
smbc->upload_size;
|
smbc->upload_size;
|
||||||
data->req.upload_fromhere = data->state.ulbuf;
|
data->req.upload_fromhere = data->state.ulbuf;
|
||||||
result = Curl_fillreadbuffer(conn, nread, &nread);
|
result = Curl_fillreadbuffer(data, nread, &nread);
|
||||||
if(result && result != CURLE_AGAIN)
|
if(result && result != CURLE_AGAIN)
|
||||||
return result;
|
return result;
|
||||||
if(!nread)
|
if(!nread)
|
||||||
|
|
|
@ -799,8 +799,7 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
|
||||||
state->sbytes = 0;
|
state->sbytes = 0;
|
||||||
state->data->req.upload_fromhere = (char *)state->spacket.data + 4;
|
state->data->req.upload_fromhere = (char *)state->spacket.data + 4;
|
||||||
do {
|
do {
|
||||||
result = Curl_fillreadbuffer(data->conn, state->blksize - state->sbytes,
|
result = Curl_fillreadbuffer(data, state->blksize - state->sbytes, &cb);
|
||||||
&cb);
|
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
state->sbytes += (int)cb;
|
state->sbytes += (int)cb;
|
||||||
|
|
|
@ -153,10 +153,9 @@ static size_t trailers_left(void *raw)
|
||||||
* This function will call the read callback to fill our buffer with data
|
* This function will call the read callback to fill our buffer with data
|
||||||
* to upload.
|
* to upload.
|
||||||
*/
|
*/
|
||||||
CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
|
CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
|
||||||
size_t *nreadp)
|
size_t *nreadp)
|
||||||
{
|
{
|
||||||
struct Curl_easy *data = conn->data;
|
|
||||||
size_t buffersize = bytes;
|
size_t buffersize = bytes;
|
||||||
size_t nread;
|
size_t nread;
|
||||||
|
|
||||||
|
@ -253,7 +252,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
|
||||||
if(nread == CURL_READFUNC_PAUSE) {
|
if(nread == CURL_READFUNC_PAUSE) {
|
||||||
struct SingleRequest *k = &data->req;
|
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
|
/* protocols that work without network cannot be paused. This is
|
||||||
actually only FILE:// just now, and it can't pause since the transfer
|
actually only FILE:// just now, and it can't pause since the transfer
|
||||||
isn't done using the "normal" procedure. */
|
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
|
* POST/PUT with multi-pass authentication when a sending was denied and a
|
||||||
* resend is necessary.
|
* 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;
|
curl_mimepart *mimepart = &data->set.mimepost;
|
||||||
|
|
||||||
conn->bits.rewindaftersend = FALSE; /* we rewind now */
|
conn->bits.rewindaftersend = FALSE; /* we rewind now */
|
||||||
|
@ -762,8 +761,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
|
||||||
|
|
||||||
dataleft = conn->chunk.dataleft;
|
dataleft = conn->chunk.dataleft;
|
||||||
if(dataleft != 0) {
|
if(dataleft != 0) {
|
||||||
infof(conn->data, "Leftovers after chunking: %zu bytes\n",
|
infof(data, "Leftovers after chunking: %zu bytes\n", dataleft);
|
||||||
dataleft);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If it returned OK, we just keep going */
|
/* If it returned OK, we just keep going */
|
||||||
|
@ -830,7 +828,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
|
||||||
in http_chunks.c.
|
in http_chunks.c.
|
||||||
Make sure that ALL_CONTENT_ENCODINGS contains all the
|
Make sure that ALL_CONTENT_ENCODINGS contains all the
|
||||||
encodings handled here. */
|
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) {
|
if(!k->ignorebody) {
|
||||||
#ifndef CURL_DISABLE_POP3
|
#ifndef CURL_DISABLE_POP3
|
||||||
if(conn->handler->protocol & PROTO_FAMILY_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);
|
Curl_quic_done_sending(data);
|
||||||
|
|
||||||
if(conn->bits.rewindaftersend) {
|
if(conn->bits.rewindaftersend) {
|
||||||
CURLcode result = Curl_readrewind(conn);
|
CURLcode result = Curl_readrewind(data);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1002,7 +1000,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
|
||||||
sending_http_headers = FALSE;
|
sending_http_headers = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = Curl_fillreadbuffer(conn, data->set.upload_buffer_size,
|
result = Curl_fillreadbuffer(data, data->set.upload_buffer_size,
|
||||||
&fillcount);
|
&fillcount);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
@ -1195,7 +1193,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||||
else
|
else
|
||||||
fd_write = CURL_SOCKET_BAD;
|
fd_write = CURL_SOCKET_BAD;
|
||||||
|
|
||||||
if(conn->data->state.drain) {
|
if(data->state.drain) {
|
||||||
select_res |= CURL_CSELECT_IN;
|
select_res |= CURL_CSELECT_IN;
|
||||||
DEBUGF(infof(data, "Curl_readwrite: forcibly told to drain data\n"));
|
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.
|
/* Returns CURLE_OK *and* sets '*url' if a request retry is wanted.
|
||||||
|
|
||||||
NOTE: that the *url is malloc()ed. */
|
NOTE: that the *url is malloc()ed. */
|
||||||
CURLcode Curl_retry_request(struct connectdata *conn,
|
CURLcode Curl_retry_request(struct Curl_easy *data, char **url)
|
||||||
char **url)
|
|
||||||
{
|
{
|
||||||
struct Curl_easy *data = conn->data;
|
struct connectdata *conn = data->conn;
|
||||||
bool retry = FALSE;
|
bool retry = FALSE;
|
||||||
*url = NULL;
|
*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
|
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
|
streams as well, which is why this adds the check the data counters
|
||||||
too. */
|
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 */
|
data->state.refused_stream = FALSE; /* clear again */
|
||||||
retry = TRUE;
|
retry = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1793,9 +1790,9 @@ CURLcode Curl_retry_request(struct connectdata *conn,
|
||||||
data->state.retrycount = 0;
|
data->state.retrycount = 0;
|
||||||
return CURLE_SEND_ERROR;
|
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);
|
(retry count: %d)\n", data->state.retrycount);
|
||||||
*url = strdup(conn->data->change.url);
|
*url = strdup(data->change.url);
|
||||||
if(!*url)
|
if(!*url)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
@ -1809,7 +1806,7 @@ CURLcode Curl_retry_request(struct connectdata *conn,
|
||||||
|
|
||||||
if(conn->handler->protocol&PROTO_FAMILY_HTTP) {
|
if(conn->handler->protocol&PROTO_FAMILY_HTTP) {
|
||||||
if(data->req.writebytecount) {
|
if(data->req.writebytecount) {
|
||||||
CURLcode result = Curl_readrewind(conn);
|
CURLcode result = Curl_readrewind(data);
|
||||||
if(result) {
|
if(result) {
|
||||||
Curl_safefree(*url);
|
Curl_safefree(*url);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -47,10 +47,10 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||||
bool *comeback);
|
bool *comeback);
|
||||||
int Curl_single_getsock(struct Curl_easy *data,
|
int Curl_single_getsock(struct Curl_easy *data,
|
||||||
struct connectdata *conn, curl_socket_t *socks);
|
struct connectdata *conn, curl_socket_t *socks);
|
||||||
CURLcode Curl_readrewind(struct connectdata *conn);
|
CURLcode Curl_readrewind(struct Curl_easy *data);
|
||||||
CURLcode Curl_fillreadbuffer(struct connectdata *conn, size_t bytes,
|
CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
|
||||||
size_t *nreadp);
|
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);
|
bool Curl_meets_timecondition(struct Curl_easy *data, time_t timeofdoc);
|
||||||
CURLcode Curl_get_upload_buffer(struct Curl_easy *data);
|
CURLcode Curl_get_upload_buffer(struct Curl_easy *data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user