mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
net.http: Set Connection header based on connection pool usage
Connection: keep-alive is implicit in HTTP/1.1 but explicit > implicit
This commit is contained in:
parent
8e2ecac95b
commit
019549e738
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue