AppImageCommunity / zsync2

Rewrite of https://github.com/AppImage/zsync-curl, using modern C++, providing both a library and standalone tools.
Other
132 stars 25 forks source link

Redundant HTTP requests for the .zsync file #38

Open DeeDeeG opened 5 years ago

DeeDeeG commented 5 years ago

Hi,

As mentioned in #33...

the first 1024 bits of the remote .zsyncfile are requested twice, and then the full .zsync file is potentially requested twice as well.

DeeDeeG commented 5 years ago

Here's a more detailed breakdown of this bug.

For background, I think the program flow is something like this:

At each of those steps where the .zsync file is downloaded, the request is doubled (the bug this issue is about).

And now after #39 has been merged, all four requests are for the full .zsync file.

TheAssassin commented 5 years ago

We should redesign the whole handling of the .zsync file by downloading it once, caching and reusing it from there. The full download should only occur if necessary. We will probably need two variables, one that contains the contents of the file, and one that shows whether it's a partial or complete copy of the .zsync file.