diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-03-21 07:50:15 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-03-21 07:50:15 +0000 |
commit | 4919a83d2271a9e43b83c7d488e3f94c850681e3 (patch) | |
tree | a2ae9a27ead4cb85cbbd857ef74bc39c01b9bf64 /src/ltn12.lua | |
parent | 2a14ac4fe4bb4dd6d7a7ec5195c15a4e3f783ad5 (diff) | |
download | luasocket-4919a83d2271a9e43b83c7d488e3f94c850681e3.tar.gz luasocket-4919a83d2271a9e43b83c7d488e3f94c850681e3.tar.bz2 luasocket-4919a83d2271a9e43b83c7d488e3f94c850681e3.zip |
Changed receive function. Now uniform with all other functions. Returns nil
on error, return partial result in the end.
http.lua rewritten.
Diffstat (limited to 'src/ltn12.lua')
-rw-r--r-- | src/ltn12.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/ltn12.lua b/src/ltn12.lua index ef6247d..dc49d80 100644 --- a/src/ltn12.lua +++ b/src/ltn12.lua | |||
@@ -171,9 +171,8 @@ function sink.file(handle, io_err) | |||
171 | return function(chunk, err) | 171 | return function(chunk, err) |
172 | if not chunk then | 172 | if not chunk then |
173 | handle:close() | 173 | handle:close() |
174 | return nil, err | 174 | return 1 |
175 | end | 175 | else return handle:write(chunk) end |
176 | return handle:write(chunk) | ||
177 | end | 176 | end |
178 | else return sink.error(io_err or "unable to open file") end | 177 | else return sink.error(io_err or "unable to open file") end |
179 | end | 178 | end |