/usr/lib/ruby/vendor_ruby/ethon/easy/informations.rb is in ruby-ethon 0.7.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | module Ethon
class Easy
# This module contains the methods to return informations
# from the easy handle. See http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
# for more information.
module Informations
# Holds available informations and their type, which is needed to
# request the informations from libcurl.
AVAILABLE_INFORMATIONS = {
# Return the available HTTP auth methods.
:httpauth_avail => :long,
# Return the total time in seconds for the previous
# transfer, including name resolution, TCP connection, etc.
:total_time => :double,
# Return the time, in seconds, it took from the start
# until the first byte was received by libcurl. This
# includes pre-transfer time and also the time the
# server needs to calculate the result.
:starttransfer_time => :double,
# 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 pre-transfer time can be delayed
# due to waits in line for the pipeline and more.
:appconnect_time => :double,
# Return the time, in seconds, it took from the start
# until the file transfer was 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.
:pretransfer_time => :double,
# Return the time, in seconds, it took from the start
# until the connect to the remote host (or proxy) was completed.
:connect_time => :double,
# Return the time, in seconds, it took from the
# start until the name resolution was completed.
:namelookup_time => :double,
# Return the last used effective url.
:effective_url => :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.
:primary_ip => :string,
# 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.
:response_code => :long,
# Return the total number of redirections that were
# actually followed.
:redirect_count => :long
}
AVAILABLE_INFORMATIONS.each do |name, type|
eval %Q|def #{name}; Curl.send(:get_info_#{type}, :#{name}, handle); end|
end
# Returns this curl version supports zlib.
#
# @example Return wether zlib is supported.
# easy.supports_zlib?
#
# @return [ Boolean ] True if supported, else false.
def supports_zlib?
!!(Curl.version.match(/zlib/))
end
end
end
end
|