net.http: Convert port to a number (for custom port in URL)
authorMatthew Wild <mwild1@gmail.com>
Mon, 22 Aug 2011 12:57:52 -0400
changeset 4356 10a4f3b081a7
parent 4355 9e2a841739b5
child 4357 d6928b78c548
net.http: Convert port to a number (for custom port in URL)
net/http.lua
--- a/net/http.lua	Sat Aug 20 16:51:47 2011 -0400
+++ b/net/http.lua	Mon Aug 22 12:57:52 2011 -0400
@@ -134,7 +134,7 @@
 	req.method, req.headers, req.body = method, headers, body;
 	
 	local using_https = req.scheme == "https";
-	local port = req.port or (using_https and 443 or 80);
+	local port = tonumber(req.port) or (using_https and 443 or 80);
 	
 	-- Connect the socket, and wrap it with net.server
 	local conn = socket.tcp();