summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrey Baker <greysteil@gmail.com>2017-09-05 14:38:36 +0100
committerGrey Baker <greysteil@gmail.com>2017-09-05 14:38:36 +0100
commitdda270ec5b0aa6d55e02efe5e305110df95eca06 (patch)
treefc5bd6c97c4ba78b8184641edda6bfc3fdb401a6
parentd5592453ba6c60809fe827d329f430b9eab4634a (diff)
downloadbundler-dda270ec5b0aa6d55e02efe5e305110df95eca06.tar.gz
Handle missing socket when warning about OpenSSL version
-rw-r--r--lib/bundler/vendored_persistent.rb1
-rw-r--r--spec/bundler/vendored_persistent_spec.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/bundler/vendored_persistent.rb b/lib/bundler/vendored_persistent.rb
index 190fed58e5..de9c42fcc1 100644
--- a/lib/bundler/vendored_persistent.rb
+++ b/lib/bundler/vendored_persistent.rb
@@ -30,6 +30,7 @@ module Bundler
return unless (uri.host || "").end_with?("rubygems.org")
socket = connection.instance_variable_get(:@socket)
+ return unless socket
socket_io = socket.io
return unless socket_io.respond_to?(:ssl_version)
ssl_version = socket_io.ssl_version
diff --git a/spec/bundler/vendored_persistent_spec.rb b/spec/bundler/vendored_persistent_spec.rb
index b1b091f2c5..338431c4a6 100644
--- a/spec/bundler/vendored_persistent_spec.rb
+++ b/spec/bundler/vendored_persistent_spec.rb
@@ -45,6 +45,12 @@ RSpec.describe Bundler::PersistentHTTP do
include_examples "does not warn"
end
+ context "without a socket" do
+ let(:socket) { nil }
+
+ include_examples "does not warn"
+ end
+
context "with a different TLD" do
let(:uri) { "https://foo.bar" }
include_examples "does not warn"