ngx.req.get_post_args Issue

Nginx User nginx at nginxuser.net
Sun Nov 6 10:20:45 UTC 2011


On 6 November 2011 10:12, Nginx User <nginx at nginxuser.net> wrote:
> My code (work in progress) is now
> -************************
>          START
> -************************
> local ngx_cgi = require "cgilua_module"
> if ngx.var.request_method == "POST" then
>       ngx.req.read_body()
>       local post_args = ngx_cgi.get_post_args()
>       for my_key, v in pairs( post_args ) do
>               if type(v) == "table" then
>                       my_arg = table.concat(v, " ")
>               else
>                       my_arg = v
>               end
>               regex_rules.log_alert("Alert:- " .. my_key .. " ::: " .. my_arg)
>       end
> end
> -************************
>          END
> -************************

UPDATED

-************************
         START
-************************
if ngx.var.request_method == "POST" then
      -- ngx.req.read_body() -- Not needed as cgilua handles this
      local ngx_cgi = require "cgilua_module"
      local post_args = ngx_cgi.get_post_args()
      for my_key, v in pairs( post_args ) do
              if type(v) == "table" then
                      my_arg = table.concat(v, " ")
              else
                      my_arg = v
              end
              regex_rules.log_alert("Alert:- " .. my_key .. " ::: " .. my_arg)
      end
end
-************************
         END
-************************



More information about the nginx mailing list