zsync doesn't check metafile during download

Bug #538717 reported by psl
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Baltix
New
Undecided
Unassigned
zsync (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

Binary package hint: zsync

Ubuntu 9.10 i386, zsync 0.6

DESCRIPTION

zsync doesn't check if the downloaded file is zsync metafile. The whole metafile is downloaded and after that it is parsed. In normal situation, metafile is small but unexperienced user can call zsync with wrong file (like DVD/CD image) and in this case it is a problem as zsync dowloads hundred of megabytes to find that all data are useless...

DEMO

try this:
$ zsync http://cdimage.ubuntu.com/daily/current/lucid-alternate-i386.iso

zsync downloaded about 650MB of data to find that unexperienced user called it with wrong URL (URL of ISO file was entered, not URL of ZSYNC file). 650MB of data was downloaded to be useless...

Correct command is this one (small change in URL only...):
$ zsync http://cdimage.ubuntu.com/daily/current/lucid-alternate-i386.iso.zsync

Smart (user friendly) zsync knows that most metadata files are small and that it can check header if the file at command line is really zsync file. From my point of view, zsync should download about 1kB (or 10kB, etc) of the file first, check header and continue with download only in the case that file is OK (is at roght version, etc). zsync file has fixed structure, it should be easy to parse header to check if file is zsync metadata file.

Example of zsync metafile (http://cdimage.ubuntu.com/daily/current/lucid-alternate-i386.iso.zsync), header:

zsync: 0.5
Filename: lucid-alternate-i386.iso
Blocksize: 4096
Length: 673048576
Hash-Lengths: 2,3,5
URL: lucid-alternate-i386.iso
SHA-1: 9fd2e7fa32bdfcf3aebcb5e642db34cc99a825cd

@@@@@@@@@@@@@@@@ BINARY DATA ARE HERE @@@@@@@@@@@@@@@@@

Revision history for this message
psl (slansky) wrote :

You don't need to download a file from HTTP server, zsync file can be stored locally. When the file is stored locally you can easily test this issue but you will not see how long zsync needs to get file from HTTP server before it fails. Demo with local file:

$ ls -l lucid-alternate-i386.iso*
-rw------- 1 psl psl 673048576 2010-03-14 13:33 lucid-alternate-i386.iso
-rw-r--r-- 1 psl psl 1314731 2010-03-14 08:39 lucid-alternate-i386.iso.zsync

$ zsync lucid-alternate-i386.iso
Bad line - not a zsync file? ""

Correct command is this one:
$ # wget http://cdimage.ubuntu.com/daily/current/lucid-alternate-i386.iso.zsync
$ zsync lucid-alternate-i386.iso.zsync

My point is that zsync could verify if it is downloading correct metafile ASAP, to report "Bad line - not a zsync file?" error ASAP, not after downloaded MB or GB of data... Alternatively, it should store downloaded data to the filesystem (zsync "degraded" to to wget).

Exampe, zsync with wrong URL (file is small, about 2MB):

$ zsync http://cdimage.ubuntu.com/daily/current/lucid-alternate-i386.template
#################### 100.0% 469.4 kBps DONE

Bad line - not a zsync file? "JigsawDownload template 1.1 JTE/1.15"

Matt Zimmerman (mdz)
Changed in zsync (Ubuntu):
status: New → Triaged
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.