Module: Typhoeus::EasyFu::SSL

Included in:
Typhoeus::Easy
Defined in:
lib/typhoeus/easy/ssl.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/typhoeus/easy/ssl.rb', line 4

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#disable_ssl_host_verificationObject



29
30
31
# File 'lib/typhoeus/easy/ssl.rb', line 29

def disable_ssl_host_verification
  set_option(:verifyhost, 0)
end

#disable_ssl_peer_verificationObject



25
26
27
# File 'lib/typhoeus/easy/ssl.rb', line 25

def disable_ssl_peer_verification
  set_option(:verifypeer, 0)
end

#ssl_cacert=(cacert) ⇒ Object

Set SSL CACERT “ File holding one or more certificates to verify the peer with. ”



70
71
72
# File 'lib/typhoeus/easy/ssl.rb', line 70

def ssl_cacert=(cacert)
  set_option(:cainfo, cacert)
end

#ssl_capath=(capath) ⇒ Object

Set CAPATH “ directory holding multiple CA certificates to verify the peer with. The certificate directory must be prepared using the openssl c_rehash utility. ”



77
78
79
# File 'lib/typhoeus/easy/ssl.rb', line 77

def ssl_capath=(capath)
  set_option(:capath, capath)
end

#ssl_cert=(cert) ⇒ Object

Set SSL certificate “ The string should be the file name of your certificate. ” The default format is “PEM” and can be changed with ssl_cert_type=



36
37
38
# File 'lib/typhoeus/easy/ssl.rb', line 36

def ssl_cert=(cert)
  set_option(:sslcert, cert)
end

#ssl_cert_type=(cert_type) ⇒ Object

Set SSL certificate type “ The string should be the format of your certificate. Supported formats are ”PEM“ and ”DER“ ”



42
43
44
45
# File 'lib/typhoeus/easy/ssl.rb', line 42

def ssl_cert_type=(cert_type)
  raise "Invalid ssl cert type : '#{cert_type}'..." if cert_type and !%w(PEM DER p12).include?(cert_type)
  set_option(:sslcerttype, cert_type)
end

#ssl_key=(key) ⇒ Object

Set SSL Key file “ The string should be the file name of your private key. ” The default format is “PEM” and can be changed with ssl_key_type=



51
52
53
# File 'lib/typhoeus/easy/ssl.rb', line 51

def ssl_key=(key)
  set_option(:sslkey, key)
end

#ssl_key_password=(key_password) ⇒ Object



63
64
65
# File 'lib/typhoeus/easy/ssl.rb', line 63

def ssl_key_password=(key_password)
  set_option(:keypasswd, key_password)
end

#ssl_key_type=(key_type) ⇒ Object

Set SSL Key type “ The string should be the format of your private key. Supported formats are ”PEM“, ”DER“ and ”ENG“. ”



58
59
60
61
# File 'lib/typhoeus/easy/ssl.rb', line 58

def ssl_key_type=(key_type)
  raise "Invalid ssl key type : '#{key_type}'..." if key_type and !%w(PEM DER ENG).include?(key_type)
  set_option(:sslkeytype, key_type)
end

#ssl_versionObject



14
15
16
# File 'lib/typhoeus/easy/ssl.rb', line 14

def ssl_version
  @ssl_version
end

#ssl_version=(version) ⇒ Object



18
19
20
21
22
23
# File 'lib/typhoeus/easy/ssl.rb', line 18

def ssl_version=(version)
  raise "Invalid SSL version: '#{version}' supplied! Please supply one as listed in Typhoeus::Easy::SSL_VERSIONS" unless self.class.valid_ssl_version(version)
  @ssl_version = version

  set_option(:sslversion, Typhoeus::Easy::SSL_VERSIONS[version])
end