excon 0.27.4 → 0.27.5
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.
- data/Gemfile.lock +1 -1
- data/changelog.txt +5 -0
- data/excon.gemspec +2 -1
- data/lib/excon.rb +1 -0
- data/lib/excon/connection.rb +4 -11
- data/lib/excon/constants.rb +1 -1
- data/lib/excon/middlewares/idempotent.rb +2 -1
- data/lib/excon/socket.rb +1 -0
- data/lib/excon/ssl_socket.rb +2 -2
- data/lib/excon/utils.rb +21 -0
- metadata +3 -2
data/Gemfile.lock
CHANGED
data/changelog.txt
CHANGED
data/excon.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'excon'
|
16
|
-
s.version = '0.27.
|
16
|
+
s.version = '0.27.5'
|
17
17
|
s.date = '2013-10-14'
|
18
18
|
s.rubyforge_project = 'excon'
|
19
19
|
|
@@ -110,6 +110,7 @@ Gem::Specification.new do |s|
|
|
110
110
|
lib/excon/ssl_socket.rb
|
111
111
|
lib/excon/standard_instrumentor.rb
|
112
112
|
lib/excon/unix_socket.rb
|
113
|
+
lib/excon/utils.rb
|
113
114
|
tests/authorization_header_tests.rb
|
114
115
|
tests/bad_tests.rb
|
115
116
|
tests/basic_tests.rb
|
data/lib/excon.rb
CHANGED
data/lib/excon/connection.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Excon
|
2
2
|
class Connection
|
3
|
+
include Utils
|
3
4
|
|
4
5
|
attr_reader :data
|
5
6
|
|
@@ -46,7 +47,6 @@ module Excon
|
|
46
47
|
# @option params [Class] :instrumentor Responds to #instrument as in ActiveSupport::Notifications
|
47
48
|
# @option params [String] :instrumentor_name Name prefix for #instrument events. Defaults to 'excon'
|
48
49
|
def initialize(params = {})
|
49
|
-
params = validate_params(:connection, params)
|
50
50
|
@data = Excon.defaults.dup
|
51
51
|
# merge does not deep-dup, so make sure headers is not the original
|
52
52
|
@data[:headers] = @data[:headers].dup
|
@@ -54,6 +54,7 @@ module Excon
|
|
54
54
|
# the same goes for :middlewares
|
55
55
|
@data[:middlewares] = @data[:middlewares].dup
|
56
56
|
|
57
|
+
params = validate_params(:connection, params)
|
57
58
|
@data.merge!(params)
|
58
59
|
|
59
60
|
unless @data[:scheme] == UNIX
|
@@ -357,9 +358,9 @@ module Excon
|
|
357
358
|
def validate_params(validation, params)
|
358
359
|
valid_keys = case validation
|
359
360
|
when :connection
|
360
|
-
|
361
|
+
valid_connection_keys(@data, params)
|
361
362
|
when :request
|
362
|
-
|
363
|
+
valid_request_keys(@data, params)
|
363
364
|
end
|
364
365
|
invalid_keys = params.keys - valid_keys
|
365
366
|
unless invalid_keys.empty?
|
@@ -413,13 +414,5 @@ module Excon
|
|
413
414
|
proxy
|
414
415
|
end
|
415
416
|
end
|
416
|
-
|
417
|
-
def port_string(datum)
|
418
|
-
if datum[:port].nil? || (datum[:omit_default_port] && ((datum[:scheme].casecmp('http') == 0 && datum[:port] == 80) || (datum[:scheme].casecmp('https') == 0 && datum[:port] == 443)))
|
419
|
-
''
|
420
|
-
else
|
421
|
-
':' << datum[:port].to_s
|
422
|
-
end
|
423
|
-
end
|
424
417
|
end
|
425
418
|
end
|
data/lib/excon/constants.rb
CHANGED
@@ -7,7 +7,8 @@ module Excon
|
|
7
7
|
# reduces remaining retries, reset connection, and restart request_call
|
8
8
|
datum[:retries_remaining] -= 1
|
9
9
|
connection = datum.delete(:connection)
|
10
|
-
|
10
|
+
request_keys = Utils.valid_request_keys(datum)
|
11
|
+
datum.reject! {|key, _| !request_keys.include?(key) }
|
11
12
|
connection.request(datum)
|
12
13
|
else
|
13
14
|
@stack.error_call(datum)
|
data/lib/excon/socket.rb
CHANGED
data/lib/excon/ssl_socket.rb
CHANGED
@@ -51,8 +51,8 @@ module Excon
|
|
51
51
|
end
|
52
52
|
|
53
53
|
if @data[:proxy]
|
54
|
-
request = 'CONNECT ' << @data[:host] <<
|
55
|
-
request << 'Host: ' << @data[:host] <<
|
54
|
+
request = 'CONNECT ' << @data[:host] << port_string(@data) << Excon::HTTP_1_1
|
55
|
+
request << 'Host: ' << @data[:host] << port_string(@data) << Excon::CR_NL
|
56
56
|
|
57
57
|
if @data[:proxy][:password] || @data[:proxy][:user]
|
58
58
|
auth = ['' << @data[:proxy][:user].to_s << ':' << @data[:proxy][:password].to_s].pack('m').delete(Excon::CR_NL)
|
data/lib/excon/utils.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Excon
|
2
|
+
module Utils
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def valid_connection_keys(datum, params = {})
|
6
|
+
Excon::VALID_CONNECTION_KEYS
|
7
|
+
end
|
8
|
+
|
9
|
+
def valid_request_keys(datum, params = {})
|
10
|
+
Excon::VALID_REQUEST_KEYS
|
11
|
+
end
|
12
|
+
|
13
|
+
def port_string(datum)
|
14
|
+
if datum[:port].nil? || (datum[:omit_default_port] && ((datum[:scheme].casecmp('http') == 0 && datum[:port] == 80) || (datum[:scheme].casecmp('https') == 0 && datum[:port] == 443)))
|
15
|
+
''
|
16
|
+
else
|
17
|
+
':' << datum[:port].to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- lib/excon/ssl_socket.rb
|
191
191
|
- lib/excon/standard_instrumentor.rb
|
192
192
|
- lib/excon/unix_socket.rb
|
193
|
+
- lib/excon/utils.rb
|
193
194
|
- tests/authorization_header_tests.rb
|
194
195
|
- tests/bad_tests.rb
|
195
196
|
- tests/basic_tests.rb
|
@@ -243,7 +244,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
243
244
|
version: '0'
|
244
245
|
segments:
|
245
246
|
- 0
|
246
|
-
hash: -
|
247
|
+
hash: -4165202606789570429
|
247
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
249
|
none: false
|
249
250
|
requirements:
|