mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
Merge 0.11->trunk
This commit is contained in:
commit
99cb02cc82
1 changed files with 12 additions and 0 deletions
12
net/http.lua
12
net/http.lua
|
@ -58,6 +58,16 @@ local function destroy_request(request)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function cancel_request(request, reason)
|
||||||
|
if request.callback then
|
||||||
|
request.callback(reason or "cancelled", 0, request);
|
||||||
|
request.callback = nil;
|
||||||
|
end
|
||||||
|
if request.conn then
|
||||||
|
destroy_request(request);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function request_reader(request, data, err)
|
local function request_reader(request, data, err)
|
||||||
if not request.parser then
|
if not request.parser then
|
||||||
local function error_cb(reason)
|
local function error_cb(reason)
|
||||||
|
@ -107,6 +117,7 @@ function listener.onconnect(conn)
|
||||||
end
|
end
|
||||||
req.reader = request_reader;
|
req.reader = request_reader;
|
||||||
req.state = "status";
|
req.state = "status";
|
||||||
|
req.cancel = cancel_request;
|
||||||
|
|
||||||
requests[req.conn] = req;
|
requests[req.conn] = req;
|
||||||
|
|
||||||
|
@ -318,4 +329,5 @@ return {
|
||||||
urldecode = util_http.urldecode;
|
urldecode = util_http.urldecode;
|
||||||
formencode = util_http.formencode;
|
formencode = util_http.formencode;
|
||||||
formdecode = util_http.formdecode;
|
formdecode = util_http.formdecode;
|
||||||
|
destroy_request = destroy_request;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue