diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-08-20 15:08:54 -0400 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-08-20 15:08:54 -0400 |
commit | cbc11b51bba628e9a3dc07bdfb96a63b724e0c88 (patch) | |
tree | 4eabaa75806bea5f1c162bbe4640f7d57566b196 /net | |
parent | 4158a96b3a294beda82cd2eb68d26efdf779ed4d (diff) | |
download | prosody-cbc11b51bba628e9a3dc07bdfb96a63b724e0c88.tar.gz prosody-cbc11b51bba628e9a3dc07bdfb96a63b724e0c88.zip |
net.http: Whitespace fixes
Diffstat (limited to 'net')
-rw-r--r-- | net/http.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/http.lua b/net/http.lua index c37288fe..355332bc 100644 --- a/net/http.lua +++ b/net/http.lua @@ -6,7 +6,6 @@ -- COPYING file in the source package for more information. -- - local socket = require "socket" local mime = require "mime" local url = require "socket.url" @@ -105,7 +104,7 @@ function request(u, ex, callback) if req.userinfo then default_headers["Authorization"] = "Basic "..mime.b64(req.userinfo); end - + if ex then custom_headers = ex.headers; req.onlystatus = ex.onlystatus; @@ -115,7 +114,12 @@ function request(u, ex, callback) default_headers["Content-Length"] = tostring(#body); default_headers["Content-Type"] = "application/x-www-form-urlencoded"; end - if ex.method then req.method = ex.method; end + if ex.method then method = ex.method; end + if ex.headers then + for k, v in pairs(ex.headers) do + headers[k] = v; + end + end end req.handler, req.conn = server.wrapclient(socket.tcp(), req.host, req.port or 80, listener, "*a"); @@ -158,7 +162,7 @@ function request(u, ex, callback) req.callback = function (content, code, request) log("debug", "Calling callback, status %s", code or "---"); return select(2, xpcall(function () return callback(content, code, request) end, handleerr)); end req.reader = request_reader; req.state = "status"; - + listener.register_request(req.handler, req); return req; |