summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/http
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-06-15 17:45:10 +0000
committerSteven Barth <steven@midlink.org>2008-06-15 17:45:10 +0000
commiteae0e447989a1a37ce6cb8df9f1f353738aab4f6 (patch)
tree4d8568109967259150413e873af2592a6f975373 /libs/web/luasrc/http
parent3455ee6d8d9eb3c0ee8459adb586a800dadaf737 (diff)
* Added support for CGI SGI
Diffstat (limited to 'libs/web/luasrc/http')
-rw-r--r--libs/web/luasrc/http/protocol.lua21
1 files changed, 8 insertions, 13 deletions
diff --git a/libs/web/luasrc/http/protocol.lua b/libs/web/luasrc/http/protocol.lua
index 4ff2cb8f98..d9259f6604 100644
--- a/libs/web/luasrc/http/protocol.lua
+++ b/libs/web/luasrc/http/protocol.lua
@@ -370,9 +370,6 @@ function parse_message_header( data )
message.headers = hdrs
- -- Get content
- local clen = ( hdrs['Content-Length'] or HTTP_MAX_CONTENT ) + 0
-
-- Process get parameters
if ( method == "get" or method == "post" ) and
message.request_uri:match("?")
@@ -421,25 +418,24 @@ end
function parse_message_body( reader, message, filecb )
if type(message) == "table" then
+ local env = message.env
- local hdrs = message.headers
-
+ local clen = ( env.CONTENT_LENGTH or HTTP_MAX_CONTENT ) + 0
+
-- Process post method
- if message.request_method == "post" and hdrs['Content-Type'] then
-
+ if env.REQUEST_METHOD:lower() == "post" and env.CONTENT_TYPE then
-- Is it multipart/form-data ?
- if hdrs['Content-Type']:match("^multipart/form%-data") then
+ if env.CONTENT_TYPE:match("^multipart/form%-data") then
for k, v in pairs( mimedecode(
reader,
- hdrs['Content-Type']:match("boundary=(.+)"),
+ env.CONTENT_TYPE:match("boundary=(.+)"),
filecb
) ) do
message.params[k] = v
end
- -- Is it x-www-urlencoded?
- elseif hdrs['Content-Type'] == 'application/x-www-urlencoded' then
-
+ -- Is it x-www-form-urlencoded?
+ elseif env.CONTENT_TYPE:match('^application/x%-www%-form%-urlencoded') then
-- XXX: readline isn't the best solution here
for chunk in reader do
for k, v in pairs( urldecode_params( chunk ) ) do
@@ -458,7 +454,6 @@ function parse_message_body( reader, message, filecb )
-- If a file callback is given then feed it line by line, else
-- store whole buffer in message.content
else
-
for chunk in reader do
-- We have a callback, feed it.