Sha256: 8292867bd9843ba8c54780e3b7784d5ee10a1ce1325699a4fc9410cac8e53f06
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
if __FILE__ == $0 SSL_KEY = "spec/fixtures/certificates/key.pem" SSL_CERT = "spec/fixtures/certificates/client_cert.pem" SSL_CA_CERT = "spec/fixtures/certificates/ca_cert.pem" trap(:INT) do @server.shutdown exit end def webrick_opts port certificate = OpenSSL::X509::Certificate.new(File.read(SSL_CERT)) cert_name = certificate.subject.to_a.collect{|a| a[0..1] } logger_stream = ENV["DEBUG"] ? $stderr : StringIO.new { Port: port, Host: "0.0.0.0", AccessLog: [], Logger: WEBrick::Log.new(logger_stream,WEBrick::Log::INFO), SSLVerifyClient: OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT | OpenSSL::SSL::VERIFY_PEER, SSLCACertificateFile: SSL_CA_CERT, SSLCertificate: certificate, SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read(SSL_KEY)), SSLEnable: true, SSLCertName: cert_name, } end app = ->(_env) { puts "hello"; [200, {}, ["Hello world" + "\n"]] } require "webrick" require "webrick/https" require "rack" require "rackup/handler/webrick" opts = webrick_opts(4444) Rack::Handler::WEBrick.run(app, **opts) do |server| @server = server end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pact_broker-client-1.75.1 | spec/support/ssl_server.rb |
pact_broker-client-1.75.0 | spec/support/ssl_server.rb |