105 elseif request.state == "status" then |
105 elseif request.state == "status" then |
106 print("Reading status...") |
106 print("Reading status...") |
107 local http, code, text, linelen = data:match("^HTTP/(%S+) (%d+) (.-)\r\n()", startpos); |
107 local http, code, text, linelen = data:match("^HTTP/(%S+) (%d+) (.-)\r\n()", startpos); |
108 code = tonumber(code); |
108 code = tonumber(code); |
109 if not code then |
109 if not code then |
110 return request.callback("invalid-status-line", 0, request); |
110 log("warn", "Invalid HTTP status line, telling callback then closing"); |
|
111 local ret = request.callback("invalid-status-line", 0, request); |
|
112 destroy_request(request); |
|
113 return ret; |
111 end |
114 end |
112 |
115 |
113 request.code, request.responseversion = code, http; |
116 request.code, request.responseversion = code, http; |
114 |
117 |
115 if request.onlystatus then |
118 if request.onlystatus then |