excon 0.14.3 → 0.15.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.

data/README.md CHANGED
@@ -155,11 +155,11 @@ By default excon will try to verify peer certificates when using SSL for HTTPS.
155
155
 
156
156
  If you have the misfortune of running into this problem you have a couple options. If you have certificates but they aren't being auto-discovered, you can specify the path to your certificates:
157
157
 
158
- Excon.ssl_ca_path = '/path/to/certs'
158
+ Excon.defaults[:ssl_ca_path] = '/path/to/certs'
159
159
 
160
160
  Failing that, you can turn off peer verification (less secure):
161
161
 
162
- Excon.ssl_verify_peer = false
162
+ Excon.defaults[:ssl_verify_peer] = false
163
163
 
164
164
  Either of these should allow you to work around the socket error and continue with your work.
165
165
 
@@ -1,3 +1,10 @@
1
+ 0.15.0 07/16/12
2
+ ===============
3
+
4
+ clarifications in README
5
+ added base error class to message for Excon::SocketError
6
+ fixes for proxy, sets properly on http and passes auth
7
+
1
8
  0.14.3 07/05/12
2
9
  ===============
3
10
 
@@ -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.14.3'
17
- s.date = '2012-07-05'
16
+ s.version = '0.15.0'
17
+ s.date = '2012-07-16'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -52,8 +52,7 @@ module Excon
52
52
 
53
53
  # Use Basic Auth if url contains a login
54
54
  if uri.user || uri.password
55
- auth = ["#{uri.user}:#{uri.password}"].pack('m').delete("\r\n")
56
- @connection[:headers]['Authorization'] ||= "Basic #{auth}"
55
+ @connection[:headers]['Authorization'] ||= 'Basic ' << ['' << uri.user << ':' << uri.password].pack('m').delete(EXCON::CR_NL)
57
56
  end
58
57
 
59
58
  @socket_key = '' << @connection[:host] << ':' << @connection[:port].to_s
@@ -356,7 +355,13 @@ module Excon
356
355
  unless uri.host and uri.port and uri.scheme
357
356
  raise Excon::Errors::ProxyParseError, "Proxy is invalid"
358
357
  end
359
- {:host => uri.host, :port => uri.port, :scheme => uri.scheme}
358
+ {
359
+ :host => uri.host,
360
+ :password => uri.password,
361
+ :port => uri.port,
362
+ :scheme => uri.scheme,
363
+ :user => uri.user
364
+ }
360
365
  end
361
366
 
362
367
  end
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
  unless const_defined?(:VERSION)
3
- VERSION = '0.14.3'
3
+ VERSION = '0.15.0'
4
4
  end
5
5
 
6
6
  unless const_defined?(:CHUNK_SIZE)
@@ -10,7 +10,7 @@ module Excon
10
10
  if socket_error.message =~ /certificate verify failed/
11
11
  super('Unable to verify certificate, please set `Excon.defaults[:ssl_ca_path] = path_to_certs`, `Excon.defaults[:ssl_ca_file] = path_to_file`, or `Excon.defaults[:ssl_verify_peer] = false` (less secure).')
12
12
  else
13
- super(socket_error.message)
13
+ super("#{socket_error.message} (#{socket_error.class})")
14
14
  end
15
15
  set_backtrace(socket_error.backtrace)
16
16
  @socket_error = socket_error
@@ -66,6 +66,30 @@ module Excon
66
66
  # this will be our last encountered exception
67
67
  raise exception
68
68
  end
69
+
70
+ initialize_proxy
71
+ end
72
+
73
+ def initialize_proxy
74
+ if @proxy
75
+ request = 'CONNECT ' << @params[:host] << ':' << @params[:port] << Excon::HTTP_1_1
76
+ request << 'Host: ' << @params[:host] << ':' << @params[:port] << Excon::CR_NL
77
+
78
+ if @proxy[:password] || @proxy[:user]
79
+ auth = ['' << uri.user << ':' << uri.password].pack('m').delete(EXCON::CR_NL)
80
+ request << "Proxy-Authorization: Basic " << auth << Excon::CR_NL
81
+ end
82
+
83
+ request << Excon::CR_NL
84
+
85
+ # write out the proxy setup request
86
+ @socket.write(request)
87
+
88
+ # eat the proxy's connection response
89
+ while line = @socket.readline.strip
90
+ break if line.empty?
91
+ end
92
+ end
69
93
  end
70
94
 
71
95
  def read(max_length=nil)
@@ -60,15 +60,7 @@ module Excon
60
60
  @socket = OpenSSL::SSL::SSLSocket.new(@socket, ssl_context)
61
61
  @socket.sync_close = true
62
62
 
63
- if @proxy
64
- @socket << "CONNECT " << @params[:host] << ":" << @params[:port] << Excon::HTTP_1_1
65
- @socket << "Host: " << @params[:host] << ":" << @params[:port] << Excon::CR_NL << Excon::CR_NL
66
-
67
- # eat the proxy's connection response
68
- while line = @socket.readline.strip
69
- break if line.empty?
70
- end
71
- end
63
+ initialize_proxy
72
64
 
73
65
  # connect the new OpenSSL::SSL::SSLSocket
74
66
  @socket.connect
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.14.3
4
+ version: 0.15.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-07-05 00:00:00.000000000Z
14
+ date: 2012-07-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
18
- requirement: &70300800927500 !ruby/object:Gem::Requirement
18
+ requirement: &70326692727560 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :development
25
25
  prerelease: false
26
- version_requirements: *70300800927500
26
+ version_requirements: *70326692727560
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: delorean
29
- requirement: &70300800926780 !ruby/object:Gem::Requirement
29
+ requirement: &70326692726620 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *70300800926780
37
+ version_requirements: *70326692726620
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: open4
40
- requirement: &70300800925500 !ruby/object:Gem::Requirement
40
+ requirement: &70326692725180 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70300800925500
48
+ version_requirements: *70326692725180
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rake
51
- requirement: &70300800924680 !ruby/object:Gem::Requirement
51
+ requirement: &70326692723720 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70300800924680
59
+ version_requirements: *70326692723720
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rdoc
62
- requirement: &70300800924060 !ruby/object:Gem::Requirement
62
+ requirement: &70326692722820 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70300800924060
70
+ version_requirements: *70326692722820
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: shindo
73
- requirement: &70300800923500 !ruby/object:Gem::Requirement
73
+ requirement: &70326692722200 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *70300800923500
81
+ version_requirements: *70326692722200
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: sinatra
84
- requirement: &70300800922640 !ruby/object:Gem::Requirement
84
+ requirement: &70326692720900 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,7 +89,7 @@ dependencies:
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *70300800922640
92
+ version_requirements: *70326692720900
93
93
  description: EXtended http(s) CONnections
94
94
  email: geemus@gmail.com
95
95
  executables: []
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: -3694586687950999890
171
+ hash: 3388892203707027990
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements:
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  requirements: []
179
179
  rubyforge_project: excon
180
- rubygems_version: 1.8.10
180
+ rubygems_version: 1.8.15
181
181
  signing_key:
182
182
  specification_version: 2
183
183
  summary: speed, persistence, http(s)