webcache 0.2.1 → 0.2.2

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: dbe43170c60ccf3d69b5fc8a1cafa4fe7213e5b6
4
- data.tar.gz: 5c19b50506cd4a744b7717afaf1d312a8136aef7
3
+ metadata.gz: 9a1fe3dab9b833c6baf0bc0aa11880c9f48ae0fe
4
+ data.tar.gz: 56dd46eff975822c9dc0e99564ecdac7459e9a33
5
5
  SHA512:
6
- metadata.gz: 9b256d0acaadbf5d8b1a2ba8686dea9d82ec8ff76358345fe488ad82fd6ab141d1237b511ceac7e0525e93a031af789d8c3dcde164ede81cb28af4c8f1bc989d
7
- data.tar.gz: 330a7a0225aff2666c27db9445c367d0ddd34889878dfd746b2eb0e5d0013aad0425863340497b87e038b807cea685c09b70cc6e9dea943a7b40fa4dbba0e2af
6
+ metadata.gz: 889ffdc9b048385dac87bb1fc57ffd209883d3ae208ca6d31c49a3b9f5cb9ee5891cc2d0c46d6da122660e88faa296ae39328e0b74f6599d2179d17b0af6a554
7
+ data.tar.gz: 16432d187d35b3ecda606aec1859f0bcf332dc3482d1084190bcbbeb731abaa45c636ca9b9fde3ceac17079819660bca0f2d7a2dc414dd145c90c639b12035fa
@@ -1,3 +1,3 @@
1
1
  class WebCache
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -63,7 +63,7 @@ class WebCache
63
63
 
64
64
  def http_get(url)
65
65
  begin
66
- Response.new open(url, allow_redirections: :all)
66
+ Response.new open(url, open_uri_options)
67
67
  rescue => e
68
68
  Response.new error: e.message, base_uri: url, content: e.message
69
69
  end
@@ -72,4 +72,16 @@ class WebCache
72
72
  def old?(path)
73
73
  life > 0 and File.exist?(path) and Time.new - File.mtime(path) >= life
74
74
  end
75
+
76
+ # Use a less strict URL retrieval:
77
+ # 1. Allow http to/from https redirects (through the use of the
78
+ # open_uri_redirections gem)
79
+ # 2. Disable SSL verification, otherwise, some https sites that show
80
+ # properly in the browser, will return an error.
81
+ def open_uri_options
82
+ {
83
+ allow_redirections: :all,
84
+ ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE
85
+ }
86
+ end
75
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webcache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-17 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open_uri_redirections