- 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.
This commit is contained in:
Daniel Stenberg 2008-08-03 22:20:58 +00:00
parent d6344d9b5f
commit 8d012181b0
5 changed files with 20 additions and 4 deletions

View file

@ -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;