falcon 0.15.1 → 0.15.2

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: fdbd38f6a8408d1373e3b2652824c58327fc563819f01719a3cb2ed3396a67d6
4
- data.tar.gz: 9d54bfa0bcbe21630191d19c1e7977f816ce18d17b901983f3045ecfcad565e1
3
+ metadata.gz: 682a4983771c1015ffd59ff7d241109f598fadfed95db19bfb418e9149d9e4a4
4
+ data.tar.gz: '081b506a5324694090bfb87020711761b732aff8f860d1dbe4f606a0f405d157'
5
5
  SHA512:
6
- metadata.gz: db0cdccd3f0541c416c3438e640630877a31eacd8f6597032cb0fcfe7f4783e37eeae051b60e00f1040b2acb3ea66c95d0c92cf4f582030dcee9a89411315b9c
7
- data.tar.gz: 6f9921c5a75c512b094568bbd69a54555d57b08fb53d5cfddf407214dd8483a250dd282d27fe0170ae226b79de7b9c7cc505a4446274e63a0443f2ea810fcc78
6
+ metadata.gz: 32491eb4950dc9667a63fc075242e778cd2bb5725da0eb9fd52d399585a8072d9ab505ab2de4c02521d1098295816875145a0dca990c04e062eb7ddd09de4dfc
7
+ data.tar.gz: df2a3b8800e5fa83ad8d27f5a0f6e282f7a140b046e0c552a7b308b5ab4ae47fc3ff20a5894ee14f45189867ab8a823554c806f71733c9639d942e984b3a4180
@@ -48,15 +48,32 @@ module Falcon
48
48
  @buffer.clear
49
49
  end
50
50
 
51
+ # Read some data from the underlying body. Similar to `IO#read`.
52
+ # @param length [Integer] the amount of data to read
53
+ # @param buffer [String] the buffer which will receive the data
54
+ # @return a buffer containing the data
51
55
  def read(length = nil, buffer = nil)
52
56
  if length
53
57
  fill_buffer(length) if @buffer.bytesize <= length
54
58
 
55
- return @buffer.slice!(0, length)
59
+ chunk = @buffer.slice!(0, length)
60
+
61
+ if buffer
62
+ # TODO https://bugs.ruby-lang.org/issues/14745
63
+ buffer.replace(chunk)
64
+ else
65
+ buffer = chunk
66
+ end
67
+
68
+ if buffer.empty? and length > 0
69
+ return nil
70
+ else
71
+ return buffer
72
+ end
56
73
  else
57
74
  buffer ||= Async::IO::BinaryString.new
58
75
 
59
- buffer << @buffer
76
+ buffer.replace(@buffer)
60
77
  @buffer.clear
61
78
 
62
79
  while chunk = read_next
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.15.1"
22
+ VERSION = "0.15.2"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-07 00:00:00.000000000 Z
11
+ date: 2018-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-io