File: post-api.lua

package info (click to toggle)
freeradius 3.2.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,400 kB
  • sloc: ansic: 125,473; sh: 5,860; perl: 4,351; sql: 3,072; python: 1,559; makefile: 621; xml: 62; tcl: 35; sed: 23; ruby: 22
file content (19 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Simple API for checking POST data

-- Get the request path
local reqPath = ngx.var.uri
-- Get the request method (POST, GET etc..)
local reqMethod = ngx.var.request_method
-- Get any URI arguments
local uriArgs = ngx.req.get_uri_args()
-- Get any POST arguments
ngx.req.read_body()
local postArgs = ngx.req.get_post_args()

-- We only reply to POST requests
if reqMethod ~= "POST"
then
    return false
end

ngx.say("Section: ", uriArgs.section, ", User: ", postArgs.user)