Software / code / prosody
Comparison
net/httpserver.lua @ 2835:ff5039708b19
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 | 2066:b3a640892549 |
| child | 2836:dfb5fa77d437 |
comparison
equal
deleted
inserted
replaced
| 2834:f5cd7ee409eb | 2835:ff5039708b19 |
|---|---|
| 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); |