Sha256: f880290466307d5c53e65d026ff91c21f1b23f417e133a0073e651765fa55f6d

Contents?: true

Size: 826 Bytes

Versions: 41

Compression:

Stored size: 826 Bytes

Contents

require "webrick"
require "webrick/ssl"

require "support/black_hole"
require "support/dummy_server/servlet"
require "support/servers/config"
require "support/servers/runner"
require "support/ssl_helper"

class DummyServer < WEBrick::HTTPServer
  include ServerConfig

  CONFIG = {
    :BindAddress  => "127.0.0.1",
    :Port         => 0,
    :AccessLog    => BlackHole,
    :Logger       => BlackHole
  }.freeze

  SSL_CONFIG = CONFIG.merge(
    :SSLEnable            => true,
    :SSLStartImmediately  => true
  ).freeze

  def initialize(options = {})
    super(options[:ssl] ? SSL_CONFIG : CONFIG)
    mount("/", Servlet)
  end

  def endpoint
    "#{scheme}://#{addr}:#{port}"
  end

  def scheme
    config[:SSLEnable] ? "https" : "http"
  end

  def ssl_context
    @ssl_context ||= SSLHelper.server_context
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
http-2.0.1 spec/support/dummy_server.rb
http-2.0.0 spec/support/dummy_server.rb
http-2.0.0.pre spec/support/dummy_server.rb
http-1.0.4 spec/support/dummy_server.rb
http-0.9.9 spec/support/dummy_server.rb
http-1.0.3 spec/support/dummy_server.rb
http-1.0.2 spec/support/dummy_server.rb
http-1.0.1 spec/support/dummy_server.rb
http-1.0.0 spec/support/dummy_server.rb
http-1.0.0.pre6 spec/support/dummy_server.rb
http-1.0.0.pre5 spec/support/dummy_server.rb
http-1.0.0.pre4 spec/support/dummy_server.rb
http-1.0.0.pre3 spec/support/dummy_server.rb
http-1.0.0.pre2 spec/support/dummy_server.rb
http-1.0.0.pre1 spec/support/dummy_server.rb
http-0.9.8 spec/support/dummy_server.rb
http-0.9.7 spec/support/dummy_server.rb
http-0.9.6 spec/support/dummy_server.rb
http-0.9.5 spec/support/dummy_server.rb
http-0.9.4 spec/support/dummy_server.rb