From 032203d8f005243be5dd5bfd99abd485b68b567f Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Thu, 1 Dec 2016 00:00:36 -0600 Subject: [CompactIndex] Disable when openssl is in fips mode --- lib/bundler/fetcher/compact_index.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index 5d703a3a78..5cd8a3e8f1 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -3,10 +3,10 @@ require "bundler/fetcher/base" require "bundler/worker" module Bundler + autoload :CompactIndexClient, "bundler/compact_index_client" + class Fetcher class CompactIndex < Base - require "bundler/compact_index_client" - def self.compact_index_request(method_name) method = instance_method(method_name) undef_method(method_name) @@ -61,6 +61,7 @@ module Bundler compact_index_request :fetch_spec def available? + return nil unless md5_available? user_home = Bundler.user_home return nil unless user_home.directory? && user_home.writable? # Read info file checksums out of /versions, so we can know if gems are up to date @@ -119,6 +120,17 @@ module Bundler Net::HTTPNotModified.new(nil, nil, nil) end end + + def md5_available? + begin + require "openssl" + return false if OpenSSL::OPENSSL_FIPS + rescue LoadError + nil + end + + true + end end end end -- cgit v1.2.1