excon 0.27.2 → 0.27.3

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.

@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- excon (0.27.2)
4
+ excon (0.27.3)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,3 +1,9 @@
1
+ 0.27.3 10/11/2013
2
+ =================
3
+
4
+ better invalid key handling
5
+ avoid mutating port value
6
+
1
7
  0.27.2 10/10/2013
2
8
  =================
3
9
 
@@ -13,8 +13,8 @@ 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.2'
17
- s.date = '2013-10-10'
16
+ s.version = '0.27.3'
17
+ s.date = '2013-10-11'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -134,7 +134,7 @@ module Excon
134
134
  params = {
135
135
  :host => uri.host,
136
136
  :path => uri.path,
137
- :port => uri.port.to_s,
137
+ :port => uri.port,
138
138
  :query => uri.query,
139
139
  :scheme => uri.scheme,
140
140
  :user => (URI.decode(uri.user) if uri.user),
@@ -155,7 +155,7 @@ module Excon
155
155
  request_params.update(
156
156
  :host => uri.host,
157
157
  :path => uri.path,
158
- :port => uri.port.to_s,
158
+ :port => uri.port,
159
159
  :query => uri.query,
160
160
  :scheme => uri.scheme
161
161
  )
@@ -46,7 +46,7 @@ module Excon
46
46
  # @option params [Class] :instrumentor Responds to #instrument as in ActiveSupport::Notifications
47
47
  # @option params [String] :instrumentor_name Name prefix for #instrument events. Defaults to 'excon'
48
48
  def initialize(params = {})
49
- validate_params!(:connection, 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
@@ -101,7 +101,7 @@ module Excon
101
101
  @socket_key << '://' << @data[:socket]
102
102
  end
103
103
  else
104
- @socket_key << '://' << @data[:host]<< ':' << @data[:port].to_s
104
+ @socket_key << '://' << @data[:host] << port_string(@data)
105
105
  end
106
106
  reset
107
107
  end
@@ -228,7 +228,7 @@ module Excon
228
228
  # @option params [String] :path appears after 'scheme://host:port/'
229
229
  # @option params [Hash] :query appended to the 'scheme://host:port/path/' in the form of '?key=value'
230
230
  def request(params={}, &block)
231
- validate_params!(:request, params)
231
+ params = validate_params(:request, params)
232
232
  # @data has defaults, merge in new params to override
233
233
  datum = @data.merge(params)
234
234
  datum[:headers] = @data[:headers].merge(datum[:headers] || {})
@@ -354,7 +354,7 @@ module Excon
354
354
  end
355
355
  end
356
356
 
357
- def validate_params!(validation, params)
357
+ def validate_params(validation, params)
358
358
  valid_keys = case validation
359
359
  when :connection
360
360
  VALID_CONNECTION_KEYS
@@ -364,8 +364,10 @@ module Excon
364
364
  invalid_keys = params.keys - valid_keys
365
365
  unless invalid_keys.empty?
366
366
  Excon.display_warning("Invalid Excon #{validation} keys: #{invalid_keys.map(&:inspect).join(', ')}\n#{ caller.join("\n") }")
367
+ params = params.dup
367
368
  invalid_keys.each {|key| params.delete(key) }
368
369
  end
370
+ params
369
371
  end
370
372
 
371
373
  def response(datum={})
@@ -403,7 +405,7 @@ module Excon
403
405
  {
404
406
  :host => uri.host,
405
407
  :password => uri.password,
406
- :port => uri.port.to_s,
408
+ :port => uri.port,
407
409
  :scheme => uri.scheme,
408
410
  :user => uri.user
409
411
  }
@@ -413,7 +415,7 @@ module Excon
413
415
  end
414
416
 
415
417
  def port_string(datum)
416
- if datum[:omit_default_port] && ((datum[:scheme].casecmp('http') == 0 && datum[:port].to_i == 80) || (datum[:scheme].casecmp('https') == 0 && datum[:port].to_i == 443))
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)))
417
419
  ''
418
420
  else
419
421
  ':' << datum[:port].to_s
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
 
3
- VERSION = '0.27.2'
3
+ VERSION = '0.27.3'
4
4
 
5
5
  CR_NL = "\r\n"
6
6
 
@@ -7,8 +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
- retry_datum = datum.reject {|key, _| !VALID_REQUEST_KEYS.include?(key) }
11
- connection.request(retry_datum)
10
+ datum.reject! {|key, _| !VALID_REQUEST_KEYS.include?(key) }
11
+ connection.request(datum)
12
12
  else
13
13
  @stack.error_call(datum)
14
14
  end
@@ -11,18 +11,11 @@ module Excon
11
11
  end
12
12
  uri = uri_parser.parse(location)
13
13
 
14
- port_string = if datum[:omit_default_port] && ((uri.scheme.casecmp('http') == 0 && uri.port.to_i == 80) || (uri.scheme.casecmp('https') == 0 && uri.port.to_i == 443))
15
- ''
16
- else
17
- ':' << uri.port.to_s
18
- end
19
-
20
14
  # delete old/redirect response
21
15
  datum.delete(:response)
22
16
 
23
17
  response = datum[:connection].request(
24
18
  datum.merge!(
25
- :headers => (datum[:headers] || {}).merge({'Host' => '' << uri.host << port_string}),
26
19
  :host => uri.host,
27
20
  :path => uri.path,
28
21
  :port => uri.port,
@@ -18,7 +18,7 @@ Shindo.tests('Excon proxy support') do
18
18
  connection.data[:proxy][:host]
19
19
  end
20
20
 
21
- tests('connection.data[:proxy][:port]').returns('8080') do
21
+ tests('connection.data[:proxy][:port]').returns(8080) do
22
22
  connection.data[:proxy][:port]
23
23
  end
24
24
 
@@ -37,7 +37,7 @@ Shindo.tests('Excon proxy support') do
37
37
  connection.data[:proxy][:host]
38
38
  end
39
39
 
40
- tests('connection.data[:proxy][:port]').returns('8080') do
40
+ tests('connection.data[:proxy][:port]').returns(8080) do
41
41
  connection.data[:proxy][:port]
42
42
  end
43
43
 
@@ -53,7 +53,7 @@ Shindo.tests('Excon proxy support') do
53
53
  connection.data[:proxy][:host]
54
54
  end
55
55
 
56
- tests('connection.data[:proxy][:port]').returns('8081') do
56
+ tests('connection.data[:proxy][:port]').returns(8081) do
57
57
  connection.data[:proxy][:port]
58
58
  end
59
59
 
@@ -69,7 +69,7 @@ Shindo.tests('Excon proxy support') do
69
69
  connection.data[:proxy][:host]
70
70
  end
71
71
 
72
- tests('connection.data[:proxy][:port]').returns('8080') do
72
+ tests('connection.data[:proxy][:port]').returns(8080) do
73
73
  connection.data[:proxy][:port]
74
74
  end
75
75
  end
@@ -125,7 +125,7 @@ Shindo.tests('Excon proxy support') do
125
125
  connection.data[:proxy][:host]
126
126
  end
127
127
 
128
- tests('connection.data[:proxy][:port]').returns('8080') do
128
+ tests('connection.data[:proxy][:port]').returns(8080) do
129
129
  connection.data[:proxy][:port]
130
130
  end
131
131
 
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.2
4
+ version: 0.27.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-10-10 00:00:00.000000000 Z
14
+ date: 2013-10-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -243,7 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
243
243
  version: '0'
244
244
  segments:
245
245
  - 0
246
- hash: 1278435808778456235
246
+ hash: -196741291753928057
247
247
  required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  none: false
249
249
  requirements: