Changeset

4351:3f414091a008

net.http: Whitespace fixes
author Matthew Wild <mwild1@gmail.com>
date Sat, 20 Aug 2011 15:08:54 -0400
parents 4350:0b9ed126286e
children 4352:912a49b1c4e3
files net/http.lua
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/net/http.lua	Sat Aug 20 15:08:21 2011 -0400
+++ b/net/http.lua	Sat Aug 20 15:08:54 2011 -0400
@@ -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 @@
 	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 @@
 			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 @@
 	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;