excon 0.40.0 → 0.41.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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ODlkNWVjNzM5NDE2MzY0NzhmYWRlYzJjNDYzMWI3NTE0ZDQ4MWJlNg==
5
- data.tar.gz: !binary |-
6
- ZGFiN2VhOTJiNDRjMGVhYWE3YjU0NjIyYjZiZTg3YWIyMmU0ZThjMQ==
2
+ SHA1:
3
+ metadata.gz: c8ebf3518cde85fc3af71ea0cf17a505b2a94be1
4
+ data.tar.gz: be825cbf92ebc6383d2adcda8f536dd9e1c08575
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDMxNjEzM2M1YjhmNmE4MTNjMjljNDkzNWMyZjUxNmIyYWE2ZGFiYmQyMDBk
10
- MWQzZTZlMDE1YzE3MmEwZWQzMjQyMGFiMWViZjhlMzlmZjI0M2IwMDE5YmI4
11
- ODg4MjczZDczYjNhZDhlMzA5MTAwNTlkNjZhMzk1Njc4ZDgzYjc=
12
- data.tar.gz: !binary |-
13
- ZDk4MTk3ZmYxYjJkY2E5YTFhNWFjMWUxYmEyYTA5MjllNWVhZmY1NjEwOTU0
14
- YzUyYjY1NDcwZmYyZTEwNzQ0M2RmZWY3YjE1YjlkYTk2NmU3NGYyOGFmNTNh
15
- YWFkYTc1OTkxYTk0NTI2MzFjZjFmM2MwMDg0Mzc5OTM0YzE3YmQ=
6
+ metadata.gz: db487e313f577d715204046da7676e155061e5c954690217f318bf98238ae462d7a6b41b5edc4f587804c5bf4a42c7826d9fbef9ca9d3beecdff88ddc12fc0cb
7
+ data.tar.gz: 11f213779b3e188003abf391fe4d7304dd2a28481a6bf090c5e7b9fb6b57e3dfbbc8ab3a4162be385d67cb07cf49b1bb58f7e8f8f3c58a568fb635de9c9d3f33
@@ -19,6 +19,8 @@
19
19
  * Dane Harrigan <dane.harrigan@gmail.com>
20
20
  * Dave Myron <therealdave.myron@gmail.com>
21
21
  * Dave Newton <davelnewton@gmail.com>
22
+ * David Biehl <dbiehl@ncmedical.com>
23
+ * David Biehl <lazylodr@gmail.com>
22
24
  * Dimitrij Denissenko <dimitrij@blacksquaremedia.com>
23
25
  * Dominik Richter <dominik.richter@gmail.com>
24
26
  * Eugene Howe <eugene@xtreme-computers.net>
@@ -28,6 +30,7 @@
28
30
  * Glenn Pratt <glennpratt@gmail.com>
29
31
  * Graeme Nelson <graeme.nelson@gmail.com>
30
32
  * Hakan Ensari <hakan.ensari@papercavalier.com>
33
+ * Ian Neubert <ian@ianneubert.com>
31
34
  * Jacob Atzen <jacob@incremental.dk>
32
35
  * James Watling <watling.james@gmail.com>
