http fails on 416 when resuming #10521
I did this
On git master,
I expected the following
curl exits with code 0 (no error, even with
However, when the requested range was unsatisfied (e.g.,
The text was updated successfully, but these errors were encountered:
It appears nginx returns:
This seems to fix this issue, but I am not entirely sure if this is the best way to fix it:
Comments are welcome.
416 Requested Range Not Satisfiable returned by some HTTP daemons (nginx at least) appear to include Content-Range header. This confuses curl and makes it think that the whole file needs to be downloaded again, resulting in download failure when in fact the while file has already been downloaded. This change makes curl disregard Content-Range header on a 416 response, allowing other existing logic consider the file fully downloaded. Fixes curl#10521
I run into this problem as well. I tried running
The server replies with
and curl fails (exit code 22).
As I am not familiar with the curl codebase, I have problems reviewing the change in #10644 and do not yet understand what is the problem with it.
Finding a 'Content-Range:' in the response changed the handling. Add test case 1475 to verify -C - with 416 and Content-Range: header, which is almost exactly like test 194 which instead uses a fixed -C offset. Adjusted test 194 to also be considered fine. Fixes curl#10521 Reported-by: Smackd0wn Fixes curl#12174 Reported-by: Anubhav Rai Closes curl#12176