aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-04-15 13:49:18 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-04-26 18:17:10 +0200
commitd5ec44ca4cca9bbe6c21a1d2a94b37cba77661ff (patch)
tree7d4f6429f80bacd0a314726572bdddbc265f7c72 /lib/http.c
parent9c941e92c4bd3d2a5dbe243f7517b6a6029afc6e (diff)
INFILESIZE: fields in UserDefined must not be changed run-time
set.infilesize in this case was modified in several places, which could lead to repeated requests using the same handle to get unintendent/wrong consequences based on what the previous request did!
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/http.c b/lib/http.c
index abcdd6ab8..fb4334966 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -405,8 +405,8 @@ static CURLcode http_perhapsrewind(struct connectdata *conn)
expectsend = (curl_off_t)strlen(data->set.postfields);
break;
case HTTPREQ_PUT:
- if(data->set.infilesize != -1)
- expectsend = data->set.infilesize;
+ if(data->state.infilesize != -1)
+ expectsend = data->state.infilesize;
break;
case HTTPREQ_POST_FORM:
expectsend = http->postsize;
@@ -1885,7 +1885,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
else {
if((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
data->set.upload &&
- (data->set.infilesize == -1)) {
+ (data->state.infilesize == -1)) {
if(conn->bits.authneg)
/* don't enable chunked during auth neg */
;
@@ -2123,10 +2123,10 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
/* now, decrease the size of the read */
- if(data->set.infilesize>0) {
- data->set.infilesize -= data->state.resume_from;
+ if(data->state.infilesize>0) {
+ data->state.infilesize -= data->state.resume_from;
- if(data->set.infilesize <= 0) {
+ if(data->state.infilesize <= 0) {
failf(data, "File already completely uploaded");
return CURLE_PARTIAL_FILE;
}
@@ -2162,13 +2162,13 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
conn->allocptr.rangeline =
aprintf("Content-Range: bytes 0-%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
- data->set.infilesize - 1, data->set.infilesize);
+ data->state.infilesize - 1, data->state.infilesize);
}
else if(data->state.resume_from) {
/* This is because "resume" was selected */
curl_off_t total_expected_size=
- data->state.resume_from + data->set.infilesize;
+ data->state.resume_from + data->state.infilesize;
conn->allocptr.rangeline =
aprintf("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
@@ -2180,7 +2180,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
append total size */
conn->allocptr.rangeline =
aprintf("Content-Range: bytes %s/%" CURL_FORMAT_CURL_OFF_T "\r\n",
- data->state.range, data->set.infilesize);
+ data->state.range, data->state.infilesize);
}
if(!conn->allocptr.rangeline)
return CURLE_OUT_OF_MEMORY;
@@ -2455,7 +2455,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(conn->bits.authneg)
postsize = 0;
else
- postsize = data->set.infilesize;
+ postsize = data->state.infilesize;
if((postsize != -1) && !data->req.upload_chunky &&
!Curl_checkheaders(conn, "Content-Length:")) {