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 +4 -4
- checksums.yaml.gz.sig +2 -2
- data/lib/protocol/http/body/buffered.rb +1 -1
- data/lib/protocol/http/body/readable.rb +11 -10
- data/lib/protocol/http/methods.rb +1 -1
- data/lib/protocol/http/url.rb +10 -2
- data/lib/protocol/http/version.rb +1 -1
- data/lib/protocol/http.rb +1 -1
- data/readme.md +3 -3
- 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: 5821a26af6f718626313da18d47d4aba2e33f0f4ce3809551c91e1a57e10bfbd
|
4
|
+
data.tar.gz: a432928361e31ca78408e444dd05622dd6853e56f40b3581a19fe97d8dac8dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 025540a24e4e72ea76257cee2c3bd4039854d6bd5f0f446553ffb5843aa2a41f278860d3f047b3c0861d8b15b120cbd03e1f54c2714583aabe7556451e6df728
|
7
|
+
data.tar.gz: e5b69ddfe8c874b00f6e36d03f48b71bb985f2c529df5aed4b4417ba1f10c258c768456897fdad1b63a9f257f4271472a3e56f7649664935e56ebb4a1136faf1
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
��l�h�')+/�Ҵ[�,����]�_��\�T���jM��0��qÕ�5ܞ���4�m� �6��{��ݼ[�
|
2
|
+
�a�@����[�Nn=o��x�DÁپ�Ǜ
|
@@ -7,17 +7,11 @@
|
|
7
7
|
module Protocol
|
8
8
|
module HTTP
|
9
9
|
module Body
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
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
|
-
#
|
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
|
|
data/lib/protocol/http/url.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
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(/([^\[]+)|(?:\[(.*?)\])/)
|
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
|
data/lib/protocol/http.rb
CHANGED
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
|
-
|
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
|
-
###
|
35
|
+
### Community Guidelines
|
36
36
|
|
37
|
-
This project is
|
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.
|
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-
|
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
|