fork download
  1. #coding:utf-8
  2. require 'webrick'
  3. require 'webrick/httpproxy'
  4.  
  5. handler = Proc.new() {| q , res |
  6.  
  7. }
  8.  
  9. s = WEBrick::HTTPProxyServer.new(
  10. :BindAddress => '127.0.0.1',
  11. :Port => 8082,
  12. :Logger => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG),
  13. :ProxyVia => false,
  14. :ProxyContentHandler => handler
  15. )
  16. Signal.trap('INT') do
  17. s.shutdown
  18. exit
  19. end
  20.  
  21. s.start
  22.  
Time limit exceeded #stdin #stdout #stderr 5s 16352KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
[2016-06-26 08:21:36] INFO  WEBrick 1.3.1
[2016-06-26 08:21:36] INFO  ruby 2.1.5 (2014-11-13) [i386-linux-gnu]
[2016-06-26 08:21:36] INFO  WEBrick::HTTPProxyServer#start: pid=29163 port=8082