excon 0.71.0 → 0.71.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6db50174258d3704a3bdb5cbf58cc57846d8e56f8ed55adf7e8c3f5f66f3d15
4
- data.tar.gz: 25d3d6d365d53f0197fc45e0ea698ff2b9015d58666b25a76731fe0ebc1a9918
3
+ metadata.gz: 3483232c53e58e83330497b888ceb5ae8caf357a3a420877c4a7fe215c42bc90
4
+ data.tar.gz: c6234ea3046151ac74b16863a86cf0aae15d442b50c8ec714fe0d948ec8d5e16
5
5
  SHA512:
6
- metadata.gz: cae59c2aee4eee7db9363176b63edb3e05ba9c10da29c0ce22edeb7fe623e088173f87e998cc683e2a72c2545e513461deffccb4aace8f4f5a97fd6193519e42
7
- data.tar.gz: 111b4548cd53a299b6518c2227e4db03ba939c03f8d934cf2452c35d0a25caeb6ee0f5855481663c0ff886cf37695304769730e67cebfad9b4800a4b5098593a
6
+ metadata.gz: 39a91a0d66433b6f48fe656a6bdd76bf60a337d0f6a6f1410f059b76efcc8dfba5f45b8dd5219b6501a90fb1e36c546611f54f8cd25df81556ede72d449cd6bf
7
+ data.tar.gz: fa742b6d91232d626cc109a98f12fe2584ae33bf12caecb847a8021236f3619a4eed09c48a3b4e6a9f8b1a758b4f5144536db7b821f50d1b991bdcbcbbb5342b
@@ -161,7 +161,7 @@ module Excon
161
161
  socket.write(request) # write out request + headers
162
162
  while true # write out body with chunked encoding
163
163
  chunk = datum[:request_block].call
164
- binary_encode(chunk)
164
+ chunk = binary_encode(chunk)
165
165
  if chunk.length > 0
166
166
  socket.write(chunk.length.to_s(16) << CR_NL << chunk << CR_NL)
167
167
  else
@@ -180,10 +180,10 @@ module Excon
180
180
  end
181
181
 
182
182
  # if request + headers is less than chunk size, fill with body
183
- binary_encode(request)
183
+ request = binary_encode(request)
184
184
  chunk = body.read([datum[:chunk_size] - request.length, 0].max)
185
185
  if chunk
186
- binary_encode(chunk)
186
+ chunk = binary_encode(chunk)
187
187
  socket.write(request << chunk)
188
188
  else
189
189
  socket.write(request) # write out request + headers
@@ -237,7 +237,7 @@ module Excon
237
237
  end
238
238
 
239
239
  def write_nonblock(data)
240
- binary_encode(data)
240
+ data = binary_encode(data)
241
241
  loop do
242
242
  written = nil
243
243
  begin
@@ -12,7 +12,13 @@ module Excon
12
12
 
13
13
  def binary_encode(string)
14
14
  if FORCE_ENC && string.encoding != Encoding::ASCII_8BIT
15
- string.force_encoding('BINARY')
15
+ if string.frozen?
16
+ string.dup.force_encoding('BINARY')
17
+ else
18
+ string.force_encoding('BINARY')
19
+ end
20
+ else
21
+ string
16
22
  end
17
23
  end
18
24
 
@@ -89,7 +95,7 @@ module Excon
89
95
  def split_header_value(str)
90
96
  return [] if str.nil?
91
97
  str = str.dup.strip
92
- binary_encode(str)
98
+ str = binary_encode(str)
93
99
  str.scan(%r'\G((?:"(?:\\.|[^"])+?"|[^",]+)+)
94
100
  (?:,\s*|\Z)'xn).flatten
95
101
  end
@@ -97,21 +103,21 @@ module Excon
97
103
  # Escapes HTTP reserved and unwise characters in +str+
98
104
  def escape_uri(str)
99
105
  str = str.dup
100
- binary_encode(str)
106
+ str = binary_encode(str)
101
107
  str.gsub(UNESCAPED) { "%%%02X" % $1[0].ord }
102
108
  end
103
109
 
104
110
  # Unescapes HTTP reserved and unwise characters in +str+
105
111
  def unescape_uri(str)
106
112
  str = str.dup
107
- binary_encode(str)
113
+ str = binary_encode(str)
108
114
  str.gsub(ESCAPED) { $1.hex.chr }
109
115
  end
110
116
 
111
117
  # Unescape form encoded values in +str+
112
118
  def unescape_form(str)
113
119
  str = str.dup
114
- binary_encode(str)
120
+ str = binary_encode(str)
115
121
  str.gsub!(/\+/, ' ')
116
122
  str.gsub(ESCAPED) { $1.hex.chr }
117
123
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Excon
3
- VERSION = '0.71.0'
3
+ VERSION = '0.71.1'
4
4
  end
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.71.0
4
+ version: 0.71.1
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: 2019-12-12 00:00:00.000000000 Z
13
+ date: 2019-12-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec