excon 0.7.1 → 0.7.2

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/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.7.1'
17
- s.date = '2011-09-13'
16
+ s.version = '0.7.2'
17
+ s.date = '2011-09-23'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -214,7 +214,7 @@ module Excon
214
214
  def reset
215
215
  (old_socket = sockets.delete(@socket_key)) && old_socket.close
216
216
  end
217
-
217
+
218
218
  # Generate HTTP request verb methods
219
219
  Excon::HTTP_VERBS.each do |method|
220
220
  eval <<-DEF
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
  unless const_defined?(:VERSION)
3
- VERSION = '0.7.1'
3
+ VERSION = '0.7.2'
4
4
  end
5
5
 
6
6
  unless const_defined?(:CHUNK_SIZE)
data/lib/excon/errors.rb CHANGED
@@ -17,6 +17,8 @@ module Excon
17
17
  end
18
18
  end
19
19
 
20
+ class Timeout < Error; end
21
+
20
22
  class ProxyParseError < Error; end
21
23
 
22
24
  class StubNotFound < Error; end
data/lib/excon/socket.rb CHANGED
@@ -45,7 +45,7 @@ module Excon
45
45
  if IO.select([@socket], nil, nil, @connection_params[:read_timeout])
46
46
  retry
47
47
  else
48
- raise(Timeout::Error)
48
+ raise(Excon::Errors::Timeout.new("read timeout reached"))
49
49
  end
50
50
  end
51
51
  @read_buffer.slice!(0, max_length)
@@ -56,12 +56,13 @@ module Excon
56
56
  until @write_buffer.empty?
57
57
  begin
58
58
  max_length = [@write_buffer.length, Excon::CHUNK_SIZE].min
59
- @socket.write_nonblock(@write_buffer.slice!(0, max_length))
59
+ written = @socket.write_nonblock(@write_buffer.slice(0, max_length))
60
+ @write_buffer.slice!(0, written)
60
61
  rescue Errno::EAGAIN, Errno::EWOULDBLOCK
61
- if IO.select(nil [@socket], nil, @connection_params[:write_timeout])
62
+ if IO.select(nil, [@socket], nil, @connection_params[:write_timeout])
62
63
  retry
63
64
  else
64
- raise(Timeout::Error)
65
+ raise(Excon::Errors::Timeout.new("write timeout reached"))
65
66
  end
66
67
  end
67
68
  end
@@ -5,6 +5,10 @@ class App < Sinatra::Base
5
5
  headers("Custom" => "Foo: bar")
6
6
  'x' * value.to_i
7
7
  end
8
+
9
+ post('/body-sink') do
10
+ request.body.read.size.to_s
11
+ end
8
12
  end
9
13
 
10
14
  run App
data/tests/rackups/ssl.ru CHANGED
@@ -8,6 +8,10 @@ class App < Sinatra::Base
8
8
  headers("Custom" => "Foo: bar")
9
9
  'x' * value.to_i
10
10
  end
11
+
12
+ post('/body-sink') do
13
+ request.body.read.size.to_s
14
+ end
11
15
  end
12
16
 
13
17
  Rack::Handler::WEBrick.run(App, {
data/tests/test_helper.rb CHANGED
@@ -48,6 +48,17 @@ def basic_tests(url = 'http://127.0.0.1:9292')
48
48
  end
49
49
  data
50
50
  end
51
+
52
+ end
53
+
54
+ tests('POST /body-sink') do
55
+
56
+ connection = Excon.new(url)
57
+ response = connection.request(:method => :post, :path => '/body-sink', :body => 'x' * 5_000_000)
58
+
59
+ tests('response.body').returns("5000000") do
60
+ response.body
61
+ end
51
62
  end
52
63
  end
53
64
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 1
10
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - geemus (Wesley Beary)
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-13 00:00:00 Z
18
+ date: 2011-09-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: open4