Skip to content

Instantly share code, notes, and snippets.

@brainopia
Created October 18, 2012 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainopia/3910380 to your computer and use it in GitHub Desktop.
Save brainopia/3910380 to your computer and use it in GitHub Desktop.
Github proxy
require 'em-proxy'
Proxy.start host: '0.0.0.0', port: ENV['PORT'] do |connection|
connection.server :github, host: 'api.github.com', port: 443
ok_response = "HTTP/1.1 200 Ok\r\n\r\n"
connect_verb = /\Aconnect/i
connection.on_data do |data|
if data =~ connect_verb
send_data ok_response
:async
else
data
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment