summaryrefslogtreecommitdiff
path: root/lib/webrick/httpproxy.rb
diff options
context:
space:
mode:
-rw-r--r--lib/webrick/httpproxy.rb14
1 files changed, 14 insertions, 0 deletions
@@ -15,6 +15,14 @@ require "net/http"
Net::HTTP::version_1_2 if RUBY_VERSION < "1.7"
module WEBrick
class HTTPProxyServer < HTTPServer
def initialize(config)
super
@@ -111,6 +119,7 @@ module WEBrick
proxy_port = proxy.port
if proxy.userinfo
credentials = "Basic " + [proxy.userinfo].pack("m*")
header['proxy-authorization'] = credentials
end
end
@@ -171,6 +180,7 @@ module WEBrick
proxy_request_line = "CONNECT #{host}:#{port} HTTP/1.0"
if proxy.userinfo
credentials = "Basic " + [proxy.userinfo].pack("m*")
end
host, port = proxy.host, proxy.port
end
@@ -211,6 +221,10 @@ module WEBrick
end
res.send_response(ua)
access_log(@config, req, res)
end
begin