protocol-rack 0.1.1 → 0.1.4

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: 33d20313d282ba893b555e32c7676f6f45c0b43c500f673d17bcab5b6ce3b437
4
- data.tar.gz: 7c270c6c6ca1aa8714be1e98fb5fd51a8e4509c5090bc8a8ed256378c1e8cac1
3
+ metadata.gz: 8e9b2aad169f53bf60e4f21ce4e7732f44222c9540ffbe7b15350de8c5bc57c0
4
+ data.tar.gz: d99efa0f3ee9ffd1f9661e4f4ee0b56a4c78f35e7fe6356e403b27c60cb72463
5
5
  SHA512:
6
- metadata.gz: dd26486f5e87e796d554a0a62748703afee8d92d583b6f218ae001fe53714e6b313494db57eb57ecdedbe1a131263d88f643d13f18f9d556474883f83c1f496f
7
- data.tar.gz: 5171e4cc0360783c6ac043e34572f125d513569247c1e83f5ad663cd283f7fb074ed4407413d3d1698be108b8bbda9b0bf7d68cae70984dd2a60afdfa6694085
6
+ metadata.gz: ceadf027092c2e6745730109584cbc7bbf68f6830eae08b348fbe4e59e8339e5d27f121790c10c6f576b091c8eff1d951384af29ba381f613623a32dfdf7ed70
7
+ data.tar.gz: eff6dcdc9b0d2e06ce09788c15af9e55106375f5f040333194a30836a28082fa34f1a6175288f30078459aef143275c3904c0d90dcce54dd9356ced515932c6b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -20,6 +20,8 @@
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'
24
+
23
25
  require_relative 'adapter/rack2'
24
26
  require_relative 'adapter/rack3'
25
27
 
@@ -20,13 +20,6 @@
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'
24
-
25
- require_relative 'input'
26
- require_relative 'response'
27
-
28
- require 'console'
29
-
30
23
  module Protocol
31
24
  module Rack
32
25
  # Used for injecting the raw request in the the rack environment.
@@ -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
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Protocol
24
24
  module Rack
25
- VERSION = "0.1.1"
25
+ VERSION = "0.1.4"
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.1
4
+ version: 0.1.4
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-18 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