Fixed last commit
[project/luci.git] / libs / httpclient / luasrc / httpclient / receiver.lua
index c977d06..c12a673 100644 (file)
@@ -203,7 +203,12 @@ function request_to_file(uri, target, options, cbs)
        end
        
        if cbs.on_header then
-               cbs.on_header(file, code, resp)
+               local stat = {cbs.on_header(file, code, resp)}
+               if stat[1] == false then
+                       file:close()
+                       sock:close()
+                       return unpack(stat)
+               end
        end
 
        local chunked = resp.headers["Transfer-Encoding"] == "chunked"