excon 0.36.0 → 0.37.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
- NDU5NjFhMTVjODUyOTk3NWI0NzRmNjI4YTlkY2U4ZGU4M2JlZDNlNQ==
4
+ ZTA1OTcwN2U0ZDZkNWFiYWI0ZGY3NzkzZjgwNDg0MDJlOTI0OGM2Ng==
5
5
  data.tar.gz: !binary |-
6
- M2ExNjg1NjdjZDFjMGMxNmMwNzQwM2NmOWEwMTBmN2U4ZWUxY2NjZg==
6
+ MDhkY2IzMmQyNmU1NTQ1MzA4NTRlZDljMDNlYzkxMzI2YjRhMjNjOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWViOTA0NjQ1N2E5ZWY0ZTlmNGJiZTE0ZmUzMTg2YmFhOTQ0NDBhYTRlMWVk
10
- MzM2OWI2YzE3MjQzMzA2ZTY3ZWUxYWUzMzI2ZGJlYWRkNjMyODYzODhhYTBj
11
- M2Q1NDZjYzA2N2UwYmY3YmM4YzU3NzI0M2YxYjY4YzZiNzU4ZTc=
9
+ NTMxZjAyMDViNmI2N2MzY2VhYjQyMDg1OTU1ZmZmN2U2NTk5Y2NjNDQ5ZDMw
10
+ MWNlMWRlNzYyNWM3ZGE5MjkyZDhjYjk2NTI5YjU1NTIxMWM3MTk0Yjc4M2M0
11
+ MjQxMmU1NzM3ZGQxZGM1NGFlMjYzMWIxZjI5NzRmNThlODJmNTU=
12
12
  data.tar.gz: !binary |-
13
- MTM2ZTExOTYxMzFlZjlkY2E3M2Q3YjVjMDRkOGQzOTc3NTUxMGVlYzMwMzAy
14
- NWU0OTFjZWM4NDRmZjEzYTIzY2M1ZjJhYmRkYmY3MzhiNTllMDlkYWJiYWRk
15
- NjM1M2YwNmU2OTU5MDVhMjQxMTQwMTFkYTY1ZDllN2VkMTY1ZTE=
13
+ ZDQxMWEyZjljYzk1ZTljOTdiMTc4Njk5NzEzNGQxYWFhODU1MDgzZWI3Nzkw
14
+ OWQzOTgwODZkMzliYmVhOGY5YTdiNGZhYTExOTI5MmRmOTA4MmIyNDJjOTRl
15
+ ZmRlNmYzNDhiZmJkNzk5ZjJiM2JlODQ2ZWFiM2RhZjc3MDhiOWY=
data/CONTRIBUTING.md CHANGED
@@ -5,19 +5,19 @@ New contributors are always welcome, when it doubt please ask questions. We stri
5
5
  ### Coding
6
6
 
7
7
  * Pick a task:
