aliyun-sdk 0.3.4 → 0.3.5

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
  SHA1:
3
- metadata.gz: 0a480b0f35aeed00c9b07e617d3609caedbfd862
4
- data.tar.gz: e7ae01442d09525274a84389da0ea3055e46164a
3
+ metadata.gz: 002610ac26720b767cd7218d665da92926081f17
4
+ data.tar.gz: 62a0a01d10c1fe2f944c7247f6b52a5cf35a6e60
5
5
  SHA512:
6
- metadata.gz: 20b4634d8db8efd28f033013418846c130b669637db55406436e58112ef7bbd09c2f55b1bec979bd8eb498d1a2f071114f80b0a74ffb21713bcfa5358ad00643
7
- data.tar.gz: 1a77e052686a50dfc1de71652d7da92c551f37065e9337446262fe8b19ca33c570d8764a4feea08111022e762e775bd95b923fbbaf0a55c882be435980ecc631
6
+ metadata.gz: 783dd45bcc4db86557e81a383f0de230e5c937d060c6cb8ff00cab296a67f963b718c2e13d32e1fdbdf9926f8f165a851f826eb68b53fb62252ed76ccc12c4c2
7
+ data.tar.gz: 2742836c20960f9dd4df8f546a144ddebae62677f2d650108c3677dc9038bb4d71020356c99a5e3368bc323f5a11e63a45aef37670bce3cd1d82eed2bd500407
@@ -1,5 +1,9 @@
1
1
  ## Change Log
2
2
 
3
+ ### v0.3.5
4
+
5
+ - Fix the issue that StreamWriter will read more bytes than wanted
6
+
3
7
  ### v0.3.4
4
8
 
5
9
  - Fix handling gzip/deflate response
@@ -52,8 +52,13 @@ module Aliyun
52
52
  ret = ""
53
53
  loop do
54
54
  if bytes
55
- ret << @buffer.slice!(0, bytes)
56
- break if ret.size >= bytes
55
+ fail if bytes < 0
56
+ piece = @buffer.slice!(0, bytes)
57
+ if piece
58
+ ret << piece
59
+ bytes -= piece.size
60
+ break if bytes == 0
61
+ end
57
62
  else
58
63
  ret << @buffer
59
64
  @buffer.clear
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Aliyun
4
4
 
5
- VERSION = "0.3.4"
5
+ VERSION = "0.3.5"
6
6
 
7
7
  end # Aliyun
@@ -58,6 +58,24 @@ module Aliyun
58
58
  r = s.read
59
59
  expect(r).to eq('')
60
60
  end
61
+
62
+ it "should read exactly bytes" do
63
+ s = HTTP::StreamWriter.new do |sr|
64
+ 100.times { sr << 'x' * 10 }
65
+ end
66
+
67
+ r = s.read(11)
68
+ expect(r.size).to eq(11)
69
+
70
+ r = s.read(25)
71
+ expect(r.size).to eq(25)
72
+
73
+ r = s.read(900)
74
+ expect(r.size).to eq(900)
75
+
76
+ r = s.read(1000)
77
+ expect(r.size).to eq(64)
78
+ end
61
79
  end # StreamWriter
62
80
 
63
81
  end # HTTP
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliyun-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tianlong Wu
@@ -234,3 +234,4 @@ test_files:
234
234
  - tests/test_object_acl.rb
235
235
  - tests/test_object_key.rb
236
236
  - tests/test_resumable.rb
237
+ has_rdoc: