2 require "webrick/httpproxy"
4 # :ProxyContentHandler will be invoked before sending
5 # response to User-Agenge. You can inspect the pair of
6 # request and response messages (or can edit the response
7 # message if necessary).
9 pch = Proc.new{|req, res|
10 p [ req.request_line, res.status_line ]
14 if prx = ENV["http_proxy"]
20 httpd = WEBrick::HTTPProxyServer.new(
22 :ProxyContentHandler => pch,
23 :ProxyURI => upstream_proxy
25 Signal.trap(:INT){ httpd.shutdown }