Sha256: e8f05e9b3cf4446c803ab8530d3aa5003948f5ec3e75725a25c526e1745a29f2
Contents?: true
Size: 854 Bytes
Versions: 6
Compression:
Stored size: 854 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
6 entries across 6 versions & 1 rubygems