Module: RubyProxyHeaders::NetHTTP::ConnectRequestWrite

Defined in:
lib/ruby_proxy_headers/net_http.rb

Overview

Rewrites a CONNECT write while a patched connection is opening.

Instance Method Summary collapse

Instance Method Details

#write(*strs) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ruby_proxy_headers/net_http.rb', line 42

def write(*strs)
  http = Thread.current[:ruby_proxy_headers_active_http]
  if http && strs.first.start_with?('CONNECT ')
    strs = [
      RubyProxyHeaders::NetHTTP.inject_connect_headers(
        strs.join,
        http.proxy_connect_request_headers
      )
    ]
  end
  super(*strs)
end