webmcp

changeset 99:66bdd686df30

request.get_param_strings() returns table which may be modified without side-effects
author jbe
date Mon Oct 15 17:04:07 2012 +0200 (2012-10-15)
parents c92bd1ec1130
children e75abc61d135
files framework/env/request/get_param_strings.lua
line diff
     1.1 --- a/framework/env/request/get_param_strings.lua	Mon Oct 15 16:57:39 2012 +0200
     1.2 +++ b/framework/env/request/get_param_strings.lua	Mon Oct 15 17:04:07 2012 +0200
     1.3 @@ -2,10 +2,18 @@
     1.4  params =
     1.5  param.get_param_strings()
     1.6  
     1.7 -This function returns a table with all raw GET/POST parameters as strings or list of strings (except internal parameters like "_webmcp_path" or "_webmcp_id"). The returned table must not be modified.
     1.8 +This function returns a table with all raw GET/POST parameters as strings or list of strings (except internal parameters like "_webmcp_path" or "_webmcp_id"). Modifications of the returned table have no side effects.
     1.9  
    1.10  --]]--
    1.11  
    1.12  function request.get_param_strings()
    1.13 -  return request._params
    1.14 +  local t = {}
    1.15 +  for key, value in pairs(request._params) do
    1.16 +    if type(request._params) == 'table' then
    1.17 +      t[key] = table.new(value)
    1.18 +    else
    1.19 +      t[key] = value
    1.20 +    end
    1.21 +  end
    1.22 +  return t
    1.23  end

Impressum / About Us