excon 0.37.0 → 0.38.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,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTA1OTcwN2U0ZDZkNWFiYWI0ZGY3NzkzZjgwNDg0MDJlOTI0OGM2Ng==
4
+ N2Q1NWY3Zjk1ZmMzZTc5ZTFjODAzZGMyZmUwMTljYTkyYTFjNjAxMw==
5
5
  data.tar.gz: !binary |-
6
- MDhkY2IzMmQyNmU1NTQ1MzA4NTRlZDljMDNlYzkxMzI2YjRhMjNjOQ==
6
+ NjFkNTZhNTlmMGFkN2MwNjJjNDEzZjM2MGYyYjg3OTNhNTM5NjM5Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTMxZjAyMDViNmI2N2MzY2VhYjQyMDg1OTU1ZmZmN2U2NTk5Y2NjNDQ5ZDMw
10
- MWNlMWRlNzYyNWM3ZGE5MjkyZDhjYjk2NTI5YjU1NTIxMWM3MTk0Yjc4M2M0
11
- MjQxMmU1NzM3ZGQxZGM1NGFlMjYzMWIxZjI5NzRmNThlODJmNTU=
9
+ NjE0NGE3NzdiMDA4YTg0NWIyNDMxNGMyMDBiY2I4MDkzZjRjYWU4NzE1Nzhl
10
+ Yjk5N2YyYjRlYzdlMDBlM2VhYTU1MTQ4OTU5Zjc2YTc4OWY1OWMwMTNjODdm
11
+ ZDkxZWVhODdiYmVkNzgzMGU2MGY1NjNmMjBhOTQ2MThmNWQzNGY=
12
12
  data.tar.gz: !binary |-
13
- ZDQxMWEyZjljYzk1ZTljOTdiMTc4Njk5NzEzNGQxYWFhODU1MDgzZWI3Nzkw
14
- OWQzOTgwODZkMzliYmVhOGY5YTdiNGZhYTExOTI5MmRmOTA4MmIyNDJjOTRl
15
- ZmRlNmYzNDhiZmJkNzk5ZjJiM2JlODQ2ZWFiM2RhZjc3MDhiOWY=
13
+ NWQ5OTYyMzhlNzMwZWRlMGY1ODUxMWFkZjU0MWQ1MmRiMjUyMGNjMDA1ZjIw
14
+ ZjI2YTlhNzZiN2Y1ODg4MGFjMTNjNDljMmU5NzFiNmFhNzMyMjk1YTQxMzg0
15
+ YjdhYWNlZmUwYjI4MTc1ZTU2NDAwNThlMjljODVjMTc1ZjIyNTg=
@@ -14,7 +14,7 @@ New contributors are always welcome, when it doubt please ask questions. We stri
14
14
 
15
15
  ### Non-Coding
16
16
 
17
- * Work for {twitter}[http://twitter.com]? I'd love to reclaim the unused {@excon}[http://twitter.com/excon] account!
17
+ * Work for [twitter](http://twitter.com)? I'd love to reclaim the unused [@excon](http://twitter.com/excon) account!
18
18
  * Offer feedback on open [issues](https://github.com/excon/excon/issues).
19
19
  * Write and help edit [documentation](https://github.com/excon/excon.github.com).
20
20
  * Translate [documentation](https://github.com/excon/excon.github.com) in to other languages.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- excon (0.37.0)
4
+ excon (0.38.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -4,7 +4,7 @@ Usable, fast, simple Ruby HTTP 1.1
4
4
 
5
5
  Excon was designed to be simple, fast and performant. It works great as a general HTTP(s) client and is particularly well suited to usage in API clients.
6
6
 
7
- [![Build Status](https://secure.travis-ci.org/geemus/excon.png)](http://travis-ci.org/geemus/excon)
7
+ [![Build Status](https://secure.travis-ci.org/excon/excon.png)](http://travis-ci.org/excon/excon)
8
8
  [![Dependency Status](https://gemnasium.com/geemus/excon.png)](https://gemnasium.com/geemus/excon)
9
9
  [![Gem Version](https://fury-badge.herokuapp.com/rb/excon.png)](http://badge.fury.io/rb/excon)
10
10
  [![Gittip](http://img.shields.io/gittip/geemus.png)](https://www.gittip.com/geemus/)
@@ -339,7 +339,7 @@ The #instrument method will be called for each HTTP request, response, retry, an
339
339
 
340
340
  For debugging purposes you can also use Excon::StandardInstrumentor to output all events to stderr. This can also be specified by setting the `EXCON_DEBUG` ENV var.
341
341
 
342
- See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's instrumentation_test.rb for more examples of instrumenting excon.
342
+ See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's [instrumentation_test.rb](https://github.com/excon/excon/blob/master/tests/middlewares/instrumentation_tests.rb) for more examples of instrumenting excon.
343
343
 
344
344
  ## HTTPS/SSL Issues
345
345
 
@@ -363,12 +363,12 @@ Either of these should allow you to work around the socket error and continue wi
363
363
 
364
364
  * [General Documentation](http://excon.io).
365
365
  * Ask specific questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/excon).
366
- * Report bugs and discuss potential features in [Github issues](https://github.com/geemus/excon/issues).
366
+ * Report bugs and discuss potential features in [Github issues](https://github.com/excon/excon/issues).
367
367
 
368
368
  ## Contributing
369
369
 
370
- Please refer to [CONTRIBUTING.md](https://github.com/geemus/excon/blob/master/CONTRIBUTING.md).
370
+ Please refer to [CONTRIBUTING.md](https://github.com/excon/excon/blob/master/CONTRIBUTING.md).
371
371
 
372
372
  ## License
373
373
 
374
- Please refer to [LICENSE.md](https://github.com/geemus/excon/blob/master/LICENSE.md).
374
+ Please refer to [LICENSE.md](https://github.com/excon/excon/blob/master/LICENSE.md).
@@ -1,3 +1,11 @@
1
+ 0.38.0 07/09/2014
2
+ =================
3
+
4
+ avoid reading non-file bodies (mock related fix)
5
+ fixes to readme links
6
+ fix excon_debug to set debug_response
7
+ ensure both \r and \n are read when parsing headers
8
+
1
9
  0.37.0 06/09/2014
2
10
  =================
3
11
 
@@ -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.37.0'
17
- s.date = '2014-06-09'
16
+ s.version = '0.38.0'
17
+ s.date = '2014-07-09'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  ## a custom homepage, consider using your GitHub URL or the like.
28
28
  s.authors = ["dpiddy (Dan Peterson)", "geemus (Wesley Beary)", "nextmat (Matt Sanders)"]
29
29
  s.email = 'geemus@gmail.com'
30
- s.homepage = 'https://github.com/geemus/excon'
30
+ s.homepage = 'https://github.com/excon/excon'
31
31
  s.license = 'MIT'
32
32
 
33
33
  ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
@@ -85,7 +85,7 @@ module Excon
85
85
  @data[:instrumentor] = Excon::StandardInstrumentor
86
86
 
87
87
  if ENV.has_key?('EXCON_DEBUG')
88
- @data[:debug_request] = @data[:debug_reponse] = true
88
+ @data[:debug_request] = @data[:debug_response] = true
89
89
  end
90
90
  end
91
91
 
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
 
3
- VERSION = '0.37.0'
3
+ VERSION = '0.38.0'
4
4
 
5
5
  CR_NL = "\r\n"
6
6
 
@@ -3,6 +3,7 @@ module Excon
3
3
 
4
4
  class Error < StandardError; end
5
5
  class StubNotFound < StandardError; end
6
+ class InvalidStub < StandardError; end
6
7
 
7
8
  class SocketError < Error
8
9
  attr_reader :socket_error
@@ -4,7 +4,7 @@ module Excon
4
4
  def request_call(datum)
5
5
  if datum[:mock]
6
6
  # convert File/Tempfile body to string before matching:
7
- unless datum[:body].nil? || datum[:body].is_a?(String)
7
+ if datum[:body].respond_to?(:read)
8
8
  if datum[:body].respond_to?(:binmode)
9
9
  datum[:body].binmode
10
10
  end
@@ -12,6 +12,8 @@ module Excon
12
12
  datum[:body].rewind
13
13
  end
14
14
  datum[:body] = datum[:body].read
15
+ elsif !datum[:body].nil? && !datum[:body].is_a?(String)
16
+ raise Excon::Errors::InvalidStub.new("Request body should be a string or an IO object. #{datum[:body].class} provided")
15
17
  end
16
18
 
17
19
  if stub = Excon.stub_for(datum)
@@ -83,7 +83,10 @@ module Excon
83
83
  chunk_size -= chunk.bytesize
84
84
  response_block.call(chunk, nil, nil)
85
85
  end
86
- socket.read(2) # 2 == "\r\n".length
86
+ new_line_size = 2 # 2 == "\r\n".length
87
+ while new_line_size > 0
88
+ new_line_size -= socket.read(new_line_size).length
89
+ end
87
90
  end
88
91
  else
89
92
  while (chunk_size = socket.readline.chomp!.to_i(16)) > 0
@@ -92,7 +95,10 @@ module Excon
92
95
  chunk_size -= chunk.bytesize
93
96
  datum[:response][:body] << chunk
94
97
  end
95
- socket.read(2) # 2 == "\r\n".length
98
+ new_line_size = 2 # 2 == "\r\n".length
99
+ while new_line_size > 0
100
+ new_line_size -= socket.read(new_line_size).length
101
+ end
96
102
  end
97
103
  end
98
104
  parse_headers(socket, datum) # merge trailers into headers
@@ -132,6 +132,12 @@ Shindo.tests('Excon stubs') do
132
132
 
133
133
  end
134
134
 
135
+ tests("invalid stub response").raises(Excon::Errors::InvalidStub) do
136
+ Excon.stub({:body => 42, :method => :get}, {:status => 200})
137
+ connection = Excon.new('http://127.0.0.1:9292', :mock => true)
138
+ connection.request(:body => 42, :method => :get, :path => '/').status
139
+ end
140
+
135
141
  tests("mismatched stub").raises(Excon::Errors::StubNotFound) do
136
142
  Excon.stub({:method => :post}, {:body => 'body'})
137
143
  Excon.get('http://127.0.0.1:9292/', :mock => true)
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.37.0
4
+ version: 0.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-09 00:00:00.000000000 Z
13
+ date: 2014-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -224,7 +224,7 @@ files:
224
224
  - tests/thread_safety_tests.rb
225
225
  - tests/timeout_tests.rb
226
226
  - tests/utils_tests.rb
227
- homepage: https://github.com/geemus/excon
227
+ homepage: https://github.com/excon/excon
228
228
  licenses:
229
229
  - MIT
230
230
  metadata: {}