Class: NewRelic::Agent::HTTPClients::NetHTTPRequest
Constant Summary
collapse
- NET_HTTP =
'Net::HTTP'
AbstractRequest::COLON, AbstractRequest::LHOST, AbstractRequest::UHOST
Instance Method Summary
collapse
Constructor Details
#initialize(connection, request) ⇒ NetHTTPRequest
Returns a new instance of NetHTTPRequest.
22
23
24
25
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 22
def initialize(connection, request)
@connection = connection
@request = request
end
|
Instance Method Details
#[](key) ⇒ Object
47
48
49
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 47
def [](key)
@request[key]
end
|
#[]=(key, value) ⇒ Object
51
52
53
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 51
def []=(key, value)
@request[key] = value
end
|
72
73
74
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 72
def
@request.instance_variable_get(:@header)
end
|
#host ⇒ Object
39
40
41
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 39
def host
|| @connection.address
end
|
33
34
35
36
37
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 33
def
if hostname = self[LHOST]
hostname.split(COLON).first
end
end
|
#method ⇒ Object
43
44
45
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 43
def method
@request.method
end
|
#type ⇒ Object
29
30
31
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 29
def type
NET_HTTP
end
|
#uri ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/new_relic/agent/http_clients/net_http_wrappers.rb', line 55
def uri
case @request.path
when /^https?:\/\//
::NewRelic::Agent::HTTPClients::URIUtil.parse_and_normalize_url(@request.path)
else
connection_address = @connection.address
if Resolv::IPv6::Regex.match?(connection_address)
connection_address = "[#{connection_address}]"
end
scheme = @connection.use_ssl? ? 'https' : 'http'
::NewRelic::Agent::HTTPClients::URIUtil.parse_and_normalize_url(
"#{scheme}://#{connection_address}:#{@connection.port}#{@request.path}"
)
end
end
|