Sha256: 388fb7af8508a3fac05d6a08ee7b032cca09f6b9090fb161da3e83813bff2360

Contents?: true

Size: 855 Bytes

Versions: 36

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

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

36 entries across 36 versions & 3 rubygems

Version Path
direct7-0.0.18 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/support/proxy_server.rb
direct7-0.0.17 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/support/proxy_server.rb
direct7-0.0.16 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/support/proxy_server.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/http-5.2.0/spec/support/proxy_server.rb
direct7-0.0.13 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/support/proxy_server.rb
direct7-0.0.12 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/support/proxy_server.rb
http-5.2.0 spec/support/proxy_server.rb
direct7-0.0.11 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/spec/support/proxy_server.rb
http-5.1.1 spec/support/proxy_server.rb
http-5.1.0 spec/support/proxy_server.rb
http-5.0.4 spec/support/proxy_server.rb
http-5.0.3 spec/support/proxy_server.rb
http-5.0.2 spec/support/proxy_server.rb
http-5.0.1 spec/support/proxy_server.rb
http-5.0.0 spec/support/proxy_server.rb
http-4.4.1 spec/support/proxy_server.rb
http-4.4.0 spec/support/proxy_server.rb
http-5.0.0.pre3 spec/support/proxy_server.rb
http-5.0.0.pre2 spec/support/proxy_server.rb
http-4.3.0 spec/support/proxy_server.rb