lucid: fix separation of query string and url in server handler
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 1 Jun 2009 18:10:37 +0000 (18:10 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 1 Jun 2009 18:10:37 +0000 (18:10 +0000)
libs/lucid-http/luasrc/lucid/http/server.lua

index 21a752c..70a1726 100644 (file)
@@ -343,8 +343,13 @@ function Server.parse_headers(self, source)
                        break
                end
        until false
-       
-       env.SCRIPT_NAME, env.QUERY_STRING = env.REQUEST_URI:match("(.*)%??(.*)")
+
+       if env.REQUEST_URI:find("?") then       
+               env.SCRIPT_NAME, env.QUERY_STRING = env.REQUEST_URI:match("([^%?]*)%?(.*)")
+       else
+               env.SCRIPT_NAME, env.QUERY_STRING = env.REQUEST_URI, nil
+       end
+
        return req
 end