summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-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 c977d064b1..852a10db24 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"