From 4665c9c0d99a2d23037ce9b7f358cde5e1d48c26 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 24 Jul 2026 11:51:31 +1200 Subject: [PATCH 1/2] Expose HTTP protocol names. --- lib/async/http/protocol/http.rb | 6 ++++++ releases.md | 1 + test/async/http/protocol/http.rb | 12 ++++++++++++ 3 files changed, 19 insertions(+) diff --git a/lib/async/http/protocol/http.rb b/lib/async/http/protocol/http.rb index 97d8f378..a1c5e419 100644 --- a/lib/async/http/protocol/http.rb +++ b/lib/async/http/protocol/http.rb @@ -26,6 +26,12 @@ def initialize(http1: HTTP1, http2: HTTP2) @http2 = http2 end + # The names of all supported protocols. + # @returns [Array(String)] The supported protocol names. + def names + (@http2.names + @http1.names).uniq + end + # Determine if the inbound connection is HTTP/1 or HTTP/2. # # @parameter stream [IO::Stream] The stream to detect the protocol for. diff --git a/releases.md b/releases.md index de2e0ce3..9f7666d9 100644 --- a/releases.md +++ b/releases.md @@ -3,6 +3,7 @@ ## v0.96.0 - Made `metrics` and `traces` optional runtime dependencies. Applications that use the providers should depend on the corresponding gem and require the provider explicitly. + - Exposed all supported protocol names from the plaintext HTTP protocol negotiator. ## v0.95.1 diff --git a/test/async/http/protocol/http.rb b/test/async/http/protocol/http.rb index 4a151a13..3a9ad9c6 100755 --- a/test/async/http/protocol/http.rb +++ b/test/async/http/protocol/http.rb @@ -14,6 +14,18 @@ it "has a default instance" do expect(protocol).to be_a Async::HTTP::Protocol::HTTP end + + it "exposes the supported protocol names" do + expect(subject.names).to be == ["h2", "http/1.1", "http/1.0"] + end + end + + with "configured protocols" do + let(:protocol) {subject.new(http1: Async::HTTP::Protocol::HTTP11, http2: Async::HTTP::Protocol::HTTP2)} + + it "exposes their supported protocol names" do + expect(protocol.names).to be == ["h2", "http/1.1"] + end end with "#protocol_for" do From 7291e2e323b5ee0b6a235c9700e946dc7f5e45c1 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 24 Jul 2026 11:53:44 +1200 Subject: [PATCH 2/2] Move release note to unreleased section. --- releases.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/releases.md b/releases.md index 9f7666d9..cd9b4f45 100644 --- a/releases.md +++ b/releases.md @@ -1,9 +1,12 @@ # Releases +## Unreleased + + - Exposed all supported protocol names from the plaintext HTTP protocol negotiator. + ## v0.96.0 - Made `metrics` and `traces` optional runtime dependencies. Applications that use the providers should depend on the corresponding gem and require the provider explicitly. - - Exposed all supported protocol names from the plaintext HTTP protocol negotiator. ## v0.95.1