diff --git a/lib/FastDownload.js b/lib/FastDownload.js index 0971709..d8fe9d3 100755 --- a/lib/FastDownload.js +++ b/lib/FastDownload.js @@ -108,17 +108,17 @@ FastDownload.prototype._init_http = function (cb) { self._options.chunkSize = Math.ceil(self.size / self._options.chunksAtOnce) } var acceptRanges = self.headers['accept-ranges'] === 'bytes' - if ( - !acceptRanges && - (self._options.start !== 0 || self._options.end !== self.file_size) - ) { - cb(new Error('the server will not accept range requests')) - return - } - if (acceptRanges) { - self._init_fast_http(cb) - } else { + if (!acceptRanges) { + if (self._options.end.toString() != self.file_size.toString()) { + cb (new Error('the server will not accept range requests, so cannot change "end" of file')) + } + + if (self._options.start !== 0) { + self._options.start = 0 + } self._init_normal_http(cb) + } else { + self._init_fast_http(cb) } } FastDownload.prototype._init_normal_http = function (cb) {