summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-03-05 23:52:54 +0000
committerSteven Barth <steven@midlink.org>2009-03-05 23:52:54 +0000
commit0b8a61a536a6f78fbe889979510297969d6a5f4e (patch)
tree52ada5a68fbc76ac9beb62fe6233e6c59843c5ad
parentf151bb804f558f5132a5b39feb38116ea2e95b21 (diff)
httpclient: callback can abort download
-rw-r--r--libs/httpclient/luasrc/httpclient/receiver.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/httpclient/luasrc/httpclient/receiver.lua b/libs/httpclient/luasrc/httpclient/receiver.lua
index c977d064b..852a10db2 100644
--- a/libs/httpclient/luasrc/httpclient/receiver.lua
+++ b/libs/httpclient/luasrc/httpclient/receiver.lua
@@ -203,7 +203,11 @@ function request_to_file(uri, target, options, cbs)
end
if cbs.on_header then
- cbs.on_header(file, code, resp)
+ if cbs.on_header(file, code, resp) == false then
+ file:close()
+ sock:close()
+ return true
+ end
end
local chunked = resp.headers["Transfer-Encoding"] == "chunked"