mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2026-01-09 16:02:26 -05:00
libs: Make libmtar assert on version, make download close the connection
This commit is contained in:
parent
1c647c76fe
commit
6c7a8d4c61
@ -110,6 +110,7 @@ function dl.protos.http(host, optPort, path, dest, url) -- string string string
|
|||||||
ns = R.read()
|
ns = R.read()
|
||||||
f:write(ns or "")
|
f:write(ns or "")
|
||||||
until not ns
|
until not ns
|
||||||
|
R.close()
|
||||||
f:close()
|
f:close()
|
||||||
print("Done.")
|
print("Done.")
|
||||||
return true
|
return true
|
||||||
|
|||||||
@ -38,6 +38,7 @@ function mtar.iter(stream) -- table -- function -- Given buffer *stream*, return
|
|||||||
return
|
return
|
||||||
elseif nlen == 65535 then -- versioned header
|
elseif nlen == 65535 then -- versioned header
|
||||||
version = string.byte(stream:read(1))
|
version = string.byte(stream:read(1))
|
||||||
|
assert(versions[version], "Unknown version: " .. version)
|
||||||
nlen = string.unpack(versions[version].nlf, stream:read(string.packsize(versions[version].nlf)))
|
nlen = string.unpack(versions[version].nlf, stream:read(string.packsize(versions[version].nlf)))
|
||||||
end
|
end
|
||||||
local name = cleanPath(stream:read(nlen))
|
local name = cleanPath(stream:read(nlen))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user