22件ヒット
[1-22件を表示]
(0.037秒)
検索結果
先頭2件
-
WEBrick
:: HTTPProxyServer . new(config , default = WEBrick :: Config :: HTTP) -> WEBrick :: HTTPProxyServer (132.0) -
プロクシオブジェクトを生成して返します。
...WEBrick::HTTPAuth::ProxyDigestAuth を使用します。
//emlist{
require 'webrick'
require 'webrick/httpproxy'
auth_proc = proc{|req, res|
unless c = req['proxy-authorization']
res['Proxy-Authenticate'] = 'Basic realm="WEBrick Proxy"'
raise WEBrick::HTTPStatus::ProxyAuthenticatio......nRequired
else
# 略
end
}
s = WEBrick::HTTPProxyServer.new(ProxyAuthProc: auth_proc, Port: 8080)
//}
: :ProxyContentHandler
接続先の HTTP サーバからの内容を処理する Proc オブジェクトを指定します。
レスポンスの内容を書き換えたりする事......//emlist{
require 'webrick'
require 'webrick/httpproxy'
handler = proc{|req, res|
res.body.gsub!(/です。/, 'でんがな。')
res.body.gsub!(/ます。/, 'まんがな。')
}
s = WEBrick::HTTPProxyServer.new(ProxyContentHandler: handler, Port: 8080)
//}
: :ProxyVia
true を指定し... -
WEBrick
:: HTTPProxyServer (14.0) -
プロクシの機能を提供するクラスです。CONNECT メソッドにも対応しています。
...います。
* https://magazine.rubyist.net/articles/0002/0002-WEBrickProxy.html
以下は完全に動作するプロクシサーバの例です。
require 'webrick'
require 'webrick/httpproxy'
s = WEBrick::HTTPProxyServer.new(Port: 8080)
Signal.trap('INT') do
s.shutdown
end
s.start...