aboutsummaryrefslogtreecommitdiff
path: root/src/http.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/http.lua')
-rw-r--r--src/http.lua11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/http.lua b/src/http.lua
index 6a3416e..e3a1742 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -41,9 +41,6 @@ local SCHEMES = {
41 https.tcp, 'LuaSocket: Function tcp() not available from LuaSec') 41 https.tcp, 'LuaSocket: Function tcp() not available from LuaSec')
42 return tcp(t) end }} 42 return tcp(t) end }}
43 43
44-- default scheme and port for document retrieval
45local SCHEME = 'http'
46local PORT = SCHEMES[SCHEME].port
47----------------------------------------------------------------------------- 44-----------------------------------------------------------------------------
48-- Reads MIME headers from a connection, unfolding where needed 45-- Reads MIME headers from a connection, unfolding where needed
49----------------------------------------------------------------------------- 46-----------------------------------------------------------------------------
@@ -92,7 +89,7 @@ socket.sourcet["http-chunked"] = function(sock, headers)
92 -- was it the last chunk? 89 -- was it the last chunk?
93 if size > 0 then 90 if size > 0 then
94 -- if not, get chunk and skip terminating CRLF 91 -- if not, get chunk and skip terminating CRLF
95 local chunk, err, part = sock:receive(size) 92 local chunk, err, _ = sock:receive(size)
96 if chunk then sock:receive() end 93 if chunk then sock:receive() end
97 return chunk, err 94 return chunk, err
98 else 95 else
@@ -166,8 +163,8 @@ function metat.__index:receivestatusline()
166 if status ~= "HTTP/" then 163 if status ~= "HTTP/" then
167 if ec == "timeout" then 164 if ec == "timeout" then
168 return 408 165 return 408
169 end 166 end
170 return nil, status 167 return nil, status
171 end 168 end
172 -- otherwise proceed reading a status line 169 -- otherwise proceed reading a status line
173 status = self.try(self.c:receive("*l", status)) 170 status = self.try(self.c:receive("*l", status))
@@ -366,7 +363,7 @@ end
366 local headers 363 local headers
367 -- ignore any 100-continue messages 364 -- ignore any 100-continue messages
368 while code == 100 do 365 while code == 100 do
369 headers = h:receiveheaders() 366 h:receiveheaders()
370 code, status = h:receivestatusline() 367 code, status = h:receivestatusline()
371 end 368 end
372 headers = h:receiveheaders() 369 headers = h:receiveheaders()