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.
-
#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.
-
#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.
103 104 105 |
# File 'lib/typhoeus/response/informations.rb', line 103 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.
130 131 132 |
# File 'lib/typhoeus/response/informations.rb', line 130 def connect_time [:connect_time] end |
#effective_url ⇒ String
Return the last used effective url.
152 153 154 |
# File 'lib/typhoeus/response/informations.rb', line 152 def effective_url [:effective_url] end |
#headers ⇒ Typhoeus::Header Also known as: headers_hash
Returns the response header.
185 186 187 188 |
# File 'lib/typhoeus/response/informations.rb', line 185 def headers return nil if response_headers.nil? && @headers.nil? @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.
61 62 63 |
# File 'lib/typhoeus/response/informations.rb', line 61 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.
141 142 143 |
# File 'lib/typhoeus/response/informations.rb', line 141 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.
119 120 121 |
# File 'lib/typhoeus/response/informations.rb', line 119 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.
164 165 166 |
# File 'lib/typhoeus/response/informations.rb', line 164 def primary_ip [:primary_ip] end |
#redirect_count ⇒ Integer
Return the total number of redirections that were actually followed
175 176 177 |
# File 'lib/typhoeus/response/informations.rb', line 175 def redirect_count [:redirect_count] end |
#redirections ⇒ Array<Typhoeus::Response>
Return all redirections in between as multiple responses with header.
198 199 200 201 |
# File 'lib/typhoeus/response/informations.rb', line 198 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.
24 25 26 |
# File 'lib/typhoeus/response/informations.rb', line 24 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.
48 49 50 |
# File 'lib/typhoeus/response/informations.rb', line 48 def response_code ([:response_code] || [:code]).to_i end |
#response_headers ⇒ String
Return the http response headers.
35 36 37 |
# File 'lib/typhoeus/response/informations.rb', line 35 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 |
#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.
87 88 89 |
# File 'lib/typhoeus/response/informations.rb', line 87 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.
73 74 75 |
# File 'lib/typhoeus/response/informations.rb', line 73 def total_time [:total_time] || [:time] end |