Sat, 02 Jan 2010 06:06:48 +0000
multihttp: Don't attempt to return progress if download hasn't started yet
libs/multihttp.lua | file | annotate | diff | comparison | revisions |
--- a/libs/multihttp.lua Sat Jan 02 06:06:19 2010 +0000 +++ b/libs/multihttp.lua Sat Jan 02 06:06:48 2010 +0000 @@ -64,13 +64,15 @@ function progress(batch) local progress = {}; for url, request in pairs(batch.urls) do - local p = {}; - p.bytes_downloaded = request.havebodylength; - p.bytes_total = request.bodylength; - if p.bytes_total then - p.percent = 100/(p.bytes_total/p.bytes_downloaded); + if request ~= true then + local p = {}; + p.bytes_downloaded = request.havebodylength; + p.bytes_total = request.bodylength; + if p.bytes_total then + p.percent = 100/(p.bytes_total/p.bytes_downloaded); + end + progress[url] = p; end - progress[url] = p; end return progress; end