excon 0.64.0 → 0.65.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/data/cacert.pem +108 -2
- data/excon.gemspec +7 -2
- data/lib/excon.rb +11 -11
- data/lib/excon/connection.rb +25 -25
- data/lib/excon/response.rb +1 -1
- data/lib/excon/version.rb +1 -1
- metadata +3 -101
- data/.document +0 -5
- data/.github/stale.yml +0 -17
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -17
- data/Gemfile +0 -19
- data/Rakefile +0 -41
- data/benchmarks/class_vs_lambda.rb +0 -50
- data/benchmarks/concat_vs_insert.rb +0 -21
- data/benchmarks/concat_vs_interpolate.rb +0 -22
- data/benchmarks/cr_lf.rb +0 -21
- data/benchmarks/downcase-eq-eq_vs_casecmp.rb +0 -169
- data/benchmarks/excon.rb +0 -69
- data/benchmarks/excon_vs.rb +0 -165
- data/benchmarks/for_vs_array_each.rb +0 -27
- data/benchmarks/for_vs_hash_each.rb +0 -27
- data/benchmarks/has_key-vs-lookup.rb +0 -177
- data/benchmarks/headers_case_sensitivity.rb +0 -83
- data/benchmarks/headers_split_vs_match.rb +0 -34
- data/benchmarks/implicit_block-vs-explicit_block.rb +0 -98
- data/benchmarks/merging.rb +0 -21
- data/benchmarks/single_vs_double_quotes.rb +0 -21
- data/benchmarks/string_ranged_index.rb +0 -87
- data/benchmarks/strip_newline.rb +0 -115
- data/benchmarks/vs_stdlib.rb +0 -82
- data/changelog.txt +0 -1113
- data/spec/excon/error_spec.rb +0 -139
- data/spec/excon/test/server_spec.rb +0 -28
- data/spec/excon_spec.rb +0 -7
- data/spec/helpers/file_path_helpers.rb +0 -22
- data/spec/helpers/warning_helpers.rb +0 -9
- data/spec/requests/basic_spec.rb +0 -40
- data/spec/requests/eof_requests_spec.rb +0 -36
- data/spec/requests/unix_socket_spec.rb +0 -38
- data/spec/requests/validation_spec.rb +0 -80
- data/spec/spec_helper.rb +0 -26
- data/spec/support/shared_contexts/test_server_context.rb +0 -83
- data/spec/support/shared_contexts/test_stub_context.rb +0 -11
- data/spec/support/shared_examples/shared_example_for_clients.rb +0 -220
- data/spec/support/shared_examples/shared_example_for_streaming_clients.rb +0 -20
- data/spec/support/shared_examples/shared_example_for_test_servers.rb +0 -16
- data/tests/authorization_header_tests.rb +0 -27
- data/tests/bad_tests.rb +0 -69
- data/tests/basic_tests.rb +0 -351
- data/tests/batch_requests.rb +0 -133
- data/tests/complete_responses.rb +0 -31
- data/tests/data/127.0.0.1.cert.crt +0 -17
- data/tests/data/127.0.0.1.cert.key +0 -28
- data/tests/data/excon.cert.crt +0 -17
- data/tests/data/excon.cert.key +0 -28
- data/tests/data/xs +0 -1
- data/tests/error_tests.rb +0 -145
- data/tests/header_tests.rb +0 -119
- data/tests/instrumentors/logging_instrumentor_tests.rb +0 -28
- data/tests/middleware_tests.rb +0 -27
- data/tests/middlewares/canned_response_tests.rb +0 -34
- data/tests/middlewares/capture_cookies_tests.rb +0 -34
- data/tests/middlewares/decompress_tests.rb +0 -157
- data/tests/middlewares/escape_path_tests.rb +0 -36
- data/tests/middlewares/idempotent_tests.rb +0 -245
- data/tests/middlewares/instrumentation_tests.rb +0 -315
- data/tests/middlewares/mock_tests.rb +0 -304
- data/tests/middlewares/redirect_follower_tests.rb +0 -112
- data/tests/pipeline_tests.rb +0 -40
- data/tests/proxy_tests.rb +0 -306
- data/tests/query_string_tests.rb +0 -87
- data/tests/rackups/basic.rb +0 -41
- data/tests/rackups/basic.ru +0 -3
- data/tests/rackups/basic_auth.ru +0 -14
- data/tests/rackups/deflater.ru +0 -4
- data/tests/rackups/proxy.ru +0 -18
- data/tests/rackups/query_string.ru +0 -13
- data/tests/rackups/redirecting.ru +0 -23
- data/tests/rackups/redirecting_with_cookie.ru +0 -40
- data/tests/rackups/request_headers.ru +0 -15
- data/tests/rackups/request_methods.ru +0 -21
- data/tests/rackups/response_header.ru +0 -18
- data/tests/rackups/ssl.ru +0 -16
- data/tests/rackups/ssl_mismatched_cn.ru +0 -15
- data/tests/rackups/ssl_verify_peer.ru +0 -16
- data/tests/rackups/streaming.ru +0 -30
- data/tests/rackups/thread_safety.ru +0 -17
- data/tests/rackups/timeout.ru +0 -14
- data/tests/rackups/webrick_patch.rb +0 -34
- data/tests/request_headers_tests.rb +0 -21
- data/tests/request_method_tests.rb +0 -47
- data/tests/request_tests.rb +0 -58
- data/tests/response_tests.rb +0 -197
- data/tests/servers/bad.rb +0 -25
- data/tests/servers/eof.rb +0 -17
- data/tests/servers/error.rb +0 -20
- data/tests/servers/good.rb +0 -342
- data/tests/servers/good_ipv4.rb +0 -8
- data/tests/servers/good_ipv6.rb +0 -8
- data/tests/test_helper.rb +0 -297
- data/tests/thread_safety_tests.rb +0 -39
- data/tests/timeout_tests.rb +0 -12
- data/tests/utils_tests.rb +0 -81
@@ -1,112 +0,0 @@
|
|
1
|
-
Shindo.tests('Excon redirector support') do
|
2
|
-
env_init
|
3
|
-
|
4
|
-
tests("request(:method => :get, :path => '/old').body").returns('new') do
|
5
|
-
Excon.stub(
|
6
|
-
{ :path => '/old' },
|
7
|
-
{
|
8
|
-
:headers => { 'Location' => 'http://127.0.0.1:9292/new' },
|
9
|
-
:body => 'old',
|
10
|
-
:status => 301
|
11
|
-
}
|
12
|
-
)
|
13
|
-
|
14
|
-
Excon.stub(
|
15
|
-
{ :path => '/new' },
|
16
|
-
{
|
17
|
-
:body => 'new',
|
18
|
-
:status => 200
|
19
|
-
}
|
20
|
-
)
|
21
|
-
|
22
|
-
Excon.get(
|
23
|
-
'http://127.0.0.1:9292',
|
24
|
-
:path => '/old',
|
25
|
-
:middlewares => Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower],
|
26
|
-
:mock => true
|
27
|
-
).body
|
28
|
-
end
|
29
|
-
|
30
|
-
env_restore
|
31
|
-
end
|
32
|
-
|
33
|
-
Shindo.tests('Excon redirect support for relative Location headers') do
|
34
|
-
env_init
|
35
|
-
|
36
|
-
tests("request(:method => :get, :path => '/old').body").returns('new') do
|
37
|
-
Excon.stub(
|
38
|
-
{ :path => '/old' },
|
39
|
-
{
|
40
|
-
:headers => { 'Location' => '/new' },
|
41
|
-
:body => 'old',
|
42
|
-
:status => 301
|
43
|
-
}
|
44
|
-
)
|
45
|
-
|
46
|
-
Excon.stub(
|
47
|
-
{ :path => '/new' },
|
48
|
-
{
|
49
|
-
:body => 'new',
|
50
|
-
:status => 200
|
51
|
-
}
|
52
|
-
)
|
53
|
-
|
54
|
-
Excon.get(
|
55
|
-
'http://127.0.0.1:9292',
|
56
|
-
:path => '/old',
|
57
|
-
:middlewares => Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower],
|
58
|
-
:mock => true
|
59
|
-
).body
|
60
|
-
end
|
61
|
-
|
62
|
-
env_restore
|
63
|
-
end
|
64
|
-
|
65
|
-
Shindo.tests('Excon redirect support for relative Location headers with dot segments') do
|
66
|
-
env_init
|
67
|
-
|
68
|
-
tests("request(:method => :get, :path => '/foo/baz/').body").returns('/foo/bar/') do
|
69
|
-
Excon.stub(
|
70
|
-
{ :path => '/foo/baz/' },
|
71
|
-
{
|
72
|
-
:headers => { 'Location' => '../bar/' },
|
73
|
-
:body => '/foo/baz/',
|
74
|
-
:status => 301
|
75
|
-
}
|
76
|
-
)
|
77
|
-
|
78
|
-
Excon.stub(
|
79
|
-
{ :path => '/foo/bar/' },
|
80
|
-
{
|
81
|
-
:body => '/foo/bar/',
|
82
|
-
:status => 200
|
83
|
-
}
|
84
|
-
)
|
85
|
-
|
86
|
-
Excon.get(
|
87
|
-
'http://127.0.0.1:9292',
|
88
|
-
:path => '/foo/baz/',
|
89
|
-
:middlewares => Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower],
|
90
|
-
:mock => true
|
91
|
-
).body
|
92
|
-
end
|
93
|
-
|
94
|
-
env_restore
|
95
|
-
end
|
96
|
-
|
97
|
-
Shindo.tests("Excon redirecting post request") do
|
98
|
-
env_init
|
99
|
-
|
100
|
-
with_rackup('redirecting.ru') do
|
101
|
-
tests("request not have content-length and body").returns('ok') do
|
102
|
-
Excon.post(
|
103
|
-
'http://127.0.0.1:9292',
|
104
|
-
:path => '/first',
|
105
|
-
:middlewares => Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower],
|
106
|
-
:body => "a=Some_content"
|
107
|
-
).body
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
env_restore
|
112
|
-
end
|
data/tests/pipeline_tests.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
Shindo.tests('Pipelined Requests') do
|
2
|
-
with_server('good_ipv4') do
|
3
|
-
|
4
|
-
tests('with default :persistent => true') do
|
5
|
-
returns(%w{ 1 2 3 4 }, 'connection is persistent') do
|
6
|
-
connection = Excon.new('http://127.0.0.1:9292', :persistent => true)
|
7
|
-
|
8
|
-
ret = []
|
9
|
-
ret << connection.requests([
|
10
|
-
{:method => :get, :path => '/echo/request_count'},
|
11
|
-
{:method => :get, :path => '/echo/request_count'}
|
12
|
-
]).map(&:body)
|
13
|
-
ret << connection.requests([
|
14
|
-
{:method => :get, :path => '/echo/request_count'},
|
15
|
-
{:method => :get, :path => '/echo/request_count'}
|
16
|
-
]).map(&:body)
|
17
|
-
ret.flatten
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
tests('with default :persistent => false') do
|
22
|
-
returns(%w{ 1 2 1 2 }, 'connection is persistent per call to #requests') do
|
23
|
-
connection = Excon.new('http://127.0.0.1:9292', :persistent => false)
|
24
|
-
|
25
|
-
ret = []
|
26
|
-
ret << connection.requests([
|
27
|
-
{:method => :get, :path => '/echo/request_count'},
|
28
|
-
{:method => :get, :path => '/echo/request_count'}
|
29
|
-
]).map(&:body)
|
30
|
-
ret << connection.requests([
|
31
|
-
{:method => :get, :path => '/echo/request_count'},
|
32
|
-
{:method => :get, :path => '/echo/request_count'}
|
33
|
-
]).map(&:body)
|
34
|
-
ret.flatten
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
data/tests/proxy_tests.rb
DELETED
@@ -1,306 +0,0 @@
|
|
1
|
-
Shindo.tests('Excon proxy support') do
|
2
|
-
env_init
|
3
|
-
|
4
|
-
tests('proxy configuration') do
|
5
|
-
|
6
|
-
tests('no proxy') do
|
7
|
-
tests('connection.data[:proxy]').returns(nil) do
|
8
|
-
connection = Excon.new('http://foo.com')
|
9
|
-
connection.data[:proxy]
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
tests('empty proxy') do
|
14
|
-
tests('connection.data[:proxy]').returns(nil) do
|
15
|
-
connection = Excon.new('http://foo.com', :proxy => '')
|
16
|
-
connection.data[:proxy]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
tests('with fully-specified proxy: https://myproxy.net:8080') do
|
21
|
-
connection = nil
|
22
|
-
|
23
|
-
tests('connection.data[:proxy][:host]').returns('myproxy.net') do
|
24
|
-
connection = Excon.new('http://foo.com', :proxy => 'https://myproxy.net:8080')
|
25
|
-
connection.data[:proxy][:host]
|
26
|
-
end
|
27
|
-
|
28
|
-
tests('connection.data[:proxy][:port]').returns(8080) do
|
29
|
-
connection.data[:proxy][:port]
|
30
|
-
end
|
31
|
-
|
32
|
-
tests('connection.data[:proxy][:scheme]').returns('https') do
|
33
|
-
connection.data[:proxy][:scheme]
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
tests('with fully-specified Unix socket proxy: unix:///') do
|
38
|
-
connection = nil
|
39
|
-
|
40
|
-
tests('connection.data[:proxy][:host]').returns(nil) do
|
41
|
-
connection = Excon.new('http://foo.com', :proxy => 'unix:///tmp/myproxy.sock')
|
42
|
-
connection.data[:proxy][:host]
|
43
|
-
end
|
44
|
-
|
45
|
-
tests('connection.data[:proxy][:port]').returns(nil) do
|
46
|
-
connection.data[:proxy][:port]
|
47
|
-
end
|
48
|
-
|
49
|
-
tests('connection.data[:proxy][:scheme]').returns('unix') do
|
50
|
-
connection.data[:proxy][:scheme]
|
51
|
-
end
|
52
|
-
|
53
|
-
tests('connection.data[:proxy][:path]').returns('/tmp/myproxy.sock') do
|
54
|
-
connection.data[:proxy][:path]
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def env_proxy_tests(env)
|
59
|
-
env_init(env)
|
60
|
-
|
61
|
-
tests('an http connection') do
|
62
|
-
connection = nil
|
63
|
-
|
64
|
-
tests('connection.data[:proxy][:host]').returns('myproxy') do
|
65
|
-
connection = Excon.new('http://foo.com')
|
66
|
-
connection.data[:proxy][:host]
|
67
|
-
end
|
68
|
-
|
69
|
-
tests('connection.data[:proxy][:port]').returns(8080) do
|
70
|
-
connection.data[:proxy][:port]
|
71
|
-
end
|
72
|
-
|
73
|
-
tests('connection.data[:proxy][:scheme]').returns('http') do
|
74
|
-
connection.data[:proxy][:scheme]
|
75
|
-
end
|
76
|
-
|
77
|
-
tests('with disable_proxy set') do
|
78
|
-
connection = nil
|
79
|
-
|
80
|
-
tests('connection.data[:proxy]').returns(nil) do
|
81
|
-
connection = Excon.new('http://foo.com', :disable_proxy => true)
|
82
|
-
connection.data[:proxy]
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
tests('an https connection') do
|
88
|
-
connection = nil
|
89
|
-
|
90
|
-
tests('connection.data[:proxy][:host]').returns('mysecureproxy') do
|
91
|
-
connection = Excon.new('https://secret.com')
|
92
|
-
connection.data[:proxy][:host]
|
93
|
-
end
|
94
|
-
|
95
|
-
tests('connection.data[:proxy][:port]').returns(8081) do
|
96
|
-
connection.data[:proxy][:port]
|
97
|
-
end
|
98
|
-
|
99
|
-
tests('connection.data[:proxy][:scheme]').returns('http') do
|
100
|
-
connection.data[:proxy][:scheme]
|
101
|
-
end
|
102
|
-
|
103
|
-
tests('with disable_proxy set') do
|
104
|
-
connection = nil
|
105
|
-
|
106
|
-
tests('connection.data[:proxy]').returns(nil) do
|
107
|
-
connection = Excon.new('https://foo.com', :disable_proxy => true)
|
108
|
-
connection.data[:proxy]
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
tests('http proxy from the environment overrides config') do
|
114
|
-
connection = nil
|
115
|
-
|
116
|
-
tests('connection.data[:proxy][:host]').returns('myproxy') do
|
117
|
-
connection = Excon.new('http://foo.com', :proxy => 'http://hard.coded.proxy:6666')
|
118
|
-
connection.data[:proxy][:host]
|
119
|
-
end
|
120
|
-
|
121
|
-
tests('connection.data[:proxy][:port]').returns(8080) do
|
122
|
-
connection.data[:proxy][:port]
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
tests('an http connection in no_proxy') do
|
127
|
-
tests('connection.data[:proxy]').returns(nil) do
|
128
|
-
connection = Excon.new('http://somesubdomain.noproxy')
|
129
|
-
connection.data[:proxy]
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
tests('an http connection not completely matching no_proxy') do
|
134
|
-
tests('connection.data[:proxy][:host]').returns('myproxy') do
|
135
|
-
connection = Excon.new('http://noproxy2')
|
136
|
-
connection.data[:proxy][:host]
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
tests('an http connection with subdomain in no_proxy') do
|
141
|
-
tests('connection.data[:proxy]').returns(nil) do
|
142
|
-
connection = Excon.new('http://a.subdomain.noproxy2')
|
143
|
-
connection.data[:proxy]
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
env_restore
|
148
|
-
end
|
149
|
-
|
150
|
-
tests('with complete proxy config from the environment') do
|
151
|
-
env = {
|
152
|
-
'http_proxy' => 'http://myproxy:8080',
|
153
|
-
'https_proxy' => 'http://mysecureproxy:8081',
|
154
|
-
'no_proxy' => 'noproxy, subdomain.noproxy2'
|
155
|
-
}
|
156
|
-
tests('lowercase') { env_proxy_tests(env) }
|
157
|
-
upperenv = {}
|
158
|
-
env.each do |k, v|
|
159
|
-
upperenv[k.upcase] = v
|
160
|
-
end
|
161
|
-
tests('uppercase') { env_proxy_tests(upperenv) }
|
162
|
-
end
|
163
|
-
|
164
|
-
tests('with only http_proxy config from the environment') do
|
165
|
-
env_init({'http_proxy' => 'http://myproxy:8080' })
|
166
|
-
|
167
|
-
tests('an https connection') do
|
168
|
-
connection = nil
|
169
|
-
|
170
|
-
tests('connection.data[:proxy][:host]').returns('myproxy') do
|
171
|
-
connection = Excon.new('https://secret.com')
|
172
|
-
connection.data[:proxy][:host]
|
173
|
-
end
|
174
|
-
|
175
|
-
tests('connection.data[:proxy][:port]').returns(8080) do
|
176
|
-
connection.data[:proxy][:port]
|
177
|
-
end
|
178
|
-
|
179
|
-
tests('connection.data[:proxy][:scheme]').returns('http') do
|
180
|
-
connection.data[:proxy][:scheme]
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
env_restore
|
185
|
-
end
|
186
|
-
|
187
|
-
tests('with a unix socket proxy config from the environment') do
|
188
|
-
env_init({
|
189
|
-
'http_proxy' => 'unix:///tmp/myproxy.sock',
|
190
|
-
})
|
191
|
-
|
192
|
-
tests('an https connection') do
|
193
|
-
connection = nil
|
194
|
-
|
195
|
-
tests('connection.data[:proxy][:host]').returns(nil) do
|
196
|
-
connection = Excon.new('https://secret.com')
|
197
|
-
connection.data[:proxy][:host]
|
198
|
-
end
|
199
|
-
|
200
|
-
tests('connection.data[:proxy][:port]').returns(nil) do
|
201
|
-
connection.data[:proxy][:port]
|
202
|
-
end
|
203
|
-
|
204
|
-
tests('connection.data[:proxy][:scheme]').returns('unix') do
|
205
|
-
connection.data[:proxy][:scheme]
|
206
|
-
end
|
207
|
-
|
208
|
-
tests('connection.data[:proxy][:path]').returns('/tmp/myproxy.sock') do
|
209
|
-
connection.data[:proxy][:path]
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
env_restore
|
214
|
-
end
|
215
|
-
|
216
|
-
end
|
217
|
-
|
218
|
-
with_rackup('proxy.ru') do
|
219
|
-
|
220
|
-
tests('http proxying: http://foo.com:8080') do
|
221
|
-
response = nil
|
222
|
-
|
223
|
-
tests('response.status').returns(200) do
|
224
|
-
connection = Excon.new('http://foo.com:8080', :proxy => 'http://127.0.0.1:9292')
|
225
|
-
response = connection.request(:method => :get, :path => '/bar', :query => {:alpha => 'kappa'})
|
226
|
-
|
227
|
-
response.status
|
228
|
-
end
|
229
|
-
|
230
|
-
# must be absolute form for proxy requests
|
231
|
-
tests('sent Request URI').returns('http://foo.com:8080/bar?alpha=kappa') do
|
232
|
-
response.headers['Sent-Request-Uri']
|
233
|
-
end
|
234
|
-
|
235
|
-
tests('sent Sent-Host header').returns('foo.com:8080') do
|
236
|
-
response.headers['Sent-Host']
|
237
|
-
end
|
238
|
-
|
239
|
-
tests('sent Proxy-Connection header').returns('Keep-Alive') do
|
240
|
-
response.headers['Sent-Proxy-Connection']
|
241
|
-
end
|
242
|
-
|
243
|
-
tests('response.body (proxied content)').returns('proxied content') do
|
244
|
-
response.body
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
tests('http proxying: http://user:pass@foo.com:8080') do
|
249
|
-
response = nil
|
250
|
-
|
251
|
-
tests('response.status').returns(200) do
|
252
|
-
connection = Excon.new('http://foo.com:8080', :proxy => 'http://user:pass@127.0.0.1:9292')
|
253
|
-
response = connection.request(:method => :get, :path => '/bar', :query => {:alpha => 'kappa'})
|
254
|
-
|
255
|
-
response.status
|
256
|
-
end
|
257
|
-
|
258
|
-
# must be absolute form for proxy requests
|
259
|
-
tests('sent Request URI').returns('http://foo.com:8080/bar?alpha=kappa') do
|
260
|
-
response.headers['Sent-Request-Uri']
|
261
|
-
end
|
262
|
-
|
263
|
-
tests('sent Host header').returns('foo.com:8080') do
|
264
|
-
response.headers['Sent-Host']
|
265
|
-
end
|
266
|
-
|
267
|
-
tests('sent Proxy-Connection header').returns('Keep-Alive') do
|
268
|
-
response.headers['Sent-Proxy-Connection']
|
269
|
-
end
|
270
|
-
|
271
|
-
tests('response.body (proxied content)').returns('proxied content') do
|
272
|
-
response.body
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
end
|
277
|
-
|
278
|
-
with_unicorn('proxy.ru', 'unix:///tmp/myproxy.sock') do
|
279
|
-
pending if RUBY_PLATFORM == 'java' # need to find suitable server for jruby
|
280
|
-
|
281
|
-
tests('http proxying over unix socket: http://foo.com:8080') do
|
282
|
-
response = nil
|
283
|
-
|
284
|
-
tests('response.status').returns(200) do
|
285
|
-
connection = Excon.new('http://foo.com:8080', :proxy => 'unix:///tmp/myproxy.sock')
|
286
|
-
response = connection.request(:method => :get, :path => '/bar', :query => {:alpha => 'kappa'})
|
287
|
-
|
288
|
-
response.status
|
289
|
-
end
|
290
|
-
|
291
|
-
tests('sent Sent-Host header').returns('foo.com:8080') do
|
292
|
-
response.headers['Sent-Host']
|
293
|
-
end
|
294
|
-
|
295
|
-
tests('sent Proxy-Connection header').returns('Keep-Alive') do
|
296
|
-
response.headers['Sent-Proxy-Connection']
|
297
|
-
end
|
298
|
-
|
299
|
-
tests('response.body (proxied content)').returns('proxied content') do
|
300
|
-
response.body
|
301
|
-
end
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
env_restore
|
306
|
-
end
|