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.
-
#redirect_time ⇒ Float
Return the time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before the final transaction was started.
-
#redirections ⇒ Array<Typhoeus::Response>
Return all redirections in between as multiple responses with header.
- #request_size ⇒ Object
-
#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 pipelining where the pretransfer time can be delayed due to waits in line for the pipeline and more.
120 121 122 |
# File 'lib/typhoeus/response/informations.rb', line 120 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.
147 148 149 |
# File 'lib/typhoeus/response/informations.rb', line 147 def connect_time [:connect_time] end |
#debug_info ⇒ Object
213 214 215 |
# File 'lib/typhoeus/response/informations.rb', line 213 def debug_info [:debug_info] end |
#effective_url ⇒ String
Return the last used effective url.
182 183 184 |
# File 'lib/typhoeus/response/informations.rb', line 182 def effective_url [:effective_url] end |
#headers ⇒ Typhoeus::Header Also known as: headers_hash
Returns the response header.
223 224 225 226 227 |
# File 'lib/typhoeus/response/informations.rb', line 223 def headers return Header.new([:headers]) if mock? && [:headers] return nil if response_headers.nil? && !defined?(@headers) @headers ||= 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.
78 79 80 |
# File 'lib/typhoeus/response/informations.rb', line 78 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.
158 159 160 |
# File 'lib/typhoeus/response/informations.rb', line 158 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.
136 137 138 |
# File 'lib/typhoeus/response/informations.rb', line 136 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.
194 195 196 |
# File 'lib/typhoeus/response/informations.rb', line 194 def primary_ip [:primary_ip] end |
#redirect_count ⇒ Integer
Return the total number of redirections that were actually followed
205 206 207 |
# File 'lib/typhoeus/response/informations.rb', line 205 def redirect_count [:redirect_count] end |
#redirect_time ⇒ Float
Return the time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete execution time for multiple redirections.
172 173 174 |
# File 'lib/typhoeus/response/informations.rb', line 172 def redirect_time [:redirect_time] end |
#redirections ⇒ Array<Typhoeus::Response>
Return all redirections in between as multiple responses with header.
237 238 239 240 |
# File 'lib/typhoeus/response/informations.rb', line 237 def redirections return [] unless response_headers response_headers.split("\r\n\r\n")[0..-2].map{ |h| Response.new(:response_headers => h) } end |
#request_size ⇒ Object
209 210 211 |
# File 'lib/typhoeus/response/informations.rb', line 209 def request_size [:request_size] 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.
65 66 67 |
# File 'lib/typhoeus/response/informations.rb', line 65 def response_code ([:response_code] || [:code]).to_i end |
#response_headers ⇒ String
Return the http response headers.
47 48 49 50 51 52 53 54 |
# File 'lib/typhoeus/response/informations.rb', line 47 def response_headers return [:response_headers] if [:response_headers] if mock? && h = [:headers] h.map{ |k,v| [k, v.respond_to?(:join) ? v.join : v] }. map{ |e| "#{e.first}: #{e.last}" }. join("\r\n") end 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) if 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.
104 105 106 |
# File 'lib/typhoeus/response/informations.rb', line 104 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.
90 91 92 |
# File 'lib/typhoeus/response/informations.rb', line 90 def total_time [:total_time] || [:time] end |