Software /
code /
prosody
Comparison
net/httpserver.lua @ 1435:7a073b0a8f6a
net.httpserver: Don't upset logger when response is nil
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 28 Jun 2009 14:17:07 +0100 |
parent | 1119:61a011ebe243 |
child | 1522:569d58d21612 |
comparison
equal
deleted
inserted
replaced
1433:e7bd00e70973 | 1435:7a073b0a8f6a |
---|---|
50 if response.body and request.method ~= "HEAD" then | 50 if response.body and request.method ~= "HEAD" then |
51 t_insert(resp, response.body); | 51 t_insert(resp, response.body); |
52 end | 52 end |
53 else | 53 else |
54 -- Response we have is just a string (the body) | 54 -- Response we have is just a string (the body) |
55 log("debug", "Sending response to %s: %s", request.id, response); | 55 log("debug", "Sending response to %s: %s", request.id or "<none>", response or "<none>"); |
56 | 56 |
57 resp = { "HTTP/1.0 200 OK\r\n" }; | 57 resp = { "HTTP/1.0 200 OK\r\n" }; |
58 t_insert(resp, "Connection: close\r\n"); | 58 t_insert(resp, "Connection: close\r\n"); |
59 t_insert(resp, "Content-Length: "); | 59 t_insert(resp, "Content-Length: "); |
60 t_insert(resp, #response); | 60 t_insert(resp, #response); |