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 21a752c68b8106b285cdcb14139d9220bc40900b..70a17262186ad93330d1b5810fd9ea65fa37e2a8 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