aboutsummaryrefslogtreecommitdiff
path: root/src/http.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2003-11-27 00:30:54 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2003-11-27 00:30:54 +0000
commit3febb302ad28fd25de51cbc686739469b92d8921 (patch)
tree0a8d9a1070a7c1f2566c22562693fb27963037d9 /src/http.lua
parent9bc4e0648ab4a177293a94425594bdc54c9a84fa (diff)
downloadluasocket-3febb302ad28fd25de51cbc686739469b92d8921.tar.gz
luasocket-3febb302ad28fd25de51cbc686739469b92d8921.tar.bz2
luasocket-3febb302ad28fd25de51cbc686739469b92d8921.zip
Killed a few bugs found by Tomas.
Diffstat (limited to 'src/http.lua')
-rw-r--r--src/http.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/http.lua b/src/http.lua
index 252285a..18a44b6 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -18,7 +18,7 @@ Public.TIMEOUT = 60
18-- default port for document retrieval 18-- default port for document retrieval
19Public.PORT = 80 19Public.PORT = 80
20-- user agent field sent in request 20-- user agent field sent in request
21Public.USERAGENT = "LuaSocket 1.5" 21Public.USERAGENT = "LuaSocket 2.0"
22-- block size used in transfers 22-- block size used in transfers
23Public.BLOCKSIZE = 8192 23Public.BLOCKSIZE = 8192
24 24
@@ -193,7 +193,8 @@ function Private.receivebody_bylength(sock, length, receive_cb)
193 while length > 0 do 193 while length > 0 do
194 local size = math.min(Public.BLOCKSIZE, length) 194 local size = math.min(Public.BLOCKSIZE, length)
195 local chunk, err = sock:receive(size) 195 local chunk, err = sock:receive(size)
196 if err then 196 -- if there was an error before we got all the data
197 if err and string.len(chunk) ~= length then
197 go, uerr = receive_cb(nil, err) 198 go, uerr = receive_cb(nil, err)
198 return uerr or err 199 return uerr or err
199 end 200 end