Want more features on Pastebin? Sign Up, it's FREE!
Guest

jow

By: a guest on Sep 16th, 2010  |  syntax: Lua  |  size: 0.64 KB  |  views: 1,189  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. root@OpenWrt:~# opkg install uhttpd-mod-lua
  2. Installing uhttpd-mod-lua (18) to root...
  3. Downloading http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/uhttpd-mod-lua_18_ar71xx.ipk.
  4. Configuring uhttpd-mod-lua.
  5. root@OpenWrt:~# uci set uhttpd.main.lua_prefix=/lua
  6. root@OpenWrt:~# uci set uhttpd.main.lua_handler=/root/test.lua
  7. root@OpenWrt:~# cat /root/test.lua
  8. function handle_request(env)
  9.         uhttpd.send("HTTP/1.0 200 OK\r\n")
  10.         uhttpd.send("Content-Type: text/plain\r\n\r\n")
  11.         uhttpd.send("Hello world.\n")
  12. end
  13. root@OpenWrt:~# /etc/init.d/uhttpd restart
  14. root@OpenWrt:~# wget -qO- http://127.0.0.1/lua/
  15. Hello world.
  16. root@OpenWrt:~#
clone this paste RAW Paste Data