skylight 0.1.4 → 0.1.5.alpha1

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ module Skylight
14
14
  AUTHORIZATION = 'authorization'.freeze
15
15
  DEFLATE = 'deflate'.freeze
16
16
  GZIP = 'gzip'.freeze
17
+ DEFAULT_CA_FILE = File.expand_path('../../data/cacert.pem', __FILE__)
17
18
 
18
19
  include Logging
19
20
 
@@ -28,6 +29,21 @@ module Skylight
28
29
  @authentication = config[:'authentication']
29
30
  end
30
31
 
32
+ def self.detect_ca_cert_file!
33
+ @ca_cert_file = false
34
+ if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
35
+ if OpenSSL::X509::DEFAULT_CERT_FILE
36
+ @ca_cert_file = File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)
37
+ end
38
+ end
39
+ end
40
+
41
+ detect_ca_cert_file!
42
+
43
+ def self.ca_cert_file?
44
+ @ca_cert_file
45
+ end
46
+
31
47
  def get(endpoint, hdrs = {})
32
48
  request = build_request(Net::HTTP::Get, endpoint, hdrs)
33
49
  execute(request)
@@ -81,6 +97,7 @@ module Skylight
81
97
 
82
98
  if @ssl
83
99
  http.use_ssl = true
100
+ http.ca_file = DEFAULT_CERT_FILE unless HTTP.ca_cert_file?
84
101
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
85
102
  end
86
103
 
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5.alpha1'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
@@ -51,6 +51,7 @@ files:
51
51
  - lib/skylight/cli.rb
52
52
  - lib/skylight/compat.rb
53
53
  - lib/skylight/config.rb
54
+ - lib/skylight/data/cacert.pem
54
55
  - lib/skylight/gc.rb
55
56
  - lib/skylight/instrumenter.rb
56
57
  - lib/skylight/messages.rb
@@ -156,9 +157,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
157
  version: 1.9.2
157
158
  required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  requirements:
159
- - - '>='
160
+ - - '>'
160
161
  - !ruby/object:Gem::Version
161
- version: '0'
162
+ version: 1.3.1
162
163
  requirements: []
163
164
  rubyforge_project:
164
165
  rubygems_version: 2.0.3