Module: Typhoeus::EasyFu::Infos

Included in:
Typhoeus::Easy
Defined in:
lib/typhoeus/easy/infos.rb

Instance Method Summary collapse

Instance Method Details

#app_connect_timeObject



37
38
39
# File 'lib/typhoeus/easy/infos.rb', line 37

def app_connect_time
  get_info_double(:appconnect_time)
end

#auth_methodsObject



25
26
27
# File 'lib/typhoeus/easy/infos.rb', line 25

def auth_methods
  get_info_long(:httpauth_avail)
end

#connect_timeObject



45
46
47
# File 'lib/typhoeus/easy/infos.rb', line 45

def connect_time
  get_info_double(:connect_time)
end

#curl_error_message(code = @curl_return_code) ⇒ Object



77
78
79
# File 'lib/typhoeus/easy/infos.rb', line 77

def curl_error_message(code = @curl_return_code)
  code ? Curl.easy_strerror(code) : nil
end

#curl_return_codeObject



73
74
75
# File 'lib/typhoeus/easy/infos.rb', line 73

def curl_return_code
  Curl::EasyCode[@curl_return_code]
end

#curl_versionObject



81
82
83
# File 'lib/typhoeus/easy/infos.rb', line 81

def curl_version
  Curl.version
end

#effective_urlObject



53
54
55
# File 'lib/typhoeus/easy/infos.rb', line 53

def effective_url
  get_info_string(:effective_url)
end

#get_info_double(option) ⇒ Object



18
19
20
21
22
23
# File 'lib/typhoeus/easy/infos.rb', line 18

def get_info_double(option)
  if Curl.easy_getinfo(@handle, option, double_ptr) == :ok
    double_ptr.read_double
  else nil
  end
end

#get_info_long(option) ⇒ Object



11
12
13
14
15
16
# File 'lib/typhoeus/easy/infos.rb', line 11

def get_info_long(option)
  if Curl.easy_getinfo(@handle, option, long_ptr) == :ok
    long_ptr.read_long
  else nil
  end
end

#get_info_string(option) ⇒ Object



4
5
6
7
8
9
# File 'lib/typhoeus/easy/infos.rb', line 4

def get_info_string(option)
  if Curl.easy_getinfo(@handle, option, string_ptr) == :ok
    string_ptr.read_pointer.read_string
  else nil
  end
end

#name_lookup_timeObject



49
50
51
# File 'lib/typhoeus/easy/infos.rb', line 49

def name_lookup_time
  get_info_double(:namelookup_time)
end

#pretransfer_timeObject



41
42
43
# File 'lib/typhoeus/easy/infos.rb', line 41

def pretransfer_time
  get_info_double(:pretransfer_time)
end

#primary_ipObject



57
58
59
# File 'lib/typhoeus/easy/infos.rb', line 57

def primary_ip
  get_info_string(:primary_ip)
end

#redirect_countObject



69
70
71
# File 'lib/typhoeus/easy/infos.rb', line 69

def redirect_count
  get_info_long(:redirect_count)
end

#response_codeObject



61
62
63
# File 'lib/typhoeus/easy/infos.rb', line 61

def response_code
  get_info_long(:response_code)
end

#start_transfer_timeObject



33
34
35
# File 'lib/typhoeus/easy/infos.rb', line 33

def start_transfer_time
  get_info_double(:starttransfer_time)
end

#supports_zlib?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/typhoeus/easy/infos.rb', line 85

def supports_zlib?
  !!(curl_version.match(/zlib/))
end

#timed_out?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/typhoeus/easy/infos.rb', line 65

def timed_out?
  @curl_return_code == :operation_timedout
end

#total_time_takenObject



29
30
31
# File 'lib/typhoeus/easy/infos.rb', line 29

def total_time_taken
  get_info_double(:total_time)
end