webcache 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webcache/version.rb +1 -1
- data/lib/webcache/web_cache.rb +13 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a1fe3dab9b833c6baf0bc0aa11880c9f48ae0fe
|
4
|
+
data.tar.gz: 56dd46eff975822c9dc0e99564ecdac7459e9a33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 889ffdc9b048385dac87bb1fc57ffd209883d3ae208ca6d31c49a3b9f5cb9ee5891cc2d0c46d6da122660e88faa296ae39328e0b74f6599d2179d17b0af6a554
|
7
|
+
data.tar.gz: 16432d187d35b3ecda606aec1859f0bcf332dc3482d1084190bcbbeb731abaa45c636ca9b9fde3ceac17079819660bca0f2d7a2dc414dd145c90c639b12035fa
|
data/lib/webcache/version.rb
CHANGED
data/lib/webcache/web_cache.rb
CHANGED
@@ -63,7 +63,7 @@ class WebCache
|
|
63
63
|
|
64
64
|
def http_get(url)
|
65
65
|
begin
|
66
|
-
Response.new open(url,
|
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.
|
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-
|
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
|