projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Content Type for www-urlencoded should match additions like "; charset=utf8" as well
[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
93c9e79
..
b9a50ef
100644
(file)
--- a/
libs/http/luasrc/http/protocol.lua
+++ b/
libs/http/luasrc/http/protocol.lua
@@
-131,7
+131,7
@@
function urlencode_params( tbl )
return enc
end
return enc
end
---
-
(Internal function)
+-- (Internal function)
-- Initialize given parameter and coerce string into table when the parameter
-- already exists.
-- @param tbl Table where parameter should be created
-- Initialize given parameter and coerce string into table when the parameter
-- already exists.
-- @param tbl Table where parameter should be created
@@
-147,7
+147,7
@@
local function __initval( tbl, key )
end
end
end
end
---
-
(Internal function)
+-- (Internal function)
-- Append given data to given parameter, either by extending the string value
-- or by appending it to the last string in the parameter's value table.
-- @param tbl Table containing the previously initialized parameter value
-- Append given data to given parameter, either by extending the string value
-- or by appending it to the last string in the parameter's value table.
-- @param tbl Table containing the previously initialized parameter value
@@
-163,7
+163,7
@@
local function __appendval( tbl, key, chunk )
end
end
end
end
---
-
(Internal function)
+-- (Internal function)
-- Finish the value of given parameter, either by transforming the string value
-- or - in the case of multi value parameters - the last element in the
-- associated values table.
-- Finish the value of given parameter, either by transforming the string value
-- or - in the case of multi value parameters - the last element in the
-- associated values table.
@@
-309,7
+309,7
@@
end
-- file contents chunk by chunk and only the extracted file name is stored
-- within the params table. The callback function will be called subsequently
-- with three arguments:
-- file contents chunk by chunk and only the extracted file name is stored
-- within the params table. The callback function will be called subsequently
-- with three arguments:
--- o Table containing
the mime headers of the corresponding section
+-- o Table containing
decoded (name, file) and raw (headers) mime header data
-- o String value containing a chunk of the file data
-- o Boolean which indicates wheather the current chunk is the last one (eof)
-- @param src Ltn12 source function
-- o String value containing a chunk of the file data
-- o Boolean which indicates wheather the current chunk is the last one (eof)
-- @param src Ltn12 source function
@@
-421,7
+421,7
@@
function mimedecode_message_body( src, msg, filecb )
end
if store then
end
if store then
- store( field
.headers
, predata, true )
+ store( field, predata, true )
end
end
@@
-439,7
+439,7
@@
function mimedecode_message_body( src, msg, filecb )
data = data:sub( 1, #data - 78 )
if store then
data = data:sub( 1, #data - 78 )
if store then
- store( field
.headers
, data, false )
+ store( field, data, false )
else
return nil, "Invalid MIME section header"
end
else
return nil, "Invalid MIME section header"
end
@@
-451,7
+451,7
@@
function mimedecode_message_body( src, msg, filecb )
lchunk, eof = parse_headers( data, field )
inhdr = not eof
else
lchunk, eof = parse_headers( data, field )
inhdr = not eof
else
- store( field
.headers
, lchunk, false )
+ store( field, lchunk, false )
lchunk, chunk = chunk, nil
end
end
lchunk, chunk = chunk, nil
end
end
@@
-568,7
+568,9
@@
function parse_message_header( src )
REQUEST_URI = msg.request_uri;
SCRIPT_NAME = msg.request_uri:gsub("?.+$","");
SCRIPT_FILENAME = ""; -- XXX implement me
REQUEST_URI = msg.request_uri;
SCRIPT_NAME = msg.request_uri:gsub("?.+$","");
SCRIPT_FILENAME = ""; -- XXX implement me
- SERVER_PROTOCOL = "HTTP/" .. string.format("%.1f", msg.http_version)
+ SERVER_PROTOCOL = "HTTP/" .. string.format("%.1f", msg.http_version);
+ QUERY_STRING = msg.request_uri:match("?")
+ and msg.request_uri:gsub("^.+?","") or ""
}
-- Populate HTTP_* environment variables
}
-- Populate HTTP_* environment variables
@@
-617,7
+619,7
@@
function parse_message_body( src, msg, filecb )
-- Is it application/x-www-form-urlencoded ?
elseif msg.env.REQUEST_METHOD == "POST" and msg.env.CONTENT_TYPE and
-- Is it application/x-www-form-urlencoded ?
elseif msg.env.REQUEST_METHOD == "POST" and msg.env.CONTENT_TYPE and
- msg.env.CONTENT_TYPE
== "application/x-www-form-urlencoded"
+ msg.env.CONTENT_TYPE
:match("^application/x%-www%-form%-urlencoded")
then
return urldecode_message_body( src, msg, filecb )
then
return urldecode_message_body( src, msg, filecb )