protocol-http 0.68.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/http/body/readable.rb +8 -0
- data/lib/protocol/http/body/stream.rb +13 -9
- data/lib/protocol/http/version.rb +1 -1
- data/readme.md +5 -5
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: e15c95aaaa592e283652205e025ad4473e3f082865506604799bb8eaadf06368
|
|
4
|
+
data.tar.gz: 10b0bf633c92acbec2fb96a70e5693060cab025e2df7ea45aaad410ba9c7afad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99165410a3df8b9efef707e17e1ea31befa3510a65c111a77d17270ffb9167f15d36d6bc64512ee2d7aea2ff3cf5087379e7826ce54595087f89d227eb42f9b6
|
|
7
|
+
data.tar.gz: 297e0e29550b333cfa5f35005263e9762ff8afc64c6ca9e1f76ca1fcfb0c0b9ea3a7364f81f8349aced4b9aa018d7892b5362863896d0827f0d4daec9fd0c648
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
# Copyright, 2019-2024, by Samuel Williams.
|
|
5
5
|
# Copyright, 2023, by Bruno Sutic.
|
|
6
6
|
|
|
7
|
+
require_relative "stream"
|
|
8
|
+
|
|
7
9
|
module Protocol
|
|
8
10
|
module HTTP
|
|
9
11
|
module Body
|
|
@@ -186,6 +188,12 @@ module Protocol
|
|
|
186
188
|
def to_json(...)
|
|
187
189
|
as_json.to_json(...)
|
|
188
190
|
end
|
|
191
|
+
|
|
192
|
+
# Return an IO-compatible stream for reading this body.
|
|
193
|
+
# @returns [Stream] The IO-compatible stream adapter.
|
|
194
|
+
def to_io
|
|
195
|
+
return Stream.new(self)
|
|
196
|
+
end
|
|
189
197
|
end
|
|
190
198
|
end
|
|
191
199
|
end
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
# Copyright, 2023, by Genki Takiuchi.
|
|
6
6
|
# Copyright, 2025, by William T. Nelson.
|
|
7
7
|
|
|
8
|
-
require_relative "buffered"
|
|
9
|
-
|
|
10
8
|
module Protocol
|
|
11
9
|
module HTTP
|
|
12
10
|
module Body
|
|
@@ -17,13 +15,15 @@ module Protocol
|
|
|
17
15
|
|
|
18
16
|
# Initialize the stream with the given input and output.
|
|
19
17
|
#
|
|
20
|
-
# @parameter input [Readable] The input stream.
|
|
21
|
-
# @parameter output [Writable] The output stream.
|
|
22
|
-
def initialize(input = nil, output =
|
|
18
|
+
# @parameter input [Readable | Nil] The input stream.
|
|
19
|
+
# @parameter output [Writable | Nil] The output stream.
|
|
20
|
+
def initialize(input = nil, output = nil)
|
|
23
21
|
@input = input
|
|
24
22
|
@output = output
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
if @output
|
|
25
|
+
raise ArgumentError, "Non-writable output!" unless output.respond_to?(:write)
|
|
26
|
+
end
|
|
27
27
|
|
|
28
28
|
# Will hold remaining data in `#read`.
|
|
29
29
|
@buffer = nil
|
|
@@ -32,10 +32,10 @@ module Protocol
|
|
|
32
32
|
@closed_read = false
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# @attribute [Readable] The input stream.
|
|
35
|
+
# @attribute [Readable | Nil] The input stream.
|
|
36
36
|
attr :input
|
|
37
37
|
|
|
38
|
-
# @attribute [Writable] The output stream.
|
|
38
|
+
# @attribute [Writable | Nil] The output stream.
|
|
39
39
|
attr :output
|
|
40
40
|
|
|
41
41
|
# This provides a read-only interface for data, which is surprisingly tricky to implement correctly.
|
|
@@ -409,7 +409,11 @@ module Protocol
|
|
|
409
409
|
|
|
410
410
|
# @returns [Boolean] Whether there are any output chunks remaining.
|
|
411
411
|
def empty?
|
|
412
|
-
@output
|
|
412
|
+
if @output
|
|
413
|
+
return @output.empty?
|
|
414
|
+
else
|
|
415
|
+
return true
|
|
416
|
+
end
|
|
413
417
|
end
|
|
414
418
|
|
|
415
419
|
private
|
data/readme.md
CHANGED
|
@@ -30,6 +30,11 @@ Please see the [project documentation](https://socketry.github.io/protocol-http/
|
|
|
30
30
|
|
|
31
31
|
Please see the [project releases](https://socketry.github.io/protocol-http/releases/index) for all releases.
|
|
32
32
|
|
|
33
|
+
### v0.69.0
|
|
34
|
+
|
|
35
|
+
- Add `Protocol::HTTP::Body::Readable#to_io` for obtaining an IO-compatible stream adapter.
|
|
36
|
+
- Avoid creating an implicit buffered output for `Protocol::HTTP::Body::Stream`.
|
|
37
|
+
|
|
33
38
|
### v0.68.0
|
|
34
39
|
|
|
35
40
|
- Add HTTP status descriptions.
|
|
@@ -67,11 +72,6 @@ Please see the [project releases](https://socketry.github.io/protocol-http/relea
|
|
|
67
72
|
|
|
68
73
|
- Expose `Protocol::HTTP::Body::Writable#count` attribute to provide access to the number of chunks written to the body.
|
|
69
74
|
|
|
70
|
-
### v0.59.0
|
|
71
|
-
|
|
72
|
-
- Introduce `Protocol::HTTP::Middleware.load` method for loading middleware applications from files.
|
|
73
|
-
- Prevent `ZLib::BufError` when deflating empty chunks by skipping deflation for empty chunks.
|
|
74
|
-
|
|
75
75
|
## See Also
|
|
76
76
|
|
|
77
77
|
- [protocol-http1](https://github.com/socketry/protocol-http1) — HTTP/1 client/server implementation using this
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|