protocol-http 0.26.6 → 0.26.7

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: 54ef214891be3dd78e03f7c061f9b6e6f754efc9fc28445f5d8924d779c217bd
4
- data.tar.gz: 6a637bcae7852f2acf31d9ff76a35781da93e6e33efb26131fe9ef0466c21cdc
3
+ metadata.gz: 5821a26af6f718626313da18d47d4aba2e33f0f4ce3809551c91e1a57e10bfbd
4
+ data.tar.gz: a432928361e31ca78408e444dd05622dd6853e56f40b3581a19fe97d8dac8dcc
5
5
  SHA512:
6
- metadata.gz: 56f697b23039bebe8edbc71c2ddfbbc60c552de4d87403785004f7adbb76456a0c37005cd5b307f415cadba9ca1f91bfc0825a5924f0ede2c88e538f2c77cdcc
7
- data.tar.gz: 733dd1c04f5bd2e900a563940a546d749084eacd5725707cfb2255c7a1259d858a4b598b3de840951751a1d2e286c60d13bed4d4fe1b8fbc934ec918d6f311c9
6
+ metadata.gz: 025540a24e4e72ea76257cee2c3bd4039854d6bd5f0f446553ffb5843aa2a41f278860d3f047b3c0861d8b15b120cbd03e1f54c2714583aabe7556451e6df728
7
+ data.tar.gz: e5b69ddfe8c874b00f6e36d03f48b71bb985f2c529df5aed4b4417ba1f10c258c768456897fdad1b63a9f257f4271472a3e56f7649664935e56ebb4a1136faf1
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1 @@
1
- Q��_�H��ݫLph*;�A^6=�0ݾ����c�'ÊD�&|K��f���I��� �����ȭ�k3��gq�����WС������܌���vlZoi��;h����d 7��oxk ��:���PQ%��h%ᕺ��.P�٤��Kդ�����=��D�=r)%�YP&�!-~��6PĿ��N�
2
- ɶ��(��>wU��73�~�'C���=�z�x�\K�:4��'OZ�������E �ܽ�B�\A���
1
+ ��l�h�')+/�Ҵ[�,����]�_��\ �T���jM��0��qÕ�5ܞ���4m� 6��{��ݼ[�
2
+ a�@����[�Nn=o��x�DÁپ�Ǜ
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
  # Copyright, 2020, by Bryan Powell.
6
6
 
7
7
  require_relative 'readable'
@@ -7,17 +7,11 @@
7
7
  module Protocol
8
8
  module HTTP
9
9
  module Body
10
- # A generic base class for wrapping body instances. Typically you'd override `#read`.
11
- # The implementation assumes a sequential unbuffered stream of data.
12
- # def each -> yield(String | nil)
13
- # def read -> String | nil
14
- # def join -> String
15
-
16
- # def finish -> buffer the stream and close it.
17
- # def close(error = nil) -> close the stream immediately.
18
- # end
10
+ # An interface for reading data from a body.
11
+ #
12
+ # Typically, you'd override `#read` to return chunks of data.
19
13
  class Readable
20
- # The consumer can call stop to signal that the stream output has terminated.
14
+ # Close the stream immediately.
21
15
  def close(error = nil)
22
16
  end
23
17
 
@@ -40,6 +34,7 @@ module Protocol
40
34
  end
41
35
 
42
36
  # Read the next available chunk.
37
+ # @returns [String | Nil] The chunk of data, or `nil` if the stream has finished.
43
38
  def read
44
39
  nil
45
40
  end
@@ -60,12 +55,16 @@ module Protocol
60
55
  end
61
56
 
62
57
  # Read all remaining chunks into a buffered body and close the underlying input.
58
+ # @returns [Buffered] The buffered body.
63
59
  def finish
64
60
  # Internally, this invokes `self.each` which then invokes `self.close`.
65
61
  Buffered.for(self)
66
62
  end
67
63
 
68
64
  # Enumerate all chunks until finished, then invoke `#close`.
65
+ #
66
+ # @yields {|chunk| ...} The block to call with each chunk of data.
67
+ # @parameter chunk [String | Nil] The chunk of data, or `nil` if the stream has finished.
69
68
  def each
70
69
  return to_enum(:each) unless block_given?
71
70
 
@@ -79,6 +78,8 @@ module Protocol
79
78
  end
80
79
 
81
80
  # Read all remaining chunks into a single binary string using `#each`.
81
+ #
82
+ # @returns [String | Nil] The binary string containing all chunks of data, or `nil` if the stream has finished (or did not contain any data).
82
83
  def join
83
84
  buffer = String.new.force_encoding(Encoding::BINARY)
84
85
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
6
  module Protocol
7
7
  module HTTP
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
  # Copyright, 2022, by Herrick Fang.
6
6
 
7
7
  module Protocol
@@ -65,9 +65,13 @@ module Protocol
65
65
  end
66
66
 
67
67
  def self.split(name)
68
- name.scan(/([^\[]+)|(?:\[(.*?)\])/).flatten!.compact!
68
+ name.scan(/([^\[]+)|(?:\[(.*?)\])/)&.tap do |parts|
69
+ parts.flatten!
70
+ parts.compact!
71
+ end
69
72
  end
70
73
 
74
+ # Assign a value to a nested hash.
71
75
  def self.assign(keys, value, parent)
72
76
  top, *middle = keys
73
77
 
@@ -95,6 +99,10 @@ module Protocol
95
99
  self.scan(string) do |name, value|
96
100
  keys = self.split(name)
97
101
 
102
+ if keys.empty?
103
+ raise ArgumentError, "Invalid key path: #{name.inspect}!"
104
+ end
105
+
98
106
  if keys.size > maximum
99
107
  raise ArgumentError, "Key length exceeded limit!"
100
108
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP
8
- VERSION = "0.26.6"
8
+ VERSION = "0.26.7"
9
9
  end
10
10
  end
data/lib/protocol/http.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
6
  require_relative "http/version"
7
7
 
data/readme.md CHANGED
@@ -30,11 +30,11 @@ We welcome contributions to this project.
30
30
 
31
31
  ### Developer Certificate of Origin
32
32
 
33
- This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
33
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
34
34
 
35
- ### Contributor Covenant
35
+ ### Community Guidelines
36
36
 
37
- This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
37
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
38
38
 
39
39
  ## See Also
40
40
 
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.26.6
4
+ version: 0.26.7
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-06-24 00:00:00.000000000 Z
50
+ date: 2024-07-07 00:00:00.000000000 Z
51
51
  dependencies: []
52
52
  description:
53
53
  email:
metadata.gz.sig CHANGED
Binary file