projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* luci: fixup svn properties
[project/luci.git]
/
libs
/
http
/
luasrc
/
http
/
protocol.lua
diff --git
a/libs/http/luasrc/http/protocol.lua
b/libs/http/luasrc/http/protocol.lua
index
205869a
..
51cb02d
100644
(file)
--- a/
libs/http/luasrc/http/protocol.lua
+++ b/
libs/http/luasrc/http/protocol.lua
@@
-15,8
+15,7
@@
$Id$
module("luci.http.protocol", package.seeall)
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
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
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
end
return str
@@
-84,7
+83,7
@@
function urlencode( str )
if type(str) == "string" then
str = str:gsub(
if type(str) == "string" then
str = str:gsub(
- "([^a-zA-Z0-9$_%-%.+!*'(),])",
+ "([^a-zA-Z0-9$_%-%.
%
+!*'(),])",
__chrenc
)
end
__chrenc
)
end
@@
-160,7
+159,7
@@
process_states['magic'] = function( msg, chunk, err )
end
end
end
end
end
end
-
+
-- Can't handle it
return nil, "Invalid HTTP message magic"
end
-- Can't handle it
return nil, "Invalid HTTP message magic"
end
@@
-533,10
+532,10
@@
function header_source( sock )
local chunk, err, part = sock:receive("*l")
-- Line too long
local chunk, err, part = sock:receive("*l")
-- Line too long
- if chunk == nil then
+ if chunk == nil then
if err ~= "timeout" then
return nil, part
if err ~= "timeout" then
return nil, part
- and "Line exceeds maximum allowed length
["..part.."]
"
+ and "Line exceeds maximum allowed length"
or "Unexpected EOF"
else
return nil, err
or "Unexpected EOF"
else
return nil, err
@@
-779,11
+778,14
@@
end
-- Status codes
statusmsg = {
[200] = "OK",
-- Status codes
statusmsg = {
[200] = "OK",
+ [301] = "Moved Permanently",
+ [304] = "Not Modified",
[400] = "Bad Request",
[403] = "Forbidden",
[404] = "Not Found",
[405] = "Method Not Allowed",
[411] = "Length Required",
[400] = "Bad Request",
[403] = "Forbidden",
[404] = "Not Found",
[405] = "Method Not Allowed",
[411] = "Length Required",
+ [412] = "Precondition Failed",
[500] = "Internal Server Error",
[503] = "Server Unavailable",
}
[500] = "Internal Server Error",
[503] = "Server Unavailable",
}