protocol-rack 0.1.2 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a1d56f088f0b4df724094cdac3869d04063600270d78f1fecab11e8a470f10b
4
- data.tar.gz: a14e095f1fbf101eb61c2353f7953e7fcf62a5664002879868ec52fcc9bcda57
3
+ metadata.gz: '05358d653d700368d3ca27a586f60aab5e3ba12ed2b23562deb92620e913b889'
4
+ data.tar.gz: 23961dcd7822636d774cf70b2200e258f25f4c82a0991a076a183c6381972a50
5
5
  SHA512:
6
- metadata.gz: 5df5cb469da4d0458aca4a31823e7cceed94253cef73fe897418059e95683123a5a419b458520f76e49819cea3408a71177dc02b26e533f5dedafb4d1e6c9d2c
7
- data.tar.gz: a074b455c116e4001eb6069505988405bcdc10ff2349c378f75703cce5c83db65b946d083441be561db428a9f9972ec23c50de05959ebaec04d120b24af4d24e
6
+ metadata.gz: 25eae3570334a81ff7cefaa6ee128d4cc3cb89550cb738aca6224b91fb01cd44c91b7b6f55428e985a38c3363187fd92bb9fb7a06a71f705ec21eb4e929d71ba
7
+ data.tar.gz: a412da0e9a0d8f765502a23e4aa6873116da0f4e978198eb115ef25efc8ae111177d563946d7a79cb9235f0b550315a4b5787534a01f5cefcb413ffb34b43861
checksums.yaml.gz.sig CHANGED
Binary file
@@ -20,7 +20,7 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  # THE SOFTWARE.
22
22
 
23
- require 'rack/version'
23
+ require 'rack'
24
24
 
25
25
  require_relative 'adapter/rack2'
26
26
  require_relative 'adapter/rack3'
@@ -44,34 +44,23 @@ module Protocol
44
44
  # @attribute [Protocol::HTTP::Body::Readable]
45
45
  attr :body
46
46
 
47
+ include Protocol::HTTP::Body::Stream::Reader
48
+
49
+ alias gets read_partial
50
+
47
51
  # Enumerate chunks of the request body.
48
52
  # @yields {|chunk| ...}
49
53
  # @parameter chunk [String]
50
54
  def each(&block)
51
55
  return to_enum unless block_given?
52
56
 
53
- while chunk = gets
57
+ return if closed?
58
+
59
+ while chunk = read_partial
54
60
  yield chunk
55
61
  end
56
62
  end
57
63
 
58
- include Protocol::HTTP::Body::Stream::Reader
59
-
60
- # Read the next chunk of data from the input stream.
61
- #
62
- # `gets` must be called without arguments and return a `String`, or `nil` when the input stream has no more data.
63
- #
64
- # @returns [String | Nil] The next chunk from the body.
65
- def gets
66
- if @buffer.nil?
67
- return read_next
68
- else
69
- buffer = @buffer
70
- @buffer = nil
71
- return buffer
72
- end
73
- end
74
-
75
64
  # Close the input and output bodies.
76
65
  def close(error = nil)
77
66
  if @body
@@ -105,9 +94,9 @@ module Protocol
105
94
  @body.nil?
106
95
  end
107
96
 
108
- # Whether there are any output chunks remaining?
97
+ # Whether there are any input chunks remaining?
109
98
  def empty?
110
- @output.empty?
99
+ @body.nil?
111
100
  end
112
101
 
113
102
  private
@@ -116,7 +105,6 @@ module Protocol
116
105
  if @body
117
106
  @body.read
118
107
  else
119
- @body = nil
120
108
  raise IOError, "Stream is not readable, input has been closed!"
121
109
  end
122
110
  end
@@ -21,6 +21,7 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  require 'protocol/http/request'
24
+ require 'protocol/http/headers'
24
25
 
25
26
  require_relative 'body/input_wrapper'
26
27
 
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Protocol
24
24
  module Rack
25
- VERSION = "0.1.2"
25
+ VERSION = "0.1.5"
26
26
  end
27
27
  end
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.1.2
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -37,7 +37,7 @@ cert_chain:
37
37
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
38
38
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
39
  -----END CERTIFICATE-----
40
- date: 2022-08-20 00:00:00.000000000 Z
40
+ date: 2022-08-22 00:00:00.000000000 Z
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: protocol-http
metadata.gz.sig CHANGED
Binary file