* libs/http: removed protocol.filter, added mimetypes to protocol.mime
[project/luci.git] / libs / http / luasrc / http / protocol.lua
index 67b4258..93851fb 100644 (file)
@@ -15,8 +15,7 @@ $Id$
 
 module("luci.http.protocol", package.seeall)
 
-require("ltn12")
-require("luci.http.protocol.filter")
+local ltn12 = require("luci.ltn12")
 
 HTTP_MAX_CONTENT      = 1024*4         -- 4 kB maximum content size
 HTTP_URLENC_MAXKEYLEN = 1024           -- maximum allowd size of urlencoded parameter names
@@ -31,7 +30,7 @@ function urldecode( str )
        end
 
        if type(str) == "string" then
-               str = str:gsub( "+", " " ):gsub( "%%([a-fA-F0-9][a-fA-F0-9])", __chrdec )
+               str = str:gsub( "%%([a-fA-F0-9][a-fA-F0-9])", __chrdec )
        end
 
        return str
@@ -84,7 +83,7 @@ function urlencode( str )
 
        if type(str) == "string" then
                str = str:gsub(
-                       "([^a-zA-Z0-9$_%-%.+!*'(),])",
+                       "([^a-zA-Z0-9$_%-%.%+!*'(),])",
                        __chrenc
                )
        end
@@ -779,6 +778,7 @@ end
 -- Status codes
 statusmsg = {
        [200] = "OK",
+       [301] = "Moved Permanently",
        [304] = "Not Modified",
        [400] = "Bad Request",
        [403] = "Forbidden",