protocol-http1 0.25.0 → 0.26.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad917a8e0aa2f76df0ea21a56a914dc6575d1e22ee13a2b36a60f5a1ca37ed6e
4
- data.tar.gz: 2d6adbe2df3cd0c712e381a46adbba85de481ece8ee77ada0cf9a8b0638fc35a
3
+ metadata.gz: 868c9501fb3b9a49db11985bb2807cdbfe9ed6c5337c0e01fabd5f7f360874e0
4
+ data.tar.gz: 91a076094374bbdd0b42938e7d6dcaaf8cd24170d21da0043be63e4ebe719ffb
5
5
  SHA512:
6
- metadata.gz: 5f9b082e5bf6756d18127ad03ba0a2b14568227f859c05d7391983ce2a1157241cf635dcb3bc865264dfb6fb639991650c30b5ad2a8bb56ba1177ee11bce8a05
7
- data.tar.gz: a050ed9a0618856e61cfdc8d2e45a268ace98bb97ce6a76ba384480db55abc7fb7c71d113c967b1dfa9e53f5ce56c4469a7559f9eddb41a51c06b168a8b85b7b
6
+ metadata.gz: 14e0e59673d857dd2e37bcf8b9b1ef607d9490445c13bd515530aabd04dd75f93eca1055a3168384b0fe47f3197494b6be544e3e4f767d55456a4808e090e738
7
+ data.tar.gz: ea52162a1762c35cf7ea76630c51f589f52385baf5819b7a4010cec1a341e0ec153ffba1970bead118ebf7e309e63d400a2bc7e81195cd8c1d547c924c4c83d9
checksums.yaml.gz.sig CHANGED
Binary file
@@ -91,8 +91,8 @@ module Protocol
91
91
  # │ ▼ └───┬────┘ ▼
92
92
  # │ ┌──────────┐ │ ┌──────────┐
93
93
  # │ │ half │ │ │ half │
94
- # │ │ closed │ │ │ closed │
95
- # │ │ (remote) │ │ │ (local) │
94
+ # │ │ closed │ │ send R / │ closed │
95
+ # │ │ (remote) │ │ recv R │ (local) │
96
96
  # │ └────┬─────┘ │ └─────┬────┘
97
97
  # │ │ │ │
98
98
  # │ │ send ES / │ recv ES / │
@@ -104,7 +104,8 @@ module Protocol
104
104
  # persistent └────────┘
105
105
  # ```
106
106
  #
107
- # - `ES`: the body was fully received or sent (end of stream)
107
+ # - `ES`: the body was fully received or sent (end of stream).
108
+ # - `R`: the connection was closed unexpectedly (reset).
108
109
  #
109
110
  # State transition methods use a trailing "!".
110
111
  attr_accessor :state
@@ -176,14 +177,15 @@ module Protocol
176
177
  # @return [IO] the underlying non-blocking IO.
177
178
  def hijack!
178
179
  @persistent = false
179
- stream = @stream
180
180
 
181
- @stream.flush
182
- @stream = nil
183
-
184
- self.closed!
185
-
186
- return stream
181
+ if stream = @stream
182
+ @stream = nil
183
+ stream.flush
184
+
185
+ self.closed!
186
+
187
+ return stream
188
+ end
187
189
  end
188
190
 
189
191
  def close_read
@@ -193,10 +195,15 @@ module Protocol
193
195
  end
194
196
 
195
197
  # Close the connection and underlying stream.
196
- def close
198
+ def close(error = nil)
197
199
  @persistent = false
198
- @stream&.close
199
- self.closed!
200
+
201
+ if stream = @stream
202
+ @stream = nil
203
+ stream.close
204
+ end
205
+
206
+ self.closed!(error)
200
207
  end
201
208
 
202
209
  def open!
@@ -518,13 +525,15 @@ module Protocol
518
525
  self.send_end_stream!
519
526
  end
520
527
 
521
- def idle!
522
- @state = :idle
523
- end
524
-
525
- def closed!
526
- if @persistent
527
- self.idle!
528
+ # Transition to the closed state.
529
+ #
530
+ # If no error occurred, and the connection is persistent, this will immediately transition to the idle state.
531
+ #
532
+ # @parameter error [Exxception] the error that caused the connection to close.
533
+ def closed!(error = nil)
534
+ if @persistent and !error
535
+ # If there was no error, and the connection is persistent, we can reuse it:
536
+ @state = :idle
528
537
  else
529
538
  @state = :closed
530
539
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP1
8
- VERSION = "0.25.0"
8
+ VERSION = "0.26.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-http1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -42,7 +42,7 @@ cert_chain:
42
42
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
43
43
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
44
44
  -----END CERTIFICATE-----
45
- date: 2024-09-19 00:00:00.000000000 Z
45
+ date: 2024-09-23 00:00:00.000000000 Z
46
46
  dependencies:
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: protocol-http
metadata.gz.sig CHANGED
Binary file