summaryrefslogtreecommitdiff
path: root/src/htsback.c
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2013-04-14 17:52:28 +0000
committerXavier Roche <xroche@users.noreply.github.com>2013-04-14 17:52:28 +0000
commit33d7070c48078979c1b9dbea983cd1a37299c16e (patch)
tree57b3b45fe99d4d443ed03c0ed8b8e4daf8e4d889 /src/htsback.c
parent4ac6c95c49e7cd8e678555383d5390beadd84953 (diff)
Do not force a 206 status (partial content) when we see a "Content-Range" response header, because some servers are weird
Fixes: issue 7
Diffstat (limited to 'src/htsback.c')
-rw-r--r--src/htsback.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/htsback.c b/src/htsback.c
index 87df61e..a19d543 100644
--- a/src/htsback.c
+++ b/src/htsback.c
@@ -459,7 +459,8 @@ int back_finalize(httrackp* opt,cache_back* cache,struct_back* sback,int p) {
/* Don't store broken files. Note: check is done before compression.
If the file is partial, the next run will attempt to continue it with compression too.
*/
- if (back[p].r.totalsize > 0 && back[p].r.size != back[p].r.totalsize && ! opt->tolerant) {
+ if (back[p].r.totalsize > 0 && back[p].r.statuscode > 0
+ && back[p].r.size != back[p].r.totalsize && ! opt->tolerant) {
if (back[p].status == STATUS_READY) {
if (opt->log!=NULL) {
HTS_LOG(opt,LOG_WARNING);
@@ -3218,8 +3219,12 @@ void back_wait(struct_back* sback,httrackp* opt,cache_back* cache,TStamp stat_ti
// parfois les serveurs buggés renvoient un content-range avec un 200
if (back[i].r.statuscode==HTTP_OK) // 'OK'
- if (strfield(rcvd,"content-range:")) // Avec un content-range: relisez les RFC..
- back[i].r.statuscode=206; // FORCER A 206 !!!!!
+ if (strfield(rcvd, "content-range:")) { // Avec un content-range: relisez les RFC..
+ // Fake range (the file is complete)
+ if (!(back[i].r.crange_start == 0 && back[i].r.crange_end == back[i].r.crange - 1)) {
+ back[i].r.statuscode=HTTP_PARTIAL_CONTENT; // FORCER A 206 !!!!!
+ }
+ }
} while(strnotempty(rcvd));
// ----------------------------------------