Sha256: aee362690453ca341e91cf7daef75d3f570092a5af329529ce3b7a209433d662

Contents?: true

Size: 824 Bytes

Versions: 45

Compression:

Stored size: 824 Bytes

Contents

require "webrick/httpproxy"

require "support/black_hole"
require "support/servers/config"
require "support/servers/runner"

class ProxyServer < WEBrick::HTTPProxyServer
  include ServerConfig

  CONFIG = {
    :BindAddress     => "127.0.0.1",
    :Port            => 0,
    :AccessLog       => BlackHole,
    :Logger          => BlackHole,
    :RequestCallback => proc { |_, res| res["X-PROXIED"] = true }
  }.freeze

  def initialize
    super CONFIG
  end
end

class AuthProxyServer < WEBrick::HTTPProxyServer
  include ServerConfig

  AUTHENTICATOR = proc do |req, res|
    WEBrick::HTTPAuth.proxy_basic_auth(req, res, "proxy") do |user, pass|
      user == "username" && pass == "password"
    end
  end

  CONFIG = ProxyServer::CONFIG.merge :ProxyAuthProc => AUTHENTICATOR

  def initialize
    super CONFIG
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

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