# File lib/typhoeus/response/informations.rb, line 198 def primary_ip options[:primary_ip] end
module Typhoeus::Response::Informations
This module contains logic about informations on a response.
Public Instance Methods
Source
# File lib/typhoeus/response/informations.rb, line 124 def appconnect_time options[:appconnect_time] || options[:app_connect_time] end
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.
@example Get appconnect_time.
response.appconnect_time
@return [ Float ] The appconnect_time.
Source
# File lib/typhoeus/response/informations.rb, line 151 def connect_time options[:connect_time] end
Return the time, in seconds, it took from the start until the connect to the remote host (or proxy) was completed.
@example Get connect_time.
response.connect_time
@return [ Float ] The connect_time.
Source
# File lib/typhoeus/response/informations.rb, line 274 def debug_info options[:debug_info] end
Source
# File lib/typhoeus/response/informations.rb, line 186 def effective_url options[:effective_url] end
Return the last used effective url.
@example Get effective_url.
response.effective_url
@return [ String ] The effective_url.
Source
# File lib/typhoeus/response/informations.rb, line 284 def headers return Header.new(options[:headers]) if mock? && options[:headers] return nil if response_headers.nil? && !defined?(@headers) @headers ||= Header.new(response_headers.split("\r\n\r\n").last) end
Returns the response header.
@example Return headers.
response.headers
@return [ Typhoeus::Header ] The response header.
Source
# File lib/typhoeus/response/informations.rb, line 82 def httpauth_avail options[:httpauth_avail] end
Return the available http auth methods. Bitmask indicating the authentication method(s) available.
@example Get httpauth_avail.
response.httpauth_avail
@return [ Integer ] The bitmask.
Source
# File lib/typhoeus/response/informations.rb, line 162 def namelookup_time options[:namelookup_time] || options[:name_lookup_time] end
Return the time, in seconds, it took from the start until the name resolving was completed.
@example Get namelookup_time.
response.namelookup_time
@return [ Float ] The namelookup_time.
Source
# File lib/typhoeus/response/informations.rb, line 140 def pretransfer_time options[:pretransfer_time] end
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.
@example Get pretransfer_time.
response.pretransfer_time
@return [ Float ] The pretransfer_time.
Source
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.
@example Get primary_ip.
response.primary_ip
@return [ String ] The primary_ip.
Source
# File lib/typhoeus/response/informations.rb, line 209 def redirect_count options[:redirect_count] end
Return the total number of redirections that were actually followed
@example Get redirect_count.
response.redirect_count
@return [ Integer ] The redirect_count.
Source
# File lib/typhoeus/response/informations.rb, line 176 def redirect_time options[:redirect_time] end
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.
@example Get redirect_time.
response.redirect_time
@return [ Float ] The redirect_time.
Source
# File lib/typhoeus/response/informations.rb, line 219 def redirect_url options[:redirect_url] end
Return the URL a redirect would take you to, had you enabled redirects.
@example Get redirect_url.
response.redirect_url
@return [ String ] The redirect_url.
Source
# File lib/typhoeus/response/informations.rb, line 298 def redirections return [] unless response_headers response_headers.split("\r\n\r\n")[0..-2].map{ |h| Response.new(:response_headers => h) } end
Return all redirections in between as multiple responses with header.
@example Return redirections.
response.redirections
@return [ Array<Typhoeus::Response> ] The redirections
Source
# File lib/typhoeus/response/informations.rb, line 223 def request_size options[:request_size] end
Source
# File lib/typhoeus/response/informations.rb, line 36 def response_body options[:response_body] || options[:body] end
Return the http response body.
@example Get response_body.
response.response_body
@return [ String ] The response_body.
Source
# File lib/typhoeus/response/informations.rb, line 69 def response_code (options[:response_code] || options[:code]).to_i end
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.
@example Get response_code.
response.response_code
@return [ Integer ] The response_code.
Source
# File lib/typhoeus/response/informations.rb, line 47 def response_headers return options[:response_headers] if options[:response_headers] if mock? && h = options[:headers] status_code = return_code || "200" reason_phrase = status_code == "200" ? "OK" : "Mock Reason Phrase" status_line = "HTTP/1.1 #{status_code} #{reason_phrase}" actual_headers = h.map{ |k,v| [k, v.respond_to?(:join) ? v.join(',') : v] }. map{ |e| "#{e.first}: #{e.last}" } [status_line, *actual_headers].join("\r\n") end end
Return the http response headers.
@example Get response_headers.
response.response_headers
@return [ String ] The response_headers.
Source
# File lib/typhoeus/response/informations.rb, line 14 def return_code options[:return_code] end
Return libcurls return value.
@example Get return_code.
response.return_code
@return [ Symbol ] The return_code.
Source
# File lib/typhoeus/response/informations.rb, line 26 def return_message Ethon::Curl.easy_strerror(return_code) if return_code end
Returns a string describing the return.
@example Get return_message.
response.return_message
@return [ String ] The return_message.
@since 0.6.2
Source
# File lib/typhoeus/response/informations.rb, line 248 def size_download options[:size_download] end
Return the bytes, the total amount of bytes that were downloaded. The amount is only for the latest transfer and will be reset again for each new transfer. This counts actual payload data, what’s also commonly called body. All meta and header data are excluded and will not be counted in this number.
@example Get size_download
response.size_download
@return [ Float ] The size_download.
Source
# File lib/typhoeus/response/informations.rb, line 233 def size_upload options[:size_upload] end
Return the bytes, the total amount of bytes that were uploaded
@example Get size_upload.
response.size_upload
@return [ Float ] The size_upload.
Source
# File lib/typhoeus/response/informations.rb, line 270 def speed_download options[:speed_download] end
Return the bytes/second, the average download speed that curl measured for the complete download
@example Get speed_download.
response.speed_download
@return [ Float ] The speed_download.
Source
# File lib/typhoeus/response/informations.rb, line 259 def speed_upload options[:speed_upload] end
Return the bytes/second, the average upload speed that curl measured for the complete upload
@example Get speed_upload.
response.speed_upload
@return [ Float ] The speed_upload.
Source
# File lib/typhoeus/response/informations.rb, line 108 def starttransfer_time options[:starttransfer_time] || options[:start_transfer_time] end
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.
@example Get starttransfer_time.
response.starttransfer_time
@return [ Float ] The starttransfer_time.
Source
# File lib/typhoeus/response/informations.rb, line 94 def total_time options[:total_time] || options[:time] end
Return the total time in seconds for the previous transfer, including name resolving, TCP connect etc.
@example Get total_time.
response.total_time
@return [ Float ] The total_time.