berkshelf 2.0.17 → 2.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/berkshelf/community_rest.rb +4 -0
- data/lib/berkshelf/core_ext/openuri.rb +36 -0
- data/lib/berkshelf/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c1cb4c285df553eb0ef7571a584ab308d35f278
|
4
|
+
data.tar.gz: 66452c03b102b78cdf440841f99a644307677a3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85bdfe1f3dd22b69af3343868ad5ae07ad17d457daf94cea5c267fa47dd3273f232efcd80ad358490b6bed94f6981f5453d459e7604121b1ef271aa4e12aaf91
|
7
|
+
data.tar.gz: 5525092c4221b4b32452cb214e50cbe7e6f0bc7e8b012a0403dbdf7875635797b707f99ea41f0d12e018f07b08d8b91d60698d71704bfe0565ada1e122e5df08
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/lib/berkshelf/version.rb
CHANGED
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.
|
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-
|
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
|