Class: MiniProxy::FakeSSLServer
- Inherits:
-
WEBrick::HTTPServer
- Object
- WEBrick::HTTPServer
- MiniProxy::FakeSSLServer
- Defined in:
- lib/miniproxy/fake_ssl_server.rb
Overview
MiniProxy fake SSL enabled server, which receives relayed requests from the ProxyServer
Instance Method Summary collapse
-
#initialize(config = {}, default = WEBrick::Config::HTTP) ⇒ FakeSSLServer
constructor
A new instance of FakeSSLServer.
- #service(req, res) ⇒ Object
Constructor Details
#initialize(config = {}, default = WEBrick::Config::HTTP) ⇒ FakeSSLServer
Returns a new instance of FakeSSLServer.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/miniproxy/fake_ssl_server.rb', line 8 def initialize(config = {}, default = WEBrick::Config::HTTP) config = config.merge({ Logger: WEBrick::Log.new(nil, 0), # silence logging AccessLog: [], # silence logging SSLEnable: true, SSLCertificate: OpenSSL::X509::Certificate.new(certificate_file("cert.pem")), SSLPrivateKey: OpenSSL::PKey::RSA.new(certificate_file("cert.key")), SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE, }) super(config, default) end |
Instance Method Details
#service(req, res) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/miniproxy/fake_ssl_server.rb', line 21 def service(req, res) if self.config[:AllowedRequestCheck].call(req) super(req, res) else self.config[:MockHandlerCallback].call(req, res) end end |