Software /
code /
prosody
Comparison
net/http/server.lua @ 5776:bd0ff8ae98a8
Remove all trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 09 Aug 2013 17:48:21 +0200 |
parent | 5754:dee0f05ccf70 |
child | 6071:420c0d3b8583 |
comparison
equal
deleted
inserted
replaced
5775:a6c2b8933507 | 5776:bd0ff8ae98a8 |
---|---|
202 err_code, err = 404, "Unknown host: "..host; | 202 err_code, err = 404, "Unknown host: "..host; |
203 else | 203 else |
204 err_code, err = 400, "Missing or invalid 'Host' header"; | 204 err_code, err = 400, "Missing or invalid 'Host' header"; |
205 end | 205 end |
206 end | 206 end |
207 | 207 |
208 if err then | 208 if err then |
209 response.status_code = err_code; | 209 response.status_code = err_code; |
210 response:send(events.fire_event("http-error", { code = err_code, message = err })); | 210 response:send(events.fire_event("http-error", { code = err_code, message = err })); |
211 return; | 211 return; |
212 end | 212 end |
248 end | 248 end |
249 function _M.send_response(response, body) | 249 function _M.send_response(response, body) |
250 if response.finished then return; end | 250 if response.finished then return; end |
251 response.finished = true; | 251 response.finished = true; |
252 response.conn._http_open_response = nil; | 252 response.conn._http_open_response = nil; |
253 | 253 |
254 local status_line = "HTTP/"..response.request.httpversion.." "..(response.status or codes[response.status_code]); | 254 local status_line = "HTTP/"..response.request.httpversion.." "..(response.status or codes[response.status_code]); |
255 local headers = response.headers; | 255 local headers = response.headers; |
256 body = body or response.body or ""; | 256 body = body or response.body or ""; |
257 headers.content_length = #body; | 257 headers.content_length = #body; |
258 | 258 |