async-htty 0.2.1 → 0.3.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: f033a6514d7f18ec5f7c94b4f547ef2fa00e025eedce18d004387dde4baae5bb
4
- data.tar.gz: 6d6a4cf76032a9e403c3f38f0ed4a46d1f6af61dd61ca3b712c68c93eabea6f8
3
+ metadata.gz: 9d7783c87883c9c45dd3d05a11b2060fea115b7a1b5a2435bcb3ebe3a2f0bb06
4
+ data.tar.gz: 235ff150ef9cf4966538b2899a2471df665544606d8599345f62f863772d6632
5
5
  SHA512:
6
- metadata.gz: 1f027635ab2786cae7850b213eba3c37e3ac9762409d746a0d54e83d6a9366963d598843f7ccedbd729298c877181062dce7c28f20154c91a6a944cdea2430c3
7
- data.tar.gz: b3bfefe4d878d7a404ffc3f3d66798f9acd5e6e17b03743849f58a281dde09a3d63c1fc85bb7918f4b8ff6a340c4335e2ddaaf1d20e882d1f270c6f953ba3f82
6
+ metadata.gz: af3056573867c1b572c48a713c28a07cfa7d33d363d1a5c94ef555faee4dfae35e8aeb482ed5d14cd70c11cdcf5bc78d6a5e1296c9f3b61eb4ad958f674b3166
7
+ data.tar.gz: 97bf7592db90bc2df78b28e39f04ea14d53ea725443e56693c3f5daf5661e2b8ce018b6e2fb5692991619a0d5dc0fc676f291131e3291931c23f1b02c71d2b55
checksums.yaml.gz.sig CHANGED
Binary file
@@ -12,9 +12,10 @@ module Async
12
12
  class Server < ::Async::HTTP::Protocol::HTTP2::Server
13
13
  def receive_goaway(frame)
14
14
  super
15
-
16
- unless self.framer.nil?
15
+
16
+ if framer = self.framer
17
17
  self.send_goaway
18
+ framer.flush
18
19
  end
19
20
  end
20
21
  end
@@ -13,7 +13,11 @@ module Async
13
13
  module Protocol
14
14
  module HTTY
15
15
  def self.client(stream, settings: ::Async::HTTP::Protocol::HTTP2::CLIENT_SETTINGS)
16
- stream = ::Protocol::HTTY::Stream.open(stream, bootstrap: :read)
16
+ mode = stream.read_bootstrap
17
+
18
+ unless mode == ::Protocol::HTTY::Stream::RAW_MODE
19
+ raise ::Protocol::HTTY::ProtocolError, "Expected HTTY bootstrap mode #{::Protocol::HTTY::Stream::RAW_MODE.inspect}, got #{mode.inspect}"
20
+ end
17
21
 
18
22
  client = ::Async::HTTP::Protocol::HTTP2::Client.new(stream)
19
23
  client.send_connection_preface(settings)
@@ -23,7 +27,7 @@ module Async
23
27
  end
24
28
 
25
29
  def self.server(stream, settings: ::Async::HTTP::Protocol::HTTP2::SERVER_SETTINGS)
26
- stream = ::Protocol::HTTY::Stream.open(stream, bootstrap: :write)
30
+ stream.write_bootstrap
27
31
 
28
32
  server = Server.new(stream)
29
33
  server.read_connection_preface(settings)
@@ -45,7 +45,7 @@ module Async
45
45
  original_output = output.dup
46
46
  original_error = error.dup
47
47
 
48
- stream = ::IO::Stream::Duplex(original_input, original_output)
48
+ stream = ::Protocol::HTTY::Stream.new(original_input, original_output)
49
49
  input.reopen(File::NULL)
50
50
  output.reopen(File::NULL)
51
51
  error.reopen(File::NULL)
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module HTTY
8
- VERSION = "0.2.1"
8
+ VERSION = "0.3.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -14,6 +14,11 @@ Please see the [project documentation](https://socketry.github.io/async-htty/) f
14
14
 
15
15
  Please see the [project releases](https://socketry.github.io/async-htty/releases/index) for all releases.
16
16
 
17
+ ### v0.3.0
18
+
19
+ - Pass explicit terminal input and output endpoints into `Protocol::HTTY::Stream`, avoiding buffered duplex reads across the HTTY HTTP/2 transport.
20
+ - Expect the HTTY protocol adapter to receive a prepared `Protocol::HTTY::Stream` instance before performing bootstrap and HTTP/2 setup.
21
+
17
22
  ### v0.2.1
18
23
 
19
24
  - Send a server-side GOAWAY when the HTTY client closes an HTTP/2 session, allowing terminal clients to detach cleanly.
data/releases.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Releases
2
2
 
3
+ ## v0.3.0
4
+
5
+ - Pass explicit terminal input and output endpoints into `Protocol::HTTY::Stream`, avoiding buffered duplex reads across the HTTY HTTP/2 transport.
6
+ - Expect the HTTY protocol adapter to receive a prepared `Protocol::HTTY::Stream` instance before performing bootstrap and HTTP/2 setup.
7
+
3
8
  ## v0.2.1
4
9
 
5
10
  - Send a server-side GOAWAY when the HTTY client closes an HTTP/2 session, allowing terminal clients to detach cleanly.
@@ -65,11 +65,11 @@ describe Async::HTTY::Protocol::HTTY do
65
65
  end
66
66
 
67
67
  def client_stream(pipes)
68
- IO::Stream::Duplex(pipes[:client_input], pipes[:client_output])
68
+ Protocol::HTTY::Stream.new(pipes[:client_input], pipes[:client_output])
69
69
  end
70
70
 
71
71
  def server_stream(pipes)
72
- IO::Stream::Duplex(pipes[:server_input], pipes[:server_output])
72
+ Protocol::HTTY::Stream.new(pipes[:server_input], pipes[:server_output])
73
73
  end
74
74
 
75
75
  def spawn_fixture(name)
@@ -123,7 +123,8 @@ describe Async::HTTY::Protocol::HTTY do
123
123
  payload = (0x00..0xff).to_a.pack("C*")
124
124
 
125
125
  with_fixture("echo_body.rb") do |stream|
126
- Protocol::HTTY::Stream.new(stream).read_bootstrap
126
+ stream = Protocol::HTTY::Stream.new(stream.input, stream.output)
127
+ stream.read_bootstrap
127
128
 
128
129
  framer = Protocol::HTTP2::Framer.new(stream)
129
130
  client = EchoClient.new(framer)
@@ -174,7 +175,8 @@ describe Async::HTTY::Protocol::HTTY do
174
175
  server_finished.signal
175
176
  end
176
177
 
177
- stream = Protocol::HTTY::Stream.open(client_stream(pipes), bootstrap: :read)
178
+ stream = client_stream(pipes)
179
+ stream.read_bootstrap
178
180
  framer = Protocol::HTTP2::Framer.new(stream)
179
181
  client = Protocol::HTTP2::Client.new(framer)
180
182
  client.send_connection_preface
@@ -88,8 +88,8 @@ describe Async::HTTY::Server do
88
88
 
89
89
  protocol.define_singleton_method(:server) do |stream|
90
90
  reopened_to_null = [input.reopened_to_null?, output.reopened_to_null?, error.reopened_to_null?]
91
- duplex_input = stream.io.input
92
- duplex_output = stream.io.output
91
+ duplex_input = stream.input
92
+ duplex_output = stream.output
93
93
 
94
94
  stream.write("response", flush: true)
95
95
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-htty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.2'
89
+ version: '0.3'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.2'
96
+ version: '0.3'
97
97
  executables: []
98
98
  extensions: []
99
99
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file