protocol-http 0.39.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +5 -1
- data/lib/protocol/http/body/stream.rb +56 -2
- data/lib/protocol/http/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10e80047df314ab51026467f51437b52b9c09efda85f028ae1835f5e8ff4ae6c
|
4
|
+
data.tar.gz: '08c4a65646072f0e229cbd096a10d7c3f701d5c72edb17c5f9ee2cc112d574bb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a7c1dcdeffbf00442217783b7b01a93ae866b1471a1441729931cc485d5eef491c03fb22b2a5ee05dfcf87c4818be41706cb10abe78f37de6dd4187f9d75fb6
|
7
|
+
data.tar.gz: 778915a18c596ff9ebb21f2d0b5bc6da4f59de7248d1ac08ee3dddaa9526a8b17de6fb93b002fe048ed4b842370d161499eaaf1d70aeb7dd4fe41281dc8ed90e
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,5 @@
|
|
1
|
-
|
1
|
+
&ȹ�ё���R�@�^���1gp^>w��j���={$�M@�y0�v��h��͚%��H�F��;��t����>��J����
|
2
|
+
��bׂOc�*�;;��hԻ]�f�@0�N�D�62����bIYRT�������}�pD�w�m�}�����7o'�i�""+qQ"4#}�i,�m�o&�LG`7�n]�F���������a�[ņbBs1�k�Bloϛ���/Nq8oA��=ɮ�9U��=
|
3
|
+
�d(�S_2������q�(�nZ�^�A�ٶ�K/1溯.j(��Q=�l��=O�*uQNK��J�bk���j�_ϒt
|
4
|
+
�|E����������T[1��T�oǨuĊWӪ������g���Y�49�
|
5
|
+
�q�}��/��q� �P
|
@@ -191,9 +191,63 @@ module Protocol
|
|
191
191
|
# Read a single line from the stream.
|
192
192
|
#
|
193
193
|
# @parameter separator [String] The line separator, defaults to `\n`.
|
194
|
+
# @parameter limit [Integer] The maximum number of bytes to read.
|
194
195
|
# @parameter *options [Hash] Additional options, passed to {read_until}.
|
195
|
-
def gets(separator = NEWLINE,
|
196
|
-
|
196
|
+
def gets(separator = NEWLINE, limit = nil, chomp: false)
|
197
|
+
# If the separator is an integer, it is actually the limit:
|
198
|
+
if separator.is_a?(Integer)
|
199
|
+
limit = separator
|
200
|
+
separator = NEWLINE
|
201
|
+
end
|
202
|
+
|
203
|
+
# If no separator is given, this is the same as a read operation:
|
204
|
+
if separator.nil?
|
205
|
+
return read(limit)
|
206
|
+
end
|
207
|
+
|
208
|
+
# We don't want to split on the separator, so we subtract the size of the separator:
|
209
|
+
split_offset = separator.bytesize - 1
|
210
|
+
|
211
|
+
@buffer ||= read_next
|
212
|
+
return nil if @buffer.nil?
|
213
|
+
|
214
|
+
offset = 0
|
215
|
+
until index = @buffer.index(separator, offset)
|
216
|
+
offset = @buffer.bytesize - split_offset
|
217
|
+
offset = 0 if offset < 0
|
218
|
+
|
219
|
+
# If we have gone past the limit, we are done:
|
220
|
+
if limit and offset >= limit
|
221
|
+
@buffer.freeze
|
222
|
+
matched = @buffer.byteslice(0, limit)
|
223
|
+
@buffer = @buffer.byteslice(limit, @buffer.bytesize)
|
224
|
+
return matched
|
225
|
+
end
|
226
|
+
|
227
|
+
# Read more data:
|
228
|
+
if chunk = read_next
|
229
|
+
@buffer << chunk
|
230
|
+
else
|
231
|
+
# No more data could be read, return the remaining data:
|
232
|
+
buffer = @buffer
|
233
|
+
@buffer = nil
|
234
|
+
|
235
|
+
return @buffer
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Freeze the buffer, as this enables us to use byteslice without generating a hidden copy:
|
240
|
+
@buffer.freeze
|
241
|
+
|
242
|
+
if limit and index > limit
|
243
|
+
line = @buffer.byteslice(0, limit)
|
244
|
+
@buffer = @buffer.byteslice(limit, @buffer.bytesize)
|
245
|
+
else
|
246
|
+
line = @buffer.byteslice(0, index+(chomp ? 0 : separator.bytesize))
|
247
|
+
@buffer = @buffer.byteslice(index+separator.bytesize, @buffer.bytesize)
|
248
|
+
end
|
249
|
+
|
250
|
+
return line
|
197
251
|
end
|
198
252
|
end
|
199
253
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.40.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -47,7 +47,7 @@ cert_chain:
|
|
47
47
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
48
48
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
49
49
|
-----END CERTIFICATE-----
|
50
|
-
date: 2024-10-
|
50
|
+
date: 2024-10-16 00:00:00.000000000 Z
|
51
51
|
dependencies: []
|
52
52
|
description:
|
53
53
|
email:
|
metadata.gz.sig
CHANGED
Binary file
|