ssl-test 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e444097317630bf487a1e1c4c55baa00de963656
4
- data.tar.gz: e82c53db8ae5371c3b6a77b5d7ac7b04064c09a4
3
+ metadata.gz: 11a0ae9638ae444932d7eef5c49873e276056235
4
+ data.tar.gz: 3c9bec83c428f62c6f0e84559b4daf5687d4682e
5
5
  SHA512:
6
- metadata.gz: da985b40c54ed631ddcc262b376b478660e2a294d66e42d910cfeb1663dc75bfd4ec491c572f2d04646738741607ad788eedf65872d084ef32a46dcb8c1c6b62
7
- data.tar.gz: 40831c9f53c00a65f3f76866f8b4cf967faf3b1a289441094187dacdd948398733fa1665671c34e04e802b4d4e28dcc420a08b1840770827ce4307279e2cdc05
6
+ metadata.gz: ea7b409ae5b9a83bf1ddfb3cfc844a4d8dd55d2aabbbf943c1f924e868b31ddb8b5aef0ecb6b2875652da476b50149939076f574ca3400ca9251901c2eb6ab56
7
+ data.tar.gz: dac29c015557a0ecc1470487d441962f2d4fbb6b8b1e458c931bf12b6ff2c2c42fc87070414a6b365febb7d0757808b712243c21f2f652fcc1a1042cfe3c0735
@@ -1,7 +1,7 @@
1
1
  require "net/https"
2
2
 
3
3
  module SSLTest
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
 
6
6
  def self.test url, open_timeout: 5, read_timeout: 5
7
7
  uri = URI.parse(url)
@@ -19,9 +19,8 @@ module SSLTest
19
19
  verify_ok
20
20
  }
21
21
 
22
- req = Net::HTTP::Head.new('/')
23
22
  begin
24
- res = http.start { http.request(req) }
23
+ res = http.start { }
25
24
  return [true, nil, cert]
26
25
  rescue OpenSSL::SSL::SSLError => e
27
26
  error = e.message
@@ -6,43 +6,50 @@ describe SSLTest do
6
6
  describe '.test' do
7
7
  it "returns no error on valid SNI website" do
8
8
  valid, error, cert = SSLTest.test("https://www.mycs.com")
9
+ error.must_be_nil
9
10
  valid.must_equal true
11
+ cert.must_be_instance_of OpenSSL::X509::Certificate
12
+ end
13
+
14
+ it "works with websites blocking http requests" do
15
+ valid, error, cert = SSLTest.test("https://obyava.ua")
10
16
  error.must_be_nil
17
+ valid.must_equal true
11
18
  cert.must_be_instance_of OpenSSL::X509::Certificate
12
19
  end
13
20
 
14
21
  it "returns error on self signed certificate" do
15
22
  valid, error, cert = SSLTest.test("https://kernelcoffee.org")
16
- valid.must_equal false
17
23
  error.must_equal "error code 18: self signed certificate"
24
+ valid.must_equal false
18
25
  cert.must_be_instance_of OpenSSL::X509::Certificate
19
26
  end
20
27
 
21
28
  it "returns error on invalid host" do
22
- valid, error, cert = SSLTest.test("https://staging.updown.io")
29
+ valid, error, cert = SSLTest.test("https://web1.updn.io")
30
+ error.must_equal 'hostname "web1.updn.io" does not match the server certificate'
23
31
  valid.must_equal false
24
- error.must_equal 'hostname "staging.updown.io" does not match the server certificate'
25
32
  cert.must_be_instance_of OpenSSL::X509::Certificate
26
33
  end
27
34
 
28
35
  it "returns error on expired cert" do
29
36
  valid, error, cert = SSLTest.test("https://testssl-expire.disig.sk")
30
- valid.must_equal false
31
37
  error.must_equal "error code 10: certificate has expired"
38
+ valid.must_equal false
32
39
  cert.must_be_instance_of OpenSSL::X509::Certificate
33
40
  end
34
41
 
35
42
  it "returns undetermined state on unhandled error" do
36
43
  valid, error, cert = SSLTest.test("https://pijoinlrfgind.com")
44
+ error.must_equal "SSL certificate test failed: Failed to open TCP connection to pijoinlrfgind.com:443 (getaddrinfo: Name or service not known)"
37
45
  valid.must_be_nil
38
- error.must_equal "SSL certificate test failed: getaddrinfo: Name or service not known"
39
46
  cert.must_be_nil
40
47
  end
41
48
 
42
49
  it "stops on timeouts" do
43
- valid, error, cert = SSLTest.test("https://approachio.com", open_timeout: 1)
50
+ valid, error, cert = SSLTest.test("https://updown.io", open_timeout: 0)
51
+ error.must_equal "SSL certificate test failed: Net::OpenTimeout"
44
52
  valid.must_be_nil
45
- error.must_equal "SSL certificate test failed: execution expired"
46
53
  cert.must_be_nil
47
54
  end
48
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssl-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Jarthon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-01 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.4.5.1
76
+ rubygems_version: 2.5.1
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Test website SSL certificate validity