projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util.prosodyctl: Saner determination of Prosody executable path
[prosody.git]
/
net
/
http.lua
diff --git
a/net/http.lua
b/net/http.lua
index 10d966310377d7e54912ab9b81378b99e3bf5ec4..9b1954da5dc113b87e8c45ee2fe7a377d7f90b28 100644
(file)
--- a/
net/http.lua
+++ b/
net/http.lua
@@
-1,3
+1,11
@@
+-- Prosody IM
+-- Copyright (C) 2008-2009 Matthew Wild
+-- Copyright (C) 2008-2009 Waqas Hussain
+--
+-- This project is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
+--
+
local socket = require "socket"
local mime = require "mime"
local socket = require "socket"
local mime = require "mime"
@@
-22,7
+30,7
@@
function urldecode(s) return s and (s:gsub("%%(%x%x)", function (c) return char(
local function expectbody(reqt, code)
if reqt.method == "HEAD" then return nil end
local function expectbody(reqt, code)
if reqt.method == "HEAD" then return nil end
- if code == 204 or code == 304 then return nil end
+ if code == 204 or code == 304
or code == 301
then return nil end
if code >= 100 and code < 200 then return nil end
return 1
end
if code >= 100 and code < 200 then return nil end
return 1
end
@@
-144,7
+152,7
@@
function request(u, ex, callback)
end
req.handler, req.conn = server.wrapclient(socket.tcp(), req.host, req.port or 80, listener, "*a");
end
req.handler, req.conn = server.wrapclient(socket.tcp(), req.host, req.port or 80, listener, "*a");
- req.write =
req.handler.write;
+ req.write =
function (...) return req.handler:write(...); end
req.conn:settimeout(0);
local ok, err = req.conn:connect(req.host, req.port or 80);
if not ok and err ~= "timeout" then
req.conn:settimeout(0);
local ok, err = req.conn:connect(req.host, req.port or 80);
if not ok and err ~= "timeout" then
@@
-192,7
+200,7
@@
end
function destroy_request(request)
if request.conn then
request.handler.close()
function destroy_request(request)
if request.conn then
request.handler.close()
- listener.disconnect(request.conn, "closed");
+ listener.
on
disconnect(request.conn, "closed");
end
end
end
end