Software /
code /
prosody
Comparison
net/http/server.lua @ 4787:1d753fecf95b
net.http.server: Use response.body if it exists and body is not specified to send_response
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 28 Apr 2012 19:36:09 +0100 |
parent | 4771:31a40da59308 |
child | 4788:e14f5a156571 |
comparison
equal
deleted
inserted
replaced
4786:ad6d4ab40b20 | 4787:1d753fecf95b |
---|---|
226 response.finished = true; | 226 response.finished = true; |
227 response.conn._http_open_response = nil; | 227 response.conn._http_open_response = nil; |
228 | 228 |
229 local status_line = "HTTP/"..response.request.httpversion.." "..(response.status or codes[response.status_code]); | 229 local status_line = "HTTP/"..response.request.httpversion.." "..(response.status or codes[response.status_code]); |
230 local headers = response.headers; | 230 local headers = response.headers; |
231 body = body or ""; | 231 body = body or response.body or ""; |
232 headers.content_length = #body; | 232 headers.content_length = #body; |
233 | 233 |
234 local output = { status_line }; | 234 local output = { status_line }; |
235 for k,v in pairs(headers) do | 235 for k,v in pairs(headers) do |
236 t_insert(output, headerfix[k]..v); | 236 t_insert(output, headerfix[k]..v); |