dangerous_open_uri 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/dangerous_open_uri/version.rb +1 -1
- data/lib/dangerous_open_uri.rb +6 -4
- data/spec/lib/dangerous_open_uri_spec.rb +11 -0
- 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: abb4db861c1b5ab25d7f11bd1bb2f544b8e9bada
|
4
|
+
data.tar.gz: 4155750ebc90ebd926a93f3e5dff9d78b16b578a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c65d12e43e7a4a88411a945f7bf506f0ee84ead54357fed556d16345538a8e782a88d25bd2a8807e11c5de4a2fe789501887d6fb2ab8999091c99157452dabc
|
7
|
+
data.tar.gz: ad36b7cc1d7bef21b6f9987a25f868b0227dcd9172e866c8f52e5ece16857cd0dcacfcd6bb1406f7e5b6e06fa58d38cc2db86ac944130994cd5605ffdafa1245
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ require 'dangerous_open_uri'
|
|
39
39
|
open('http://user:pass@example.co.jp/secret/page').read
|
40
40
|
#=> Enable to read `http://user:pass@example.co.jp/secret/page` sources
|
41
41
|
|
42
|
-
open('http://example.co.jp/index.html, proxy: 'http://user:pass@proxy.example.com')
|
42
|
+
open('http://example.co.jp/index.html', proxy: 'http://user:pass@proxy.example.com')
|
43
43
|
#=> Proxy basic authentication uses `user` and `pass`
|
44
44
|
```
|
45
45
|
|
data/lib/dangerous_open_uri.rb
CHANGED
@@ -16,11 +16,13 @@ module OpenURI
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
_target = target.dup
|
20
|
+
|
21
|
+
if _target.userinfo
|
22
|
+
options[:http_basic_authentication] = [_target.user, _target.password]
|
23
|
+
_target.userinfo = ""
|
22
24
|
end
|
23
25
|
|
24
|
-
original_open_http(buf,
|
26
|
+
original_open_http(buf, _target, proxy, options)
|
25
27
|
end
|
26
28
|
end
|
@@ -68,6 +68,17 @@ describe OpenURI do
|
|
68
68
|
).to eq('aaa')
|
69
69
|
end
|
70
70
|
|
71
|
+
it 'given URI::Generic does not change the argument object' do
|
72
|
+
uri = URI.parse('http://user:pass@www.example.com/secret/page.html')
|
73
|
+
|
74
|
+
stub_request(:any, 'http://user:pass@www.example.com/secret/page.html')
|
75
|
+
.to_return(body: 'aaa')
|
76
|
+
|
77
|
+
open(uri)
|
78
|
+
|
79
|
+
expect(uri).to eq(URI.parse('http://user:pass@www.example.com/secret/page.html'))
|
80
|
+
end
|
81
|
+
|
71
82
|
describe 'given proxy' do
|
72
83
|
it 'original_open_http receives the correct proxy arguments' do
|
73
84
|
uri = URI.parse('http://www.example.com/secret/page.html')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dangerous_open_uri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mgi166
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|