mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
urldata: store POST size in state.infilesize too
... to simplify checking when PUT _or_ POST have completed. Reported-by: Frank Meier Bug: http://curl.haxx.se/mail/lib-2015-06/0019.html
This commit is contained in:
parent
55fc47a401
commit
ff7097f72c
10
lib/http.c
10
lib/http.c
@ -424,8 +424,8 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
|
|||||||
/* figure out how much data we are expected to send */
|
/* figure out how much data we are expected to send */
|
||||||
switch(data->set.httpreq) {
|
switch(data->set.httpreq) {
|
||||||
case HTTPREQ_POST:
|
case HTTPREQ_POST:
|
||||||
if(data->set.postfieldsize != -1)
|
if(data->state.infilesize != -1)
|
||||||
expectsend = data->set.postfieldsize;
|
expectsend = data->state.infilesize;
|
||||||
else if(data->set.postfields)
|
else if(data->set.postfields)
|
||||||
expectsend = (curl_off_t)strlen(data->set.postfields);
|
expectsend = (curl_off_t)strlen(data->set.postfields);
|
||||||
break;
|
break;
|
||||||
@ -2572,8 +2572,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
postsize = 0;
|
postsize = 0;
|
||||||
else {
|
else {
|
||||||
/* figure out the size of the postfields */
|
/* figure out the size of the postfields */
|
||||||
postsize = (data->set.postfieldsize != -1)?
|
postsize = (data->state.infilesize != -1)?
|
||||||
data->set.postfieldsize:
|
data->state.infilesize:
|
||||||
(data->set.postfields? (curl_off_t)strlen(data->set.postfields):-1);
|
(data->set.postfields? (curl_off_t)strlen(data->set.postfields):-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2696,7 +2696,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(data->set.postfieldsize) {
|
else if(data->state.infilesize) {
|
||||||
/* set the upload size to the progress meter */
|
/* set the upload size to the progress meter */
|
||||||
Curl_pgrsSetUploadSize(data, postsize?postsize:-1);
|
Curl_pgrsSetUploadSize(data, postsize?postsize:-1);
|
||||||
|
|
||||||
|
@ -402,7 +402,10 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
|||||||
/* Point to the multi's connection cache */
|
/* Point to the multi's connection cache */
|
||||||
data->state.conn_cache = &multi->conn_cache;
|
data->state.conn_cache = &multi->conn_cache;
|
||||||
|
|
||||||
data->state.infilesize = data->set.filesize;
|
if(data->set.httpreq == HTTPREQ_PUT)
|
||||||
|
data->state.infilesize = data->set.filesize;
|
||||||
|
else
|
||||||
|
data->state.infilesize = data->set.postfieldsize;
|
||||||
|
|
||||||
/* This adds the new entry at the 'end' of the doubly-linked circular
|
/* This adds the new entry at the 'end' of the doubly-linked circular
|
||||||
list of SessionHandle structs to try and maintain a FIFO queue so
|
list of SessionHandle structs to try and maintain a FIFO queue so
|
||||||
|
@ -495,8 +495,8 @@ static CURLcode rtsp_do(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
postsize = (data->set.postfieldsize != -1)?
|
postsize = (data->state.infilesize != -1)?
|
||||||
data->set.postfieldsize:
|
data->state.infilesize:
|
||||||
(data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);
|
(data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);
|
||||||
data->set.httpreq = HTTPREQ_POST;
|
data->set.httpreq = HTTPREQ_POST;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user