Mercurial > prosody-hg
comparison net/http/server.lua @ 6082:d0e824a21861
net.http.server: Fix some typos introduced in 420c0d3b8583.
| author | Daurnimator <quae@daurnimator.com> |
|---|---|
| date | Tue, 15 Apr 2014 14:51:49 -0400 |
| parents | 420c0d3b8583 |
| children | 769a3577dd85 |
comparison
equal
deleted
inserted
replaced
| 6080:b7d1607df87d | 6082:d0e824a21861 |
|---|---|
| 253 local output = { status_line }; | 253 local output = { status_line }; |
| 254 for k,v in pairs(headers) do | 254 for k,v in pairs(headers) do |
| 255 t_insert(output, headerfix[k]..v); | 255 t_insert(output, headerfix[k]..v); |
| 256 end | 256 end |
| 257 t_insert(output, "\r\n\r\n"); | 257 t_insert(output, "\r\n\r\n"); |
| 258 t_insert(output, body); | |
| 259 return output; | 258 return output; |
| 260 end | 259 end |
| 261 _M.prepare_header = prepare_header; | 260 _M.prepare_header = prepare_header; |
| 262 function _M.send_response(response, body) | 261 function _M.send_response(response, body) |
| 263 if response.finished then return; end | 262 if response.finished then return; end |
| 264 body = body or response.body or ""; | 263 body = body or response.body or ""; |
| 265 headers.content_length = #body; | 264 response.headers.content_length = #body; |
| 266 local output = prepare_header(respone); | 265 local output = prepare_header(response); |
| 267 t_insert(output, body); | 266 t_insert(output, body); |
| 268 response.conn:write(t_concat(output)); | 267 response.conn:write(t_concat(output)); |
| 269 response:finish(); | 268 response:done(); |
| 270 end | 269 end |
| 271 function _M.finish_response(response) | 270 function _M.finish_response(response) |
| 272 if response.finished then return; end | 271 if response.finished then return; end |
| 273 response.finished = true; | 272 response.finished = true; |
| 274 response.conn._http_open_response = nil; | 273 response.conn._http_open_response = nil; |
