open_uri_w_redirect_to_https 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +9 -5
- data/Rakefile +1 -1
- data/lib/open_uri_w_redirect_to_https.rb +5 -5
- data/lib/open_uri_w_redirect_to_https/version.rb +2 -2
- 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: e8d9aab07af1e96065042f7cad95e54c8e558a0c
|
4
|
+
data.tar.gz: 09669f227446ee7eb16bbc0e7656adbb93200875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41b6976010fbdf9275278991c59ebb2f7013217467ddf6dfcbb768f272080be3f20d4d902a71aa4a955f046602a766b2d46fbd84c4e5c1ec7c058ef512764ad6
|
7
|
+
data.tar.gz: 688ad496a23ce3246822fc10d0641d18af188f3530ece46f8222f54e2cfb066943138d8bd11a09afb9ef5329d50d26fcbdbfc7d30037b49f25caccfcba6f4adc
|
data/README.md
CHANGED
@@ -2,14 +2,15 @@
|
|
2
2
|
|
3
3
|
File : README.md
|
4
4
|
Maintainer : Felix C. Stegerman <flx@obfusk.net>
|
5
|
-
Date : 2014-11-
|
5
|
+
Date : 2014-11-26
|
6
6
|
|
7
7
|
Copyright : Copyright (C) 2014 Felix C. Stegerman
|
8
|
-
Version : v0.1.
|
8
|
+
Version : v0.1.3
|
9
9
|
|
10
10
|
[]: }}}1
|
11
11
|
|
12
12
|
[](https://rubygems.org/gems/open_uri_w_redirect_to_https)
|
13
|
+
[](https://travis-ci.org/obfusk/open_uri_w_redirect_to_https)
|
13
14
|
|
14
15
|
## Description
|
15
16
|
|
@@ -77,11 +78,13 @@ gem install open_uri_w_redirect_to_https
|
|
77
78
|
Monkey-patching is not a very robust way to fix bugs. Use at your
|
78
79
|
own risk.
|
79
80
|
|
80
|
-
Q:
|
81
|
+
Q: Why should I prefer this gem to [open_uri_redirections]
|
81
82
|
(https://github.com/jaimeiniesta/open_uri_redirections)?
|
82
83
|
<br/>
|
83
|
-
A:
|
84
|
-
free to choose either
|
84
|
+
A: Now that open_uri_redirections (>= 0.2.0) is thread-safe, feel
|
85
|
+
free to choose either based on your needs. This gem supports global
|
86
|
+
and dynamic defaults, wherease open_uri_redirections supports HTTPS
|
87
|
+
to HTTP (unsafe) redirects.
|
85
88
|
|
86
89
|
NB: this gem internally uses thread-local variables like
|
87
90
|
`Thread.current[:__open_uri_w_redirect_to_https__]`.
|
@@ -97,6 +100,7 @@ rake docs
|
|
97
100
|
## TODO
|
98
101
|
|
99
102
|
* specs: (can we) test `redirect_to_https=true` w/ threads?
|
103
|
+
* thread-safe spec: (can we) make it no longer brittle?
|
100
104
|
|
101
105
|
## License
|
102
106
|
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# File : open_uri_w_redirect_to_https.rb
|
4
4
|
# Maintainer : Felix C. Stegerman <flx@obfusk.net>
|
5
|
-
# Date : 2014-11-
|
5
|
+
# Date : 2014-11-26
|
6
6
|
#
|
7
7
|
# Copyright : Copyright (C) 2014 Felix C. Stegerman
|
8
8
|
# Licence : MIT
|
@@ -60,8 +60,6 @@ module OpenURI
|
|
60
60
|
def redirectable?(uri1, uri2)
|
61
61
|
if redirect_to_https? == :always ||
|
62
62
|
Thread.current[:__open_uri_w_redirect_to_https__]
|
63
|
-
# clear to prevent leaking (e.g. to block)
|
64
|
-
Thread.current[:__open_uri_w_redirect_to_https__] = nil
|
65
63
|
redirectable_w_redirect_to_https? uri1, uri2
|
66
64
|
else
|
67
65
|
redirectable_orig? uri1, uri2
|
@@ -82,10 +80,12 @@ module OpenURI
|
|
82
80
|
r = (o = rest.find { |x| Hash === x }) && o.delete(:redirect_to_https)
|
83
81
|
Thread.current[:__open_uri_w_redirect_to_https__] = \
|
84
82
|
r.nil? ? redirect_to_https? : r
|
83
|
+
b2 = -> io {
|
84
|
+
Thread.current[:__open_uri_w_redirect_to_https__] = nil; b[io]
|
85
|
+
}
|
85
86
|
begin
|
86
|
-
open_uri_orig name, *rest, &b
|
87
|
+
open_uri_orig name, *rest, &(b ? b2 : nil)
|
87
88
|
ensure
|
88
|
-
# clear (redirectable? might not be called due to an exception)
|
89
89
|
Thread.current[:__open_uri_w_redirect_to_https__] = nil
|
90
90
|
end
|
91
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_uri_w_redirect_to_https
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix C. Stegerman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fakeweb
|