Created
October 29, 2019 05:50
-
-
Save ysc3839/e058bdd35df92b3f5ed9939615ece4a7 to your computer and use it in GitHub Desktop.
Revisions
-
ysc3839 created this gist
Oct 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ require('luci.util') local nx_redir = false function http_date(time) return os.date('!%a, %d %b %Y %H:%M:%S GMT', time) end function handle_request(env) local send = uhttpd.send if env.REQUEST_URI == '/' then -- NintendoWiFi if nx_redir then send('Status: 302 Found\r\n') send('Location: https://www.bing.com/\r\n\r\n') else local date = http_date(os.time()) send('Status: 200 OK\r\n') send('Content-Length: 2\r\n') send('Expires: %s\r\n' % date) send('Cache-Control: max-age=0, no-cache, no-store\r\n') send('Pragma: no-cache\r\n') send('Date: %s\r\n' % date) send('X-Organization: Nintendo\r\n') send('Content-Type: text/plain\r\n\r\nok') end elseif env.REQUEST_URI == '/generate_204' then -- Android generate_204 send('Status: 204 No Content\r\n') send('Date: %s\r\n\r\n' % http_date(os.time())) end end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ config uhttpd 'conntest' option rfc1918_filter '1' list listen_http '0.0.0.0:080' option home '/var/tmp' list lua_prefix '/=/root/conntest-handler.lua' option http_keepalive '0' option tcp_keepalive '0'