test/test_puma_server_ssl.rb
# yields ctx to block, use for ctx setup & configuration
yields ctx to block, use for ctx setup & configuration
yields ctx to block use for ctx setup & configuration
def start_server
    @host = "127.0.0.1"
    app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }
    ctx = Puma::MiniSSL::Context.new
    if Puma.jruby?
      ctx.keystore =  File.expand_path "../examples/puma/keystore.jks", __dir__
      ctx.keystore_pass = 'jruby_puma'
    else
      ctx.key  =  File.expand_path "../examples/puma/puma_keypair.pem", __dir__
      ctx.cert = File.expand_path "../examples/puma/cert_puma.pem", __dir__
    end
    ctx.verify_mode = Puma::MiniSSL::VERIFY_NONE
    yield ctx if block_given?
    @log_writer = SSLLogWriterHelper.new STDOUT, STDERR
    @server = Puma::Server.new app, @log_writer
    @port = (@server.add_ssl_listener @host, 0, ctx).addr[1]
    @server.run
    @http = Net::HTTP.new @host, @port
    @http.use_ssl = true
    @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
def start_server @host = "127.0.0.1" app = lambda { | env | [ 200 , { } , [ env [ 'rack.url_scheme' ] ] ] } ctx = Puma :: MiniSSL :: Context . new if Puma . jruby? ctx . keystore = File . expand_path "../examples/puma/keystore.jks" , __dir__ ctx . keystore_pass = 'jruby_puma' else ctx . key = File . expand_path "../examples/puma/puma_keypair.pem" , __dir__ ctx . cert = File . expand_path "../examples/puma/cert_puma.pem" , __dir__ end ctx . verify_mode = Puma :: MiniSSL :: VERIFY_NONE yield ctx if block_given? @log_writer = SSLLogWriterHelper . new STDOUT , STDERR @server = Puma :: Server . new app , @log_writer @port = ( @server . add_ssl_listener @host , 0 , ctx ) . addr [ 1 ] @server . run @http = Net :: HTTP . new @host , @port @http . use_ssl = true @http . verify_mode = OpenSSL :: SSL :: VERIFY_NONE end
yields ctx to block, use for ctx setup & configuration
yields ctx to block use for ctx setup & configuration