rack-proxy 0.7.6 → 0.7.8
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/Gemfile.lock +9 -8
- data/README.md +2 -2
- data/lib/rack/proxy.rb +1 -2
- data/lib/rack_proxy_examples/example_service_proxy.rb +1 -1
- data/rack-proxy.gemspec +1 -0
- data/test/http_streaming_response_test.rb +5 -3
- data/test/rack_proxy_test.rb +7 -6
- metadata +4 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f1a4b368973c939e40b8f152e168081d55105a2a447541d2ea8a2b9157aaf65
|
|
4
|
+
data.tar.gz: f24595aef9a2aeaa8354f0377d1f28508f248039a59a880f1da674891e6236af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5fa9ddee2ccb22bdeb051dc11bf09aa158a93ebf3d95156ae43bea1fb933527e9bb31cf60910d063017c229e599aaa20d7452c792bc2b7f0303da8f20c579bbc
|
|
7
|
+
data.tar.gz: 8d95e69cfb5e09c3e4103653bd739e96b37430f7e92720c668a8f396458f07fbeec9e01b25a6b4cff8128ad958f64d3adc01f748a3836f2ea768f8cc60d74244
|
data/Gemfile.lock
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rack-proxy (0.7.
|
|
4
|
+
rack-proxy (0.7.8)
|
|
5
5
|
rack
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
power_assert (2.0.
|
|
11
|
-
rack (
|
|
12
|
-
rack-test (
|
|
13
|
-
rack (>= 1.
|
|
10
|
+
power_assert (2.0.3)
|
|
11
|
+
rack (3.0.9.1)
|
|
12
|
+
rack-test (2.1.0)
|
|
13
|
+
rack (>= 1.3)
|
|
14
14
|
rake (13.0.6)
|
|
15
|
-
test-unit (3.
|
|
15
|
+
test-unit (3.6.1)
|
|
16
16
|
power_assert
|
|
17
17
|
|
|
18
18
|
PLATFORMS
|
|
19
|
-
|
|
19
|
+
arm64-darwin-22
|
|
20
|
+
x86_64-linux
|
|
20
21
|
|
|
21
22
|
DEPENDENCIES
|
|
22
23
|
rack-proxy!
|
|
@@ -25,4 +26,4 @@ DEPENDENCIES
|
|
|
25
26
|
test-unit
|
|
26
27
|
|
|
27
28
|
BUNDLED WITH
|
|
28
|
-
2.
|
|
29
|
+
2.4.17
|
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Installation
|
|
|
6
6
|
Add the following to your `Gemfile`:
|
|
7
7
|
|
|
8
8
|
```
|
|
9
|
-
gem 'rack-proxy', '~> 0.7.
|
|
9
|
+
gem 'rack-proxy', '~> 0.7.7'
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Or install:
|
|
@@ -136,7 +136,7 @@ Test with `require 'rack_proxy_examples/example_service_proxy'`
|
|
|
136
136
|
# 1. rails new test_app
|
|
137
137
|
# 2. cd test_app
|
|
138
138
|
# 3. install Rack-Proxy in `Gemfile`
|
|
139
|
-
# a. `gem 'rack-proxy', '~> 0.7.
|
|
139
|
+
# a. `gem 'rack-proxy', '~> 0.7.7'`
|
|
140
140
|
# 4. install gem: `bundle install`
|
|
141
141
|
# 5. create `config/initializers/proxy.rb` adding this line `require 'rack_proxy_examples/example_service_proxy'`
|
|
142
142
|
# 6. run: `SERVICE_URL=http://guides.rubyonrails.org rails server`
|
data/lib/rack/proxy.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Rack
|
|
|
5
5
|
|
|
6
6
|
# Subclass and bring your own #rewrite_request and #rewrite_response
|
|
7
7
|
class Proxy
|
|
8
|
-
VERSION = "0.7.
|
|
8
|
+
VERSION = "0.7.8".freeze
|
|
9
9
|
|
|
10
10
|
HOP_BY_HOP_HEADERS = {
|
|
11
11
|
'connection' => true,
|
|
@@ -127,7 +127,6 @@ module Rack
|
|
|
127
127
|
|
|
128
128
|
backend = env.delete('rack.backend') || @backend || source_request
|
|
129
129
|
use_ssl = backend.scheme == "https" || @cert
|
|
130
|
-
ssl_verify_none = (env.delete('rack.ssl_verify_none') || @ssl_verify_none) == true
|
|
131
130
|
read_timeout = env.delete('http.read_timeout') || @read_timeout
|
|
132
131
|
|
|
133
132
|
# Create the response
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# 1. rails new test_app
|
|
6
6
|
# 2. cd test_app
|
|
7
7
|
# 3. install Rack-Proxy in `Gemfile`
|
|
8
|
-
# a. `gem 'rack-proxy', '~> 0.7.
|
|
8
|
+
# a. `gem 'rack-proxy', '~> 0.7.7'`
|
|
9
9
|
# 4. install gem: `bundle install`
|
|
10
10
|
# 5. create `config/initializers/proxy.rb` adding this line `require 'rack_proxy_examples/example_service_proxy'`
|
|
11
11
|
# 6. run: `SERVICE_URL=http://guides.rubyonrails.org rails server`
|
data/rack-proxy.gemspec
CHANGED
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.homepage = "https://github.com/ncr/rack-proxy"
|
|
13
13
|
s.summary = %q{A request/response rewriting HTTP proxy. A Rack app.}
|
|
14
14
|
s.description = %q{A Rack app that provides request/response rewriting proxy capabilities with streaming.}
|
|
15
|
+
s.required_ruby_version = '>= 2.6'
|
|
15
16
|
|
|
16
17
|
s.files = `git ls-files`.split("\n")
|
|
17
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
@@ -19,9 +19,8 @@ class HttpStreamingResponseTest < Test::Unit::TestCase
|
|
|
19
19
|
|
|
20
20
|
assert headers.size.positive?
|
|
21
21
|
|
|
22
|
-
assert_match %r{text/html
|
|
22
|
+
assert_match %r{text/html}, headers["content-type"].first.downcase
|
|
23
23
|
assert_equal headers["content-type"], headers["CoNtEnT-TyPe"]
|
|
24
|
-
assert headers["content-length"].first.to_i.positive?
|
|
25
24
|
|
|
26
25
|
# Body
|
|
27
26
|
chunks = []
|
|
@@ -37,7 +36,10 @@ class HttpStreamingResponseTest < Test::Unit::TestCase
|
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
def test_to_s
|
|
40
|
-
|
|
39
|
+
body_string = @response.body.to_s
|
|
40
|
+
assert body_string.bytesize.positive?
|
|
41
|
+
content_length = @response.headers["Content-Length"]
|
|
42
|
+
assert_equal content_length.first.to_i, body_string.bytesize if content_length
|
|
41
43
|
end
|
|
42
44
|
|
|
43
45
|
def test_to_s_called_twice
|
data/test/rack_proxy_test.rb
CHANGED
|
@@ -31,9 +31,9 @@ class RackProxyTest < Test::Unit::TestCase
|
|
|
31
31
|
|
|
32
32
|
def test_http_full_request_headers
|
|
33
33
|
app(:streaming => false)
|
|
34
|
-
app.host = '
|
|
35
|
-
get "/"
|
|
36
|
-
assert !Array(last_response['Set-Cookie']).empty?, '
|
|
34
|
+
app.host = 'httpbin.org'
|
|
35
|
+
get "/cookies/set?test=1"
|
|
36
|
+
assert !Array(last_response['Set-Cookie']).empty?, 'httpbin.org/cookies/set should set a cookie'
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def test_https_streaming
|
|
@@ -44,7 +44,7 @@ class RackProxyTest < Test::Unit::TestCase
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def test_https_streaming_tls
|
|
47
|
-
app(:ssl_version => :
|
|
47
|
+
app(:ssl_version => :TLSv1_2).host = 'www.apple.com'
|
|
48
48
|
get 'https://example.com'
|
|
49
49
|
assert last_response.ok?
|
|
50
50
|
assert_match(/(itunes|iphone|ipod|mac|ipad)/, last_response.body)
|
|
@@ -58,7 +58,7 @@ class RackProxyTest < Test::Unit::TestCase
|
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def test_https_full_request_tls
|
|
61
|
-
app({:streaming => false, :ssl_version => :
|
|
61
|
+
app({:streaming => false, :ssl_version => :TLSv1_2}).host = 'www.apple.com'
|
|
62
62
|
get 'https://example.com'
|
|
63
63
|
assert last_response.ok?
|
|
64
64
|
assert_match(/(itunes|iphone|ipod|mac|ipad)/, last_response.body)
|
|
@@ -69,7 +69,8 @@ class RackProxyTest < Test::Unit::TestCase
|
|
|
69
69
|
headers = { 'header_array' => ['first_entry'], 'header_non_array' => :entry }
|
|
70
70
|
|
|
71
71
|
normalized_headers = proxy_class.send(:normalize_headers, headers)
|
|
72
|
-
|
|
72
|
+
expected_class = Rack.const_defined?(:Headers) ? Rack::Headers : Rack::Utils::HeaderHash
|
|
73
|
+
assert normalized_headers.instance_of?(expected_class)
|
|
73
74
|
assert normalized_headers['header_array'] == 'first_entry'
|
|
74
75
|
assert normalized_headers['header_non_array'] == :entry
|
|
75
76
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-proxy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jacek Becela
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rack
|
|
@@ -85,7 +84,6 @@ homepage: https://github.com/ncr/rack-proxy
|
|
|
85
84
|
licenses:
|
|
86
85
|
- MIT
|
|
87
86
|
metadata: {}
|
|
88
|
-
post_install_message:
|
|
89
87
|
rdoc_options: []
|
|
90
88
|
require_paths:
|
|
91
89
|
- lib
|
|
@@ -93,15 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
93
91
|
requirements:
|
|
94
92
|
- - ">="
|
|
95
93
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
94
|
+
version: '2.6'
|
|
97
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
96
|
requirements:
|
|
99
97
|
- - ">="
|
|
100
98
|
- !ruby/object:Gem::Version
|
|
101
99
|
version: '0'
|
|
102
100
|
requirements: []
|
|
103
|
-
rubygems_version: 3.
|
|
104
|
-
signing_key:
|
|
101
|
+
rubygems_version: 3.6.9
|
|
105
102
|
specification_version: 4
|
|
106
103
|
summary: A request/response rewriting HTTP proxy. A Rack app.
|
|
107
104
|
test_files:
|