protocol-rack 0.6.0 → 0.8.0

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: 63abbb92ce268dc594b9464a931bb846808788db40a11a5c5aae81b64552eb30
4
- data.tar.gz: bd369d97c603d06cce3088f6d2f785c12fb20c52cc038d31d860d107cabd301c
3
+ metadata.gz: 6847f34cf162c87306b57b25d1908b76508aafce25805bd9d821273449844df5
4
+ data.tar.gz: a671e7169a8b76ac77ce12ce0ddaeb53cda3f7ffb0e6e0c0a9bc500a2ab00830
5
5
  SHA512:
6
- metadata.gz: d7058394c8f576c1cbff70179dcde738d6c31036c01ef264178056281dac28195e2dc19a14c21242b22c00f8db695fd73a8836c0125e9e60c4f37010ed537c15
7
- data.tar.gz: 8c73f392e0bb354693eb2a5063f5add1d5feccf13d5155991870b9d216f59dad31ae4831b5825cd0a47871799b4433eedc36e64b01d6656cefe157eb519882d4
6
+ metadata.gz: 2b05a2e9e0eeda2e84d7f80c60dc862726994903d886deb973100c435d5dc710cee92690f97f2cd1d8fc19415bf71766089bfed92c93671933567e5caddd8c14
7
+ data.tar.gz: 1d5fae5ee35c5144bfa8637edeb8c9b94cbf75bfa22daed41e0b3bcf09fbddfc18cb42afc487b281b5da5e40e5cee3cb82822d2442ab5c46037812598624ae34
checksums.yaml.gz.sig CHANGED
Binary file
@@ -22,22 +22,46 @@ module Protocol
22
22
  class Output
23
23
  def initialize(input, block)
24
24
  stream = ::Protocol::HTTP::Body::Stream.new(input, self)
25
- @fiber = Fiber.new do
25
+
26
+ @from = nil
27
+
28
+ @fiber = Fiber.new do |from|
29
+ @from = from
26
30
  block.call(stream)
27
31
  @fiber = nil
28
32
  end
29
33
  end
30
34
 
31
35
  def write(chunk)
32
- Fiber.yield(chunk)
36
+ if from = @from
37
+ @from = nil
38
+ @from = from.transfer(chunk)
39
+ else
40
+ raise RuntimeError, "Stream is not being read!"
41
+ end
33
42
  end
34
43
 
35
- def close
44
+ def close(error = nil)
36
45
  @fiber = nil
46
+
47
+ if from = @from
48
+ @from = nil
49
+ if error
50
+ from.raise(error)
51
+ else
52
+ from.transfer(nil)
53
+ end
54
+ end
55
+ end
56
+
57
+ def close_write(error = nil)
58
+ close(error)
37
59
  end
38
60
 
39
61
  def read
40
- @fiber&.resume
62
+ raise RuntimeError, "Stream is already being read!" if @from
63
+
64
+ @fiber&.transfer(Fiber.current)
41
65
  end
42
66
  end
43
67
 
@@ -30,8 +30,6 @@ module Protocol
30
30
 
31
31
  include Protocol::HTTP::Body::Stream::Reader
32
32
 
33
- alias gets read_partial
34
-
35
33
  # Enumerate chunks of the request body.
36
34
  # @yields {|chunk| ...}
37
35
  # @parameter chunk [String]
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module Rack
8
- VERSION = "0.6.0"
8
+ VERSION = "0.8.0"
9
9
  end
10
10
  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.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2024-06-14 00:00:00.000000000 Z
41
+ date: 2024-09-10 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: protocol-http
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '0.23'
49
+ version: '0.27'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0.23'
56
+ version: '0.27'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rack
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.5.9
115
+ rubygems_version: 3.5.11
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: An implementation of the Rack protocol/specification.
metadata.gz.sig CHANGED
Binary file