33
36
  * Jeremy Hinegardner <jeremy@copiousfreetime.org>
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- excon (0.40.0)
4
+ excon (0.41.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,3 +1,9 @@
1
+ 0.41.0 11/05/2014
2
+ =================
3
+
4
+ add :ssl_verify_peer_host option for dev purposes
5
+ add #reason_phrase to response
6
+
1
7
  0.40.0 10/06/2014
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.40.0'
17
- s.date = '2014-10-06'
16
+ s.version = '0.41.0'
17
+ s.date = '2014-11-05'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -120,6 +120,8 @@ Gem::Specification.new do |s|
120
120
  tests/authorization_header_tests.rb
121
121
  tests/bad_tests.rb
122
122
  tests/basic_tests.rb
123
+ tests/data/127.0.0.1.cert.crt
124
+ tests/data/127.0.0.1.cert.key
123
125
  tests/data/excon.cert.crt
124
126
  tests/data/excon.cert.key
125
127
  tests/data/xs
@@ -145,6 +147,7 @@ Gem::Specification.new do |s|
145
147
  tests/rackups/request_methods.ru
146
148
  tests/rackups/response_header.ru
147
149
  tests/rackups/ssl.ru
150
+ tests/rackups/ssl_mismatched_cn.ru
148
151
  tests/rackups/ssl_verify_peer.ru
149
152
  tests/rackups/streaming.ru
150
153
  tests/rackups/thread_safety.ru
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
 
3
- VERSION = '0.40.0'
3
+ VERSION = '0.41.0'
4
4
 
5
5
  CR_NL = "\r\n"
6
6
 
@@ -84,6 +84,7 @@ module Excon
84
84
  :ssl_ca_path,
85
85
  :ssl_verify_callback,
86
86
  :ssl_verify_peer,
87
+ :ssl_verify_peer_host,
87
88
  :ssl_version,
88
89
  :tcp_nodelay,
89
90
  :uri_parser,
@@ -22,6 +22,12 @@ module Excon
22
22
  def status
23
23
  @data[:status]
24
24
  end
25
+ def reason_phrase=(new_reason_phrase)
26
+ @data[:reason_phrase] = new_reason_phrase
27
+ end
28
+ def reason_phrase
29
+ @data[:reason_phrase]
30
+ end
25
31
  def remote_ip=(new_remote_ip)
26
32
  @data[:remote_ip] = new_remote_ip
27
33
  end
@@ -37,13 +43,17 @@ module Excon
37
43
 
38
44
  def self.parse(socket, datum)
39
45
  # this will discard any trailing lines from the previous response if any.
40
- until status = socket.readline[9,11].to_i
41
- end
46
+ begin
47
+ line = socket.readline
48
+ end until status = line[9, 3].to_i
49
+
50
+ reason_phrase = line[13..-3] # -3 strips the trailing "\r\n"
42
51
 
43
52
  datum[:response] = {
44
53
  :body => '',
45
54
  :headers => Excon::Headers.new,
46
- :status => status
55
+ :status => status,
56
+ :reason_phrase => reason_phrase
47
57
  }
48
58
 
49
59
  unix_proxy = datum[:proxy] ? datum[:proxy][:scheme] == UNIX : false
@@ -126,7 +126,7 @@ module Excon
126
126
 
127
127
  # verify connection
128
128
  if @data[:ssl_verify_peer]
129
- @socket.post_connection_check(@data[:host])
129
+ @socket.post_connection_check(@data[:ssl_verify_peer_host] || @data[:host])
130
130
  end
131
131
 
132
132
  @socket
@@ -112,6 +112,38 @@ Shindo.tests('Excon basics (ssl)') do
112
112
  end
113
113
  end
114
114
 
115
+ Shindo.tests('Excon ssl verify peer (ssl)') do
116
+ with_rackup('ssl.ru') do
117
+ connection = nil
118
+ test do
119
+ ssl_ca_file = File.join(File.dirname(__FILE__), 'data', '127.0.0.1.cert.crt')
120
+ connection = Excon.new('https://127.0.0.1:9443', :ssl_verify_peer => true, :ssl_ca_file => ssl_ca_file )
121
+ true
122
+ end
123
+
124
+ tests('response.status').returns(200) do
125
+ response = connection.request(:method => :get, :path => '/content-length/100')
126
+
127
+ response.status
128
+ end
129
+ end
130
+
131
+ with_rackup('ssl_mismatched_cn.ru') do
132
+ connection = nil
133
+ test do
134
+ ssl_ca_file = File.join(File.dirname(__FILE__), 'data', 'excon.cert.crt')
135
+ connection = Excon.new('https://127.0.0.1:9443', :ssl_verify_peer => true, :ssl_ca_file => ssl_ca_file, :ssl_verify_peer_host => 'Excon' )
136
+ true
137
+ end
138
+
139
+ tests('response.status').returns(200) do
140
+ response = connection.request(:method => :get, :path => '/content-length/100')
141
+
142
+ response.status
143
+ end
144
+ end
145
+ end
146
+
115
147
  Shindo.tests('Excon basics (ssl file)',['focus']) do
116
148
  with_rackup('ssl_verify_peer.ru') do
117
149
 
@@ -0,0 +1,14 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIICEzCCAXwCCQC94mWSE0+JcjANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
3
+ UzELMAkGA1UECBMCQ0ExDjAMBgNVBAoTBUV4Y29uMQ4wDAYDVQQLEwVFeGNvbjES
4
+ MBAGA1UEAxMJMTI3LjAuMC4xMB4XDTE0MTAyODIwMjMzMVoXDTE5MTAyNzIwMjMz
5
+ MVowTjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQ4wDAYDVQQKEwVFeGNvbjEO
6
+ MAwGA1UECxMFRXhjb24xEjAQBgNVBAMTCT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F7me
10
+ Znwpq0jLlKRlKatVjkO/mkOeWs1/8MhQfwJBAO5VkVKJ3IjAF7fCFDvjUwfEm/Sr
11
+ NyJyQvk5tx0PrqEkpSZhYFUXaljNQ6/b1mJ9Yu9+yrye+MGnu73Vuy9eIasCQFT4
12
+ fejA0y+X+5xul6Xwl9zDKiLczPkPPhUeSBoBbn/9pcEIwFd4DkmKzud1LxBafKUj
13
+ pEgm7GcOp5oPlM8PCQUCQQCtPFpgobUK9nRewxWagUL+xlEo6C1CPFhTwtQvnyi9
14
+ 6UwgxZtOdzAc3xRvHo4uK3OwGuOklqkpIeiZg3hoZb6B
15
+ -----END RSA PRIVATE KEY-----
@@ -4,9 +4,13 @@ require 'webrick/https'
4
4
 
5
5
  require File.join(File.dirname(__FILE__), 'basic')
6
6
 
7
+ key_file = File.join(File.dirname(__FILE__), '..', 'data', '127.0.0.1.cert.key')
8
+ cert_file = File.join(File.dirname(__FILE__), '..', 'data', '127.0.0.1.cert.crt')
7
9
  Rack::Handler::WEBrick.run(Basic, {
8
10
  :Port => 9443,
9
- :SSLCertName => [["CN", WEBrick::Utils::getservername]],
10
11
  :SSLEnable => true,
11
- :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE
12
+ :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(key_file).read),
13
+ :SSLCertificate => OpenSSL::X509::Certificate.new(File.open(cert_file).read),
14
+ :SSLCACertificateFile => cert_file,
15
+ :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
12
16
  })
@@ -0,0 +1,15 @@
1
+ require 'openssl'
2
+ require 'webrick'
3
+ require 'webrick/https'
4
+
5
+ require File.join(File.dirname(__FILE__), 'basic')
6
+ key_file = File.join(File.dirname(__FILE__), '..', 'data', 'excon.cert.key')
7
+ cert_file = File.join(File.dirname(__FILE__), '..', 'data', 'excon.cert.crt')
8
+ Rack::Handler::WEBrick.run(Basic, {
9
+ :Port => 9443,
10
+ :SSLEnable => true,
11
+ :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(key_file).read),
12
+ :SSLCertificate => OpenSSL::X509::Certificate.new(File.open(cert_file).read),
13
+ :SSLCACertificateFile => cert_file,
14
+ :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
15
+ })
@@ -168,6 +168,20 @@ Shindo.tests('Excon Response Parsing') do
168
168
 
169
169
  end
170
170
 
171
+ tests('status line parsing') do
172
+
173
+ tests('proper status code').returns(404) do
174
+ resp = Excon.get('http://127.0.0.1:9292/not-found')
175
+ resp.status
176
+ end
177
+
178
+ tests('proper reason phrase').returns("Not Found") do
179
+ resp = Excon.get('http://127.0.0.1:9292/not-found')
180
+ resp.reason_phrase
181
+ end
182
+
183
+ end
184
+
171
185
  end
172
186
 
173
187
  env_restore
@@ -163,6 +163,12 @@ module GoodServer
163
163
  send_data "\r\n"
164
164
  send_data "hello world"
165
165
  end
166
+
167
+ when 'not-found'
168
+ start_response(:status => "404 Not Found")
169
+ send_data "Content-Length: 11\r\n"
170
+ send_data "\r\n"
171
+ send_data "hello world"
166
172
  end
167
173
  end
168
174
 
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.40.0
4
+ version: 0.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
@@ -10,118 +10,118 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-10-06 00:00:00.000000000 Z
13
+ date: 2014-11-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ! '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ! '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: delorean
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ! '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ! '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: eventmachine
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ! '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ! '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: open4
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ! '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ! '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rake
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ! '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ! '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rdoc
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ! '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ! '>='
96
+ - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: shindo
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ! '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ! '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: sinatra
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ! '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - ! '>='
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  description: EXtended http(s) CONnections
@@ -183,6 +183,8 @@ files:
183
183
  - tests/authorization_header_tests.rb
184
184
  - tests/bad_tests.rb
185
185
  - tests/basic_tests.rb
186
+ - tests/data/127.0.0.1.cert.crt
187
+ - tests/data/127.0.0.1.cert.key
186
188
  - tests/data/excon.cert.crt
187
189
  - tests/data/excon.cert.key
188
190
  - tests/data/xs
@@ -208,6 +210,7 @@ files:
208
210
  - tests/rackups/request_methods.ru
209
211
  - tests/rackups/response_header.ru
210
212
  - tests/rackups/ssl.ru
213
+ - tests/rackups/ssl_mismatched_cn.ru
211
214
  - tests/rackups/ssl_verify_peer.ru
212
215
  - tests/rackups/streaming.ru
213
216
  - tests/rackups/thread_safety.ru
@@ -231,22 +234,22 @@ licenses:
231
234
  metadata: {}
232
235
  post_install_message:
233
236
  rdoc_options:
234
- - --charset=UTF-8
237
+ - "--charset=UTF-8"
235
238
  require_paths:
236
239
  - lib
237
240
  required_ruby_version: !ruby/object:Gem::Requirement
238
241
  requirements:
239
- - - ! '>='
242
+ - - ">="
240
243
  - !ruby/object:Gem::Version
241
244
  version: '0'
242
245
  required_rubygems_version: !ruby/object:Gem::Requirement
243
246
  requirements:
244
- - - ! '>='
247
+ - - ">="
245
248
  - !ruby/object:Gem::Version
246
249
  version: '0'
247
250
  requirements: []
248
251
  rubyforge_project: excon
249
- rubygems_version: 2.3.0
252
+ rubygems_version: 2.2.2
250
253
  signing_key:
251
254
  specification_version: 2
252
255
  summary: speed, persistence, http(s)