Skip to content

Instantly share code, notes, and snippets.

@yuki24
Created July 20, 2012 05:37
Show Gist options
  • Save yuki24/3148886 to your computer and use it in GitHub Desktop.
Save yuki24/3148886 to your computer and use it in GitHub Desktop.
a snipept for something
require 'em-proxy'
Proxy.start(host: "127.0.0.1", port: 8000, debug: false) do |conn|
conn.server :server1, host: "127.0.0.1", port: 3000
conn.server :server2, host: "127.0.0.1", port: 3001
conn.on_data do |data|
data
end
conn.on_response do |server, resp|
if resp.include?("HTTP/1.1 200")
@name = server
resp
end
end
conn.on_finish do |name|
:close if @name == name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment