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 +2 -2
- data/changelog.txt +7 -0
- data/excon.gemspec +2 -2
- data/lib/excon/connection.rb +8 -3
- data/lib/excon/constants.rb +1 -1
- data/lib/excon/errors.rb +1 -1
- data/lib/excon/socket.rb +24 -0
- data/lib/excon/ssl_socket.rb +1 -9
- metadata +18 -18
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
|
|
data/changelog.txt
CHANGED
data/excon.gemspec
CHANGED
@@ -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.
|
17
|
-
s.date = '2012-07-
|
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
|
data/lib/excon/connection.rb
CHANGED
@@ -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
|
-
|
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
|
-
{
|
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
|
data/lib/excon/constants.rb
CHANGED
data/lib/excon/errors.rb
CHANGED
@@ -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
|
data/lib/excon/socket.rb
CHANGED
@@ -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)
|
data/lib/excon/ssl_socket.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
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: &
|
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: *
|
26
|
+
version_requirements: *70326692727560
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: delorean
|
29
|
-
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: *
|
37
|
+
version_requirements: *70326692726620
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: open4
|
40
|
-
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: *
|
48
|
+
version_requirements: *70326692725180
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rake
|
51
|
-
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: *
|
59
|
+
version_requirements: *70326692723720
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rdoc
|
62
|
-
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: *
|
70
|
+
version_requirements: *70326692722820
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: shindo
|
73
|
-
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: *
|
81
|
+
version_requirements: *70326692722200
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: sinatra
|
84
|
-
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: *
|
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:
|
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.
|
180
|
+
rubygems_version: 1.8.15
|
181
181
|
signing_key:
|
182
182
|
specification_version: 2
|
183
183
|
summary: speed, persistence, http(s)
|