diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-01-29 07:24:20 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-01-29 07:24:20 +0000 |
commit | 513bc444218f5ac0c942b07abc7c9b94787858ec (patch) | |
tree | ecef256b7e321684bc206022d399172d74289041 /lib | |
parent | 4cc76d157673c46434a5d3f59b2e61b85ca9e756 (diff) |
HTTP PUT resume now sends Content-Range: headers as I believe the RFC2616
describes, Bob Schader's research seems to agree.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/lib/http.c b/lib/http.c index 7553b613b..41e5e87bf 100644 --- a/lib/http.c +++ b/lib/http.c @@ -429,22 +429,6 @@ CURLcode Curl_http(struct connectdata *conn) } } } - if(data->bits.set_range) { - /* - * A range is selected. We use different headers whether we're downloading - * or uploading and we always let customized headers override our internal - * ones if any such are specified. - */ - if((data->httpreq == HTTPREQ_GET) && - !checkheaders(data, "Range:")) { - data->ptr_rangeline = aprintf("Range: bytes=%s\015\012", data->range); - } - else if((data->httpreq != HTTPREQ_GET) && - !checkheaders(data, "Content-Range:")) { - data->ptr_rangeline = aprintf("Content-Range: bytes=%s\015\012", - data->range); - } - } if((data->bits.http_set_referer) && !checkheaders(data, "Referer:")) { data->ptr_ref = aprintf("Referer: %s\015\012", data->referer); } @@ -541,6 +525,34 @@ CURLcode Curl_http(struct connectdata *conn) /* we've passed, proceed as normal */ } } + if(data->bits.set_range) { + /* + * A range is selected. We use different headers whether we're downloading + * or uploading and we always let customized headers override our internal + * ones if any such are specified. + */ + if((data->httpreq == HTTPREQ_GET) && + !checkheaders(data, "Range:")) { + data->ptr_rangeline = aprintf("Range: bytes=%s\r\n", data->range); + } + else if((data->httpreq != HTTPREQ_GET) && + !checkheaders(data, "Content-Range:")) { + + if(data->resume_from) { + /* This is because "resume" was selected */ + long total_expected_size= data->resume_from + data->infilesize; + data->ptr_rangeline = aprintf("Content-Range: bytes %s%ld/%ld\r\n", + data->range, total_expected_size-1, + total_expected_size); + } + else { + /* Range was selected and then we just pass the incoming range and + append total size */ + data->ptr_rangeline = aprintf("Content-Range: bytes %s/%d\r\n", + data->range, data->infilesize); + } + } + } do { send_buffer *req_buffer; |