Seeking with GDataDownloadStream can be broken if a range was set in the HTTP request
@debarshir
Submitted by Debarshi Ray Assigned to lib..@..e.bugs
Link to original bug (#755976)
Description
Created attachment 312555 Testcase that shows the difference between seeking file://, davs:// and google-drive:// URIs
I can spot two issues:
(a) GDataDownloadStream:content-length doesn't take into account the range that we might have set in the request header. If a range was set, it only reports the size of response received from the server, which will be smaller than the size of the actual file. Since GDataDownloadStream:content-length is documented as:
"The length (in bytes) of the file being downloaded. This will initially be -1, and will be populated as soon as the appropriate header is received from the server. Its value will never change after this."
I believe this is a bug in GDataDownloadStream.
(b) Similarly when popping bytes from the GDataBuffer, we don't take into account the range that might have been set when sending the request.
Attachment 312555, "Testcase that shows the difference between seeking file://, davs:// and google-drive:// URIs":
seek.c
Version: 0.17.x