berkshelf 2.0.17 → 2.0.18

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: 035b73ca9d93250f44face7e14fa87e16f37a721
4
- data.tar.gz: c8a993b85d430f63c52ed12c9ac9f822ac09e5cf
3
+ metadata.gz: 4c1cb4c285df553eb0ef7571a584ab308d35f278
4
+ data.tar.gz: 66452c03b102b78cdf440841f99a644307677a3f
5
5
  SHA512:
6
- metadata.gz: 5d5a6e17179a2583624cd8e4bb36a71989a978826df47f392173cf41d59314d5a0a24e49491a1ab3a37731b6badc1f820d3e490f0abffe5b3e0ea375fffa1910
7
- data.tar.gz: b3a28330ba65f165f4058af6b2fe4f8eacec5a4bb6519bd2331ef2dcab97d833f4a4e0173392b1bb5aa32476b944cbcd2b217a56d0a52b4d0b1796794479247e
6
+ metadata.gz: 85bdfe1f3dd22b69af3343868ad5ae07ad17d457daf94cea5c267fa47dd3273f232efcd80ad358490b6bed94f6981f5453d459e7604121b1ef271aa4e12aaf91
7
+ data.tar.gz: 5525092c4221b4b32452cb214e50cbe7e6f0bc7e8b012a0403dbdf7875635797b707f99ea41f0d12e018f07b08d8b91d60698d71704bfe0565ada1e122e5df08
@@ -1,3 +1,7 @@
1
+ # 2.0.18
2
+
3
+ * Fix issue with connecting to an HTTPS enabled community site
4
+
1
5
  # 2.0.17
2
6
 
3
7
  * Fix constraint on Hashie
@@ -2,6 +2,8 @@ require 'open-uri'
2
2
  require 'retryable'
3
3
  require 'addressable/uri'
4
4
 
5
+ require_relative 'core_ext/openuri'
6
+
5
7
  module Berkshelf
6
8
  class CommunityREST < Faraday::Connection
7
9
  class << self
@@ -80,6 +82,8 @@ module Berkshelf
80
82
 
81
83
  builder = Faraday::Builder.new do |b|
82
84
  b.response :parse_json
85
+ b.response :follow_redirects
86
+
83
87
  b.request :retry,
84
88
  max: @retries,
85
89
  interval: @retry_interval,
@@ -0,0 +1,36 @@
1
+ #
2
+ # Patch to allow open-uri to follow safe (http to https) and unsafe
3
+ # redirections (https to http).
4
+ #
5
+ # Original gist URL:
6
+ # https://gist.github.com/1271420
7
+ #
8
+ # Relevant issue:
9
+ # http://redmine.ruby-lang.org/issues/3719
10
+ #
11
+ # Source here:
12
+ # https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb
13
+ #
14
+ module OpenURI
15
+ class <<self
16
+ alias_method :open_uri_original, :open_uri
17
+
18
+ def redirectable_safe?(uri1, uri2)
19
+ uri1.scheme.downcase == uri2.scheme.downcase || (uri1.scheme.downcase == "http" && uri2.scheme.downcase == "https")
20
+ end
21
+
22
+ def redirectable_all?(uri1, uri2)
23
+ redirectable_safe?(uri1, uri2) || (uri1.scheme.downcase == "https" && uri2.scheme.downcase == "http")
24
+ end
25
+ end
26
+
27
+ # Patches the original open_uri method to follow all redirects
28
+ def self.open_uri(name, *rest, &block)
29
+ class << self
30
+ remove_method :redirectable?
31
+ alias_method :redirectable?, :redirectable_all?
32
+ end
33
+
34
+ self.open_uri_original(name, *rest, &block)
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "2.0.17"
2
+ VERSION = "2.0.18"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.17
4
+ version: 2.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-06-10 00:00:00.000000000 Z
15
+ date: 2014-07-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -529,6 +529,7 @@ files:
529
529
  - lib/berkshelf/core_ext.rb
530
530
  - lib/berkshelf/core_ext/file.rb
531
531
  - lib/berkshelf/core_ext/file_utils.rb
532
+ - lib/berkshelf/core_ext/openuri.rb
532
533
  - lib/berkshelf/core_ext/pathname.rb
533
534
  - lib/berkshelf/core_ext/rbzip2.rb
534
535
  - lib/berkshelf/core_ext/string.rb