8
- * Offer feedback on open [pull requests](https://github.com/geemus/excon/pulls).
9
- * Review open [issues](https://github.com/geemus/excon/issues) for things to help on.
10
- * [Create an issue](https://github.com/geemus/excon/issues/new) to start a discussion on additions or features.
8
+ * Offer feedback on open [pull requests](https://github.com/excon/excon/pulls).
9
+ * Review open [issues](https://github.com/excon/excon/issues) for things to help on.
10
+ * [Create an issue](https://github.com/excon/excon/issues/new) to start a discussion on additions or features.
11
11
  * Fork the project, add your changes and tests to cover them in a topic branch.
12
- * Commit your changes and rebase against `geemus/excon` to ensure everything is up to date.
13
- * [Submit a pull request](https://github.com/geemus/excon/compare/).
12
+ * Commit your changes and rebase against `excon/excon` to ensure everything is up to date.
13
+ * [Submit a pull request](https://github.com/excon/excon/compare/).
14
14
 
15
15
  ### Non-Coding
16
16
 
17
17
  * Work for {twitter}[http://twitter.com]? I'd love to reclaim the unused {@excon}[http://twitter.com/excon] account!
18
- * Offer feedback on open [issues](https://github.com/geemus/excon/issues).
19
- * Write and help edit [documentation](https://github.com/geemus/excon.github.com).
20
- * Translate [documentation](https://github.com/geemus/excon.github.com) in to other languages.
18
+ * Offer feedback on open [issues](https://github.com/excon/excon/issues).
19
+ * Write and help edit [documentation](https://github.com/excon/excon.github.com).
20
+ * Translate [documentation](https://github.com/excon/excon.github.com) in to other languages.
21
21
  * Organize or volunteer at events.
22
22
  * [Donate](https://www.gittip.com/geemus/)!
23
23
  * Discuss other ideas for contribution with [geemus](mailto:geemus+excon@gmail.com).
data/CONTRIBUTORS.md CHANGED
@@ -75,6 +75,7 @@
75
75
  * Tom Maher <tmaher@heroku.com>
76
76
  * Tom Maher <tmaher@tursom.org>
77
77
  * Trym Skaar <trym@tryms.no>
78
+ * Tuomas Silen <tuomas.silen@nodeta.fi>
78
79
  * Viven <vivien.schilis@gmail.com>
79
80
  * Wesley Beary <geemus+github@gmail.com>
80
81
  * Wesley Beary <geemus@engineyard.com>
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- excon (0.36.0)
4
+ excon (0.37.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2009-2014 [CONTRIBUTORS.md](https://github.com/geemus/excon/blob/master/CONTRIBUTORS.md)
3
+ Copyright (c) 2009-2014 [CONTRIBUTORS.md](https://github.com/excon/excon/blob/master/CONTRIBUTORS.md)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/changelog.txt CHANGED
@@ -1,3 +1,9 @@
1
+ 0.37.0 06/09/2014
2
+ =================
3
+
4
+ fix chunked reading to avoid chop! on non-chunk endings
5
+ fixes for proxy usage
6
+
1
7
  0.36.0 06/04/2014
2
8
  =================
3
9
 
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.36.0'
17
- s.date = '2014-06-04'
16
+ s.version = '0.37.0'
17
+ s.date = '2014-06-09'
18
18
  s.rubyforge_project = 'excon'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -71,10 +71,10 @@ module Excon
71
71
  end
72
72
  end
73
73
 
74
- if @data[:proxy]
74
+ if @data[:proxy] && @data[:scheme] == 'http'
75
75
  @data[:headers]['Proxy-Connection'] ||= 'Keep-Alive'
76
76
  # https credentials happen in handshake
77
- if @data[:scheme] == 'http' && (@data[:proxy][:user] || @data[:proxy][:password])
77
+ if @data[:proxy][:user] || @data[:proxy][:password]
78
78
  user, pass = Utils.unescape_form(@data[:proxy][:user].to_s), Utils.unescape_form(@data[:proxy][:password].to_s)
79
79
  auth = ['' << user.to_s << ':' << pass.to_s].pack('m').delete(Excon::CR_NL)
80
80
  @data[:headers]['Proxy-Authorization'] = 'Basic ' << auth
@@ -126,7 +126,7 @@ module Excon
126
126
  socket.data = datum
127
127
  # start with "METHOD /path"
128
128
  request = datum[:method].to_s.upcase << ' '
129
- if datum[:proxy]
129
+ if datum[:proxy] && datum[:scheme] != HTTPS
130
130
  request << datum[:scheme] << '://' << datum[:host] << port_string(datum)
131
131
  end
132
132
  request << datum[:path]
@@ -1,6 +1,6 @@
1
1
  module Excon
2
2
 
3
- VERSION = '0.36.0'
3
+ VERSION = '0.37.0'
4
4
 
5
5
  CR_NL = "\r\n"
6
6
 
@@ -77,22 +77,22 @@ module Excon
77
77
 
78
78
  if transfer_encoding_chunked
79
79
  if response_block
80
- while (chunk_size = socket.readline.chop!.to_i(16)) > 0
81
- chunk_size += 2 # 2 == "\r\n".length
80
+ while (chunk_size = socket.readline.chomp!.to_i(16)) > 0
82
81
  while chunk_size > 0
83
82
  chunk = socket.read(chunk_size)
84
- chunk_size -= chunk.length
85
- response_block.call(chunk.chop!, nil, nil)
83
+ chunk_size -= chunk.bytesize
84
+ response_block.call(chunk, nil, nil)
86
85
  end
86
+ socket.read(2) # 2 == "\r\n".length
87
87
  end
88
88
  else
89
- while (chunk_size = socket.readline.chop!.to_i(16)) > 0
90
- chunk_size += 2 # 2 == "\r\n".length
89
+ while (chunk_size = socket.readline.chomp!.to_i(16)) > 0
91
90
  while chunk_size > 0
92
91
  chunk = socket.read(chunk_size)
93
- chunk_size -= chunk.length
94
- datum[:response][:body] << chunk.chop!
92
+ chunk_size -= chunk.bytesize
93
+ datum[:response][:body] << chunk
95
94
  end
95
+ socket.read(2) # 2 == "\r\n".length
96
96
  end
97
97
  end
98
98
  parse_headers(socket, datum) # merge trailers into headers
@@ -100,14 +100,14 @@ module Excon
100
100
  if response_block
101
101
  while remaining > 0
102
102
  chunk = socket.read([datum[:chunk_size], remaining].min)
103
- response_block.call(chunk, [remaining - chunk.length, 0].max, content_length)
104
- remaining -= chunk.length
103
+ response_block.call(chunk, [remaining - chunk.bytesize, 0].max, content_length)
104
+ remaining -= chunk.bytesize
105
105
  end
106
106
  else
107
107
  while remaining > 0
108
108
  chunk = socket.read([datum[:chunk_size], remaining].min)
109
109
  datum[:response][:body] << chunk
110
- remaining -= chunk.length
110
+ remaining -= chunk.bytesize
111
111
  end
112
112
  end
113
113
  else
@@ -127,7 +127,7 @@ module Excon
127
127
 
128
128
  def self.parse_headers(socket, datum)
129
129
  last_key = nil
130
- until (data = socket.readline.chop!).empty?
130
+ until (data = socket.readline.chomp!).empty?
131
131
  if !data.lstrip!.nil?
132
132
  raise Excon::Errors::ResponseParseError, 'malformed header' unless last_key
133
133
  # append to last_key's last value
@@ -69,7 +69,7 @@ module Excon
69
69
  end
70
70
 
71
71
  if @data[:proxy]
72
- request = 'CONNECT ' << @data[:host] << port_string(@data) << Excon::HTTP_1_1
72
+ request = 'CONNECT ' << @data[:host] << port_string(@data.merge(:omit_default_port => false)) << Excon::HTTP_1_1
73
73
  request << 'Host: ' << @data[:host] << port_string(@data) << Excon::CR_NL
74
74
 
75
75
  if @data[:proxy][:password] || @data[:proxy][:user]
@@ -91,12 +91,12 @@ module Excon
91
91
  # convert Socket to OpenSSL::SSL::SSLSocket
92
92
  @socket = OpenSSL::SSL::SSLSocket.new(@socket, ssl_context)
93
93
  @socket.sync_close = true
94
-
94
+
95
95
  # Server Name Indication (SNI) RFC 3546
96
96
  if @socket.respond_to?(:hostname=)
97
97
  @socket.hostname = @data[:host]
98
98
  end
99
-
99
+
100
100
  begin
101
101
  Timeout.timeout(@data[:connect_timeout]) do
102
102
  if @nonblock
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.36.0
4
+ version: 0.37.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-04 00:00:00.000000000 Z
13
+ date: 2014-06-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport