aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/http.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/http.lua b/net/http.lua
index 2685b491..bea1e905 100644
--- a/net/http.lua
+++ b/net/http.lua
@@ -115,7 +115,8 @@ local function request_reader(request, data, err)
request.callback(r.body, r.code, r, request);
request.callback = nil;
end
- destroy_request(request);
+ local persistent = (","..(r.headers.connection or "keep-alive")..","):find(",keep-alive,")
+ destroy_request(request, persistent);
end
local function options_cb()
return request;
@@ -269,6 +270,12 @@ local function request(self, u, ex, callback)
["User-Agent"] = "Prosody XMPP Server";
};
+ if self.pool then
+ headers["Connection"] = "keep-alive";
+ else
+ headers["Connection"] = "close";
+ end
+
if req.userinfo then
headers["Authorization"] = "Basic "..b64(req.userinfo);
end