Sha256: 69b69be71d2e2494298d16ed097dbf81fc6f89c7bf6158751b1c90891a644431

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

require 'lib/em-proxy'

Proxy.start(:host => "0.0.0.0", :port => 80) do |conn|
  conn.server :srv, :host => "127.0.0.1", :port => 81

  # modify / process request stream
  conn.on_data do |data|
    p [:on_data, data]
    data
  end
 
  # modify / process response stream
  conn.on_response do |backend, resp|
    p [:on_response, backend, resp]
    # resp = "HTTP/1.1 200 OK\r\nConnection: close\r\nDate: Thu, 30 Apr 2009 03:53:28 GMT\r\nContent-Type: text/plain\r\n\r\nHar!"
    resp
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fizx-em-proxy-0.1.1 examples/port_forward.rb