Module: RubyProxyHeaders::NetHTTP::ConnectResponseRead

Defined in:
lib/ruby_proxy_headers/net_http.rb

Overview

Records CONNECT response headers. Active only while #connect is running, so the later origin response is left alone.

Instance Method Summary collapse

Instance Method Details

#read_new(sock) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ruby_proxy_headers/net_http.rb', line 59

def read_new(sock)
  response = super
  http = Thread.current[:ruby_proxy_headers_active_http]
  if http
    headers = HeaderMap.new
    response.each_header { |key, value| headers[key] = value }
    http.last_proxy_connect_response_headers = headers
    Thread.current[:ruby_proxy_headers_connect_headers] = headers.dup
  end
  response
end