webmcp
diff framework/env/request/set_allowed_json_request_slots.lua @ 16:944642a3e488
New set_cookie functions; Added inline documentation; Make set_allowed_json_request_slots work in interactive shell
| author | jbe/bsw |
|---|---|
| date | Thu Mar 25 17:37:03 2010 +0100 (2010-03-25) |
| parents | 985024b16520 |
| children |
line diff
1.1 --- a/framework/env/request/set_allowed_json_request_slots.lua Sat Feb 20 21:01:57 2010 +0100 1.2 +++ b/framework/env/request/set_allowed_json_request_slots.lua Thu Mar 25 17:37:03 2010 +0100 1.3 @@ -8,16 +8,18 @@ 1.4 --]]-- 1.5 1.6 function request.set_allowed_json_request_slots(slot_idents) 1.7 - local hash = {} 1.8 - for idx, slot_ident in ipairs(slot_idents) do 1.9 - hash[slot_ident] = true 1.10 - end 1.11 - if cgi.params["_webmcp_json_slots[]"] then 1.12 - for idx, slot_ident in ipairs(cgi.params["_webmcp_json_slots[]"]) do 1.13 - if not hash[slot_ident] then 1.14 - error('Requesting slot "' .. slot_ident .. '" is forbidden.') 1.15 + if cgi then -- do nothing, when being in interactive mode 1.16 + local hash = {} 1.17 + for idx, slot_ident in ipairs(slot_idents) do 1.18 + hash[slot_ident] = true 1.19 + end 1.20 + if cgi.params["_webmcp_json_slots[]"] then 1.21 + for idx, slot_ident in ipairs(cgi.params["_webmcp_json_slots[]"]) do 1.22 + if not hash[slot_ident] then 1.23 + error('Requesting slot "' .. slot_ident .. '" is forbidden.') 1.24 + end 1.25 end 1.26 end 1.27 + request._json_requests_allowed = true 1.28 end 1.29 - request._json_requests_allowed = true 1.30 end