falcon 0.17.5 → 0.17.6

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: 5236b4f598c705ca3edc34fde0642c631db40667e3eff10f86421803282e4e0f
4
- data.tar.gz: 0b368e6e54a9ca811d29a514c007d653140f9f0a6440c7f71be17729a66dec7d
3
+ metadata.gz: a9bcaef685cba594d33df1f726e788447663d585c95840f6c45d3aacab44384d
4
+ data.tar.gz: ef29a6b370c8ac8266b9f3023ed540b8ee465681450f745ccf62ce55d5d22903
5
5
  SHA512:
6
- metadata.gz: 703c41487454bec117de57d6bdf30f8492133ac1b8d589d430fcffb8d436e075f97f5749d5acb50179aad3a104292d54fc963c58c5b0c2b973634435804ed154
7
- data.tar.gz: 9c0be50a44d5f9bc19a99cbf8aadb5a61324b30195ed3ada6f096e13e25513a5c3a64b6fc213ec51639da5b793a92d1265a9b8de705778614e98f363c286af31
6
+ metadata.gz: c3d6dc2b5bc6e1281f7a0214ba87b16146876ab99696b944951614e6b4dc37d492c1ad0c208be1fd94e7453a5691f8a77e6a4c8e63618d9911a3a8fc116fa616
7
+ data.tar.gz: 37940a74c4e5c066e78c66c734f518de4fb5534f86593e161d040d4d0127c6b7ed2587d40252c53147dec6b8f45cce6df8530c7fd70f1a910c53f29abad5b69f
@@ -18,6 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require 'async/io/buffer'
22
+
21
23
  require 'async/http/body'
22
24
  require 'async/http/body/rewindable'
23
25
 
@@ -67,7 +69,7 @@ module Falcon
67
69
  # @param buffer [String] the buffer which will receive the data
68
70
  # @return a buffer containing the data
69
71
  def read(length = nil, buffer = nil)
70
- buffer ||= Async::IO::BinaryString.new
72
+ buffer ||= Async::IO::Buffer.new
71
73
  buffer.clear
72
74
 
73
75
  until buffer.bytesize == length
@@ -77,8 +79,12 @@ module Falcon
77
79
  remaining_length = length - buffer.bytesize if length
78
80
 
79
81
  if remaining_length && remaining_length < @buffer.bytesize
82
+ # We know that we are not going to reuse the original buffer.
83
+ # But byteslice will generate a hidden copy. So let's freeze it first:
84
+ @buffer.freeze
85
+
80
86
  buffer << @buffer.byteslice(0, remaining_length)
81
- @buffer = @buffer.byteslice(remaining_length..-1)
87
+ @buffer = @buffer.byteslice(remaining_length, @buffer.bytesize)
82
88
  else
83
89
  buffer << @buffer
84
90
  @buffer = nil
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.17.5"
22
+ VERSION = "0.17.6"
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.17.5
4
+ version: 0.17.6
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-07-05 00:00:00.000000000 Z
11
+ date: 2018-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-io