173 end |
173 end |
174 elseif request.state == "request" then |
174 elseif request.state == "request" then |
175 log("debug", "Reading request line...") |
175 log("debug", "Reading request line...") |
176 local method, path, http, linelen = data:match("^(%S+) (%S+) HTTP/(%S+)\r\n()", startpos); |
176 local method, path, http, linelen = data:match("^(%S+) (%S+) HTTP/(%S+)\r\n()", startpos); |
177 if not method then |
177 if not method then |
178 return call_callback(request, "invalid-status-line"); |
178 log("warn", "Invalid HTTP status line, telling callback then closing"); |
|
179 local ret = call_callback(request, "invalid-status-line"); |
|
180 request:destroy(); |
|
181 return ret; |
179 end |
182 end |
180 |
183 |
181 request.method, request.path, request.httpversion = method, path, http; |
184 request.method, request.path, request.httpversion = method, path, http; |
182 |
185 |
183 request.url = url_parse(request.path); |
186 request.url = url_parse(request.path); |