Module: Typhoeus::Response::Informations
- Included in:
- Typhoeus::Response
- Defined in:
- lib/typhoeus/response/informations.rb
Overview
This module contains logic about informations on a response.
Instance Method Summary collapse
-
#appconnect_time ⇒ Float
(also: #app_connect_time)
Return the time, in seconds, it took from the start until the SSL/SSH connect/handshake to the remote host was completed.
-
#connect_time ⇒ Float
Return the time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed.
- #debug_info ⇒ Object
-
#effective_url ⇒ String
Return the last used effective url.
-
#headers ⇒ Typhoeus::Header
(also: #headers_hash)
Returns the response header.
-
#httpauth_avail ⇒ Integer
Return the available http auth methods.
-
#namelookup_time ⇒ Float
(also: #name_lookup_time)
Return the time, in seconds, it took from the start until the name resolving was completed.
-
#pretransfer_time ⇒ Float
Return the time, in seconds, it took from the start until the file transfer is just about to begin.
-
#primary_ip ⇒ String
Return the string holding the IP address of the most recent connection done with this curl handle.
-
#redirect_count ⇒ Integer
Return the total number of redirections that were actually followed.
-
#redirections ⇒ Array<Typhoeus::Response>
Return all redirections in between as multiple responses with header.
-
#response_body ⇒ String
(also: #body)
Return the http response body.
-
#response_code ⇒ Integer
(also: #code)
Return the last received HTTP, FTP or SMTP response code.
-
#response_headers ⇒ String
Return the http response headers.
-
#return_code ⇒ Symbol
Return libcurls return value.
-
#return_message ⇒ String
Returns a string describing the return.
-
#starttransfer_time ⇒ Float
(also: #start_transfer_time)
Return the time, in seconds, it took from the start until the first byte is received by libcurl.
-
#total_time ⇒ Float
(also: #time)
Return the total time in seconds for the previous transfer, including name resolving, TCP connect etc.
Instance Method Details
#appconnect_time ⇒ Float Also known as: app_connect_time
Return the time, in seconds, it took from the start until the SSL/SSH connect/handshake to the remote host was completed. This time is most often very near to the pre transfer time, except for cases such as HTTP pippelining where the pretransfer time can be delayed due to waits in line for the pipeline and more.
115 116 117 |
# File 'lib/typhoeus/response/informations.rb', line 115 def appconnect_time [:appconnect_time] || [:app_connect_time] end |
#connect_time ⇒ Float
Return the time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed.
142 143 144 |
# File 'lib/typhoeus/response/informations.rb', line 142 def connect_time [:connect_time] end |
#debug_info ⇒ Object
191 192 193 |
# File 'lib/typhoeus/response/informations.rb', line 191 def debug_info [:debug_info] end |
#effective_url ⇒ String
Return the last used effective url.
164 165 166 |
# File 'lib/typhoeus/response/informations.rb', line 164 def effective_url [:effective_url] end |
#headers ⇒ Typhoeus::Header Also known as: headers_hash
Returns the response header.
201 202 203 204 |
# File 'lib/typhoeus/response/informations.rb', line 201 def headers return nil if response_headers.nil? && !defined?(@headers) @headers ||= Response::Header.new(response_headers.split("\r\n\r\n").last) end |
#httpauth_avail ⇒ Integer
Return the available http auth methods. Bitmask indicating the authentication method(s) available.
73 74 75 |
# File 'lib/typhoeus/response/informations.rb', line 73 def httpauth_avail [:httpauth_avail] end |
#namelookup_time ⇒ Float Also known as: name_lookup_time
Return the time, in seconds, it took from the start until the name resolving was completed.
153 154 155 |
# File 'lib/typhoeus/response/informations.rb', line 153 def namelookup_time [:namelookup_time] || [:name_lookup_time] end |
#pretransfer_time ⇒ Float
Return the time, in seconds, it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved. It does not involve the sending of the protocol- specific request that triggers a transfer.
131 132 133 |
# File 'lib/typhoeus/response/informations.rb', line 131 def pretransfer_time [:pretransfer_time] end |
#primary_ip ⇒ String
Return the string holding the IP address of the most recent connection done with this curl handle. This string may be IPv6 if that’s enabled.
176 177 178 |
# File 'lib/typhoeus/response/informations.rb', line 176 def primary_ip [:primary_ip] end |
#redirect_count ⇒ Integer
Return the total number of redirections that were actually followed
187 188 189 |
# File 'lib/typhoeus/response/informations.rb', line 187 def redirect_count [:redirect_count] end |
#redirections ⇒ Array<Typhoeus::Response>
Return all redirections in between as multiple responses with header.
214 215 216 217 |
# File 'lib/typhoeus/response/informations.rb', line 214 def redirections return [] unless response_headers response_headers.split("\r\n\r\n")[0..-2].map{ |h| Response.new(:response_headers => h) } end |
#response_body ⇒ String Also known as: body
Return the http response body.
36 37 38 |
# File 'lib/typhoeus/response/informations.rb', line 36 def response_body [:response_body] || [:body] end |
#response_code ⇒ Integer Also known as: code
Return the last received HTTP, FTP or SMTP response code. The value will be zero if no server response code has been received. Note that a proxy’s CONNECT response should be read with http_connect_code and not this.
60 61 62 |
# File 'lib/typhoeus/response/informations.rb', line 60 def response_code ([:response_code] || [:code]).to_i end |
#response_headers ⇒ String
Return the http response headers.
47 48 49 |
# File 'lib/typhoeus/response/informations.rb', line 47 def response_headers [:response_headers] end |
#return_code ⇒ Symbol
Return libcurls return value.
14 15 16 |
# File 'lib/typhoeus/response/informations.rb', line 14 def return_code [:return_code] end |
#return_message ⇒ String
Returns a string describing the return.
26 27 28 |
# File 'lib/typhoeus/response/informations.rb', line 26 def Ethon::Curl.easy_strerror(return_code) end |
#starttransfer_time ⇒ Float Also known as: start_transfer_time
Return the time, in seconds, it took from the start until the first byte is received by libcurl. This includes pretransfer time and also the time the server needs to calculate the result.
99 100 101 |
# File 'lib/typhoeus/response/informations.rb', line 99 def starttransfer_time [:starttransfer_time] || [:start_transfer_time] end |
#total_time ⇒ Float Also known as: time
Return the total time in seconds for the previous transfer, including name resolving, TCP connect etc.
85 86 87 |
# File 'lib/typhoeus/response/informations.rb', line 85 def total_time [:total_time] || [:time] end |