Created
August 14, 2016 13:33
-
-
Save cat-in-136/624e53f4b9437c8eaee15066da654485 to your computer and use it in GitHub Desktop.
Fake connectivitycheck.gstatic.com
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 characters
#!/usr/bin/ruby | |
require 'webrick' | |
server = WEBrick::HTTPServer.new( | |
:ServerSoftware => nil, | |
:BindAddress => '0.0.0.0', | |
:Port => 80, | |
:Logger => WEBrick::Log.new($stderr, WEBrick::Log::DEBUG), | |
:AccessLog => [ | |
[ $stdout, WEBrick::AccessLog::COMMON_LOG_FORMAT ], | |
[ $stdout, WEBrick::AccessLog::REFERER_LOG_FORMAT ], | |
[ $stdout, WEBrick::AccessLog::AGENT_LOG_FORMAT ], | |
] | |
) | |
server.mount_proc '/generate_204' do |req, res| | |
res.body = '' | |
res.status = 204 | |
res.keep_alive = false | |
end | |
trap(:INT){ server.shutdown } | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment