diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-08-03 22:20:58 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-08-03 22:20:58 +0000 |
commit | 8d012181b01aae80b46c90755a55126bc9731f7d (patch) | |
tree | a2c527bf77818ef1e0f4f65049b3f19eb28a0a95 /lib | |
parent | d6344d9b5f752823da2cb981e974018e452bd4ab (diff) |
- Test case 1041 (added by Daniel Fandrich April 14th) proved a bug where PUT
with -C - sent garbage in the Content-Range: header. I fixed this problem by
making sure libcurl always sets the size of the _entire_ upload if an app
attemps to do resumed uploads since libcurl simply cannot know the size of
what is currently at the server end. Test 1041 is no longer disabled.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/http.c b/lib/http.c index 0da7156e3..195d661d6 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2363,7 +2363,17 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(conn->allocptr.rangeline) free(conn->allocptr.rangeline); - if(data->state.resume_from) { + if(data->set.set_resume_from < 0) { + /* Upload resume was asked for, but we don't know the size of the + remote part so we tell the server (and act accordingly) that we + upload the whole file (again) */ + conn->allocptr.rangeline = + aprintf("Content-Range: bytes 0-%" FORMAT_OFF_T + "/%" FORMAT_OFF_T "\r\n", + data->set.infilesize - 1, data->set.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; |