Diff

plugins/mod_http.lua @ 4721:1c6c4c53f08a

mod_http: Routes now require a method to be specified, but the path has become optional (defaults to the base path with no trailing '/'
author Matthew Wild <mwild1@gmail.com>
date Fri, 27 Apr 2012 18:37:40 +0100
parent 4720:fddc2797a96a
child 4724:a8c234332258
line wrap: on
line diff
--- a/plugins/mod_http.lua	Fri Apr 27 18:36:27 2012 +0100
+++ b/plugins/mod_http.lua	Fri Apr 27 18:37:40 2012 +0100
@@ -18,13 +18,12 @@
 
 local function get_http_event(host, app_path, key)
 	local method, path = key:match("^(%S+)%s+(.+)$");
-	if not method then
-		if key:sub(1,1) ~= "/" then
-			return nil;
-		end
-		method, path = "GET", key;
+	if not method then -- No path specified, default to "" (base path)
+		method, path = key, "";
 	end
-	path = normalize_path(path);
+	if method:sub(1,1) == "/" then
+		return nil;
+	end
 	return method:upper().." "..host..app_path..path;
 end