[luci] To Get Client IP Addr - Lucittpd seems not running in CGI Mode
Patrick Sun
lawipac at gmail.com
Thu Jan 14 13:24:36 CET 2010
Hi,
Thank you for your prompt reply... Every time I find a message, I'm
kinda feeling happy .. :)
> Try to obtain the client addr with:
>
> local addr = luci.http.getenv("REMOTE_ADDR") .. ":" ..
> luci.http.getenv("REMOTE_PORT")
>
I tried that with a LuCI module 'Test' with its source code below.
> module("luci.controller.test.index", package.seeall)
> require "luci.http"
>
> function index()
> entry({"test", "test"}, call("action_tryme"), "Test", 20)
> end
>
> function action_tryme()
> local ip = luci.http.getenv("REMOTE_ADDR")
> luci.http.prepare_content("text/plain")
> luci.http.write(type(ip)) ---> I get nil,
> luci.http.write(luci.sys.getenv()); ---> I get nothing in
> output.
> luci.http.write("<br> some text follows");
> end
>
Did I made any mistakes?
Regards
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.subsignal.org/pipermail/luci/attachments/20100114/dbd7bde6/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: face-smile.png
Type: image/png
Size: 986 bytes
Desc: not available
Url : http://lists.subsignal.org/pipermail/luci/attachments/20100114/dbd7bde6/attachment.png
More information about the luci
mailing list