On some platforms, like with musl libc, time_t may be 64 bit even on
32bit platforms. Fix segfault by convert time_t to 64 bit and use 64bit
format modifier instead of assume time_t is %ld
This ensures that pieces are physically written to disk before
marking them as finished in the control file.
This should prevent data loss and corruption when resuming downloads
after a system crash.
Signed-off-by: Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
Otherwise, some pieces may be marked as finished in the control file
though they have not yet been written to the storage file.
This should prevent data loss and corruption when resuming downloads
after an app crash.
Signed-off-by: Ali MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
Send "Range: bytes=0-" with the first http request to inform the server
of range support by the client.
As per RFC 7233, server MUST ignore the header (not request!) if it
doesn't support range requests or the specified unit. So, this should
have no side effects.
Fixes GH-1576.
Partial content responses (code 206) with content-range works at higher
level than content-length and transfer-encoding and is totally
compatible with both. In other words, transfer-encoding specifies the
encoding in which the request part is sent while content-range species
the position of this part within the whole "representation".
Also, do range validation test for the response.
This parially reverts 5ccd5b6.
Fixes GH-1576.
See GH-1582
Report the correct bytesProcessed_ taking into account
getDelegate()->getBytesProcessed().
This makes it necessary to use outbuf_ to store residual data not
processed by the downstream filter.
See GH-1582
Report the correct bytesProcessed_ taking into account
getDelagate()->getBytesProcessed()
Also, rewrite to avoid using goto or modifying for-loop variables.