From 8d012181b01aae80b46c90755a55126bc9731f7d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 3 Aug 2008 22:20:58 +0000 Subject: - 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. --- lib/http.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib') 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; -- cgit v1.2.3