Merge branch 'gokceneraslan-patch-1'

This commit is contained in:
yago 2014-12-22 20:05:52 +01:00
commit 3c28c7e1ca

View File

@ -33,7 +33,9 @@ end
function download_to_file( url , noremove ) function download_to_file( url , noremove )
print("url to download: "..url) print("url to download: "..url)
req, c, h = http.request(url) local ltn12 = require "ltn12"
local respbody = {}
one, c, h = http.request{url=url, sink=ltn12.sink.table(respbody), redirect=true}
htype = h["content-type"] htype = h["content-type"]
vardump(c) vardump(c)
print("content-type: "..htype) print("content-type: "..htype)
@ -55,7 +57,7 @@ function download_to_file( url , noremove )
end end
end end
file = io.open(file_path, "w+") file = io.open(file_path, "w+")
file:write(req) file:write(table.concat(respbody))
file:close() file:close()
if noremove == nil then if noremove == nil then