Class: NewRelic::Agent::HTTPClients::CurbRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/http_clients/curb_wrappers.rb

Constant Summary collapse

CURB =
'Curb'
LHOST =
'host'
UHOST =
'Host'

Instance Method Summary collapse

Constructor Details

#initialize(curlobj) ⇒ CurbRequest

Returns a new instance of CurbRequest.



15
16
17
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 15

def initialize(curlobj)
  @curlobj = curlobj
end

Instance Method Details

#[](key) ⇒ Object



35
36
37
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 35

def [](key)
  headers[key]
end

#[]=(key, value) ⇒ Object



39
40
41
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 39

def []=(key, value)
  headers[key] = value
end

#headersObject



47
48
49
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 47

def headers
  @curlobj.headers
end

#hostObject



27
28
29
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 27

def host
  host_from_header || self.uri.host
end

#host_from_headerObject



23
24
25
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 23

def host_from_header
  self[LHOST] || self[UHOST]
end

#methodObject



31
32
33
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 31

def method
  @curlobj._nr_http_verb
end

#typeObject



19
20
21
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 19

def type
  CURB
end

#uriObject



43
44
45
# File 'lib/new_relic/agent/http_clients/curb_wrappers.rb', line 43

def uri
  @uri ||= URIUtil.parse_and_normalize_url(@curlobj.url)
end