Software / code / prosody
Comparison
net/httpserver.lua @ 2480:3596d181cfc3
net.httpserver: Close connection on invalid HTTP status line
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 21 Jan 2010 13:10:13 +0000 |
| parent | 2399:0325f241a26c |
| child | 2481:9b407a6acf39 |
comparison
equal
deleted
inserted
replaced
| 2479:9c074ba1f662 | 2480:3596d181cfc3 |
|---|---|
| 169 end | 169 end |
| 170 elseif request.state == "request" then | 170 elseif request.state == "request" then |
| 171 log("debug", "Reading request line...") | 171 log("debug", "Reading request line...") |
| 172 local method, path, http, linelen = data:match("^(%S+) (%S+) HTTP/(%S+)\r\n()", startpos); | 172 local method, path, http, linelen = data:match("^(%S+) (%S+) HTTP/(%S+)\r\n()", startpos); |
| 173 if not method then | 173 if not method then |
| 174 return call_callback(request, "invalid-status-line"); | 174 log("warn", "Invalid HTTP status line, telling callback then closing"); |
| 175 local ret = call_callback(request, "invalid-status-line"); | |
| 176 request:destroy(); | |
| 177 return ret; | |
| 175 end | 178 end |
| 176 | 179 |
| 177 request.method, request.path, request.httpversion = method, path, http; | 180 request.method, request.path, request.httpversion = method, path, http; |
| 178 | 181 |
| 179 request.url = url_parse(request.path); | 182 request.url = url_parse(request.path); |