protocol-rack 0.14.0 → 0.15.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/rack/adapter/generic.rb +1 -1
- data/lib/protocol/rack/input.rb +19 -9
- data/lib/protocol/rack/response.rb +1 -1
- data/lib/protocol/rack/version.rb +1 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +15 -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: a0994443c638a7cf147afcb7a8b88a1a6e5e8ab607071c10792d65c912fb9b37
|
4
|
+
data.tar.gz: 22a6c27089e34db868a7af15fac1061979791872c811aef51762b68435fb9346
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60caa82495eb534bfb3367009b7567304c1c36b2db646fbee99d7c68eaba810c9913ad8c847c7939e0d60bb29bd049bdfb67ff365f68f9142b65d6cf7a7bf8f8
|
7
|
+
data.tar.gz: 63313385d9603b0bdaddeb39410dbcf7a3485652478d886ffbb5e8ea926a1b5006bcbd21bdc3b6a3851e43f1f601ded523021d700cd00dd0d2ab252b529378fa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/protocol/rack/input.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Copyright, 2022-2025, by Samuel Williams.
|
5
5
|
# Copyright, 2023, by Genki Takiuchi.
|
6
6
|
|
7
|
-
require "
|
7
|
+
require "io/stream/readable"
|
8
8
|
|
9
9
|
module Protocol
|
10
10
|
module Rack
|
@@ -14,22 +14,21 @@ module Protocol
|
|
14
14
|
#
|
15
15
|
# This implementation is not always rewindable, to avoid buffering the input when handling large uploads. See {Rewindable} for more details.
|
16
16
|
class Input
|
17
|
+
include IO::Stream::Readable
|
18
|
+
|
17
19
|
# Initialize the input wrapper.
|
18
20
|
# @parameter body [Protocol::HTTP::Body::Readable]
|
19
|
-
def initialize(body)
|
21
|
+
def initialize(body, ...)
|
20
22
|
@body = body
|
21
23
|
@closed = false
|
22
24
|
|
23
|
-
|
24
|
-
@buffer = nil
|
25
|
+
super(...)
|
25
26
|
end
|
26
27
|
|
27
28
|
# The input body.
|
28
29
|
# @attribute [Protocol::HTTP::Body::Readable]
|
29
30
|
attr :body
|
30
31
|
|
31
|
-
include Protocol::HTTP::Body::Stream::Reader
|
32
|
-
|
33
32
|
# Enumerate chunks of the request body.
|
34
33
|
# @yields {|chunk| ...}
|
35
34
|
# @parameter chunk [String]
|
@@ -65,7 +64,6 @@ module Protocol
|
|
65
64
|
# If the body is not rewindable, this will fail.
|
66
65
|
@body.rewind
|
67
66
|
|
68
|
-
@buffer = nil
|
69
67
|
@finished = false
|
70
68
|
@closed = false
|
71
69
|
|
@@ -87,7 +85,11 @@ module Protocol
|
|
87
85
|
|
88
86
|
private
|
89
87
|
|
90
|
-
def
|
88
|
+
def flush
|
89
|
+
# No-op.
|
90
|
+
end
|
91
|
+
|
92
|
+
def sysread(size, buffer = nil)
|
91
93
|
if @body
|
92
94
|
# User's may forget to call #close...
|
93
95
|
if chunk = @body.read
|
@@ -98,7 +100,15 @@ module Protocol
|
|
98
100
|
@closed = true
|
99
101
|
end
|
100
102
|
|
101
|
-
|
103
|
+
if buffer
|
104
|
+
# If a buffer is provided, we copy the chunk into it:
|
105
|
+
buffer.replace(chunk)
|
106
|
+
else
|
107
|
+
# Otherwise we return the chunk directly:
|
108
|
+
buffer = chunk
|
109
|
+
end
|
110
|
+
|
111
|
+
return buffer
|
102
112
|
else
|
103
113
|
unless @closed
|
104
114
|
# So if we are at the end of the stream, we close it automatically:
|
data/readme.md
CHANGED
@@ -67,6 +67,10 @@ run proc{|env|
|
|
67
67
|
|
68
68
|
Please see the [project releases](https://socketry.github.io/protocol-rack/releases/index) for all releases.
|
69
69
|
|
70
|
+
### v0.15.0
|
71
|
+
|
72
|
+
- Use `IO::Stream::Readable` for the input body, which is a better tested and more robust interface.
|
73
|
+
|
70
74
|
### v0.14.0
|
71
75
|
|
72
76
|
- Handling of `HEAD` requests is now more robust.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -40,6 +40,20 @@ cert_chain:
|
|
40
40
|
-----END CERTIFICATE-----
|
41
41
|
date: 1980-01-02 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: io-stream
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.10'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.10'
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: protocol-http
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|