Sha256: c641e95550a7c5c4e93231b9255af46ca123b2fd0cf45d8c416b84699197e589

Contents?: true

Size: 995 Bytes

Versions: 52

Compression:

Stored size: 995 Bytes

Contents

#!/usr/bin/env ruby
require 'webrick'
require 'webrick/https'
require 'openssl'

private_key_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "server.key"))
cert_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "server.crt"))

pkey = OpenSSL::PKey::RSA.new(File.read(private_key_file))
cert = OpenSSL::X509::Certificate.new(File.read(cert_file))

pid_file = ENV["PID_FILE"]

s = WEBrick::HTTPServer.new(
  :Port => (ENV['SSL_TEST_PORT'] || 8443),
  :Logger => WEBrick::Log::new(nil, WEBrick::Log::ERROR),
  :DocumentRoot => File.join(File.dirname(__FILE__)),
  :ServerType => WEBrick::Daemon,
  :SSLEnable => true,
  :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
  :SSLCertificate => cert,
  :SSLPrivateKey => pkey,
  :SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ],
  :StartCallback => proc { File.open(pid_file, "w") { |f| f.write $$.to_s }}
)
s.mount_proc("/") { |req,resp| resp.body = "hello world" }
trap("INT"){ s.shutdown }
s.start

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
litmus_paper-0.6.0 spec/script/https_test_server.rb
litmus_paper-0.5.0 spec/script/https_test_server.rb
litmus_paper-0.4.0 spec/script/https_test_server.rb
litmus_paper-0.3.5 spec/script/https_test_server.rb
litmus_paper-0.3.3 spec/script/https_test_server.rb
litmus_paper-0.3.2 spec/script/https_test_server.rb
litmus_paper-0.3.1 spec/script/https_test_server.rb
litmus_paper-0.3.0 spec/script/https_test_server.rb
litmus_paper-0.2.2 spec/script/https_test_server.rb
litmus_paper-0.2.1 spec/script/https_test_server.rb
litmus_paper-0.2.0 spec/script/https_test_server.rb
litmus_paper-0.1.0 spec/script/https_test_server.rb