From 16c9cd2800a239257603f132f0f0b9a36747b2d8 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 28 Nov 2024 23:04:27 +1300 Subject: [PATCH] Remove support for HTTP/2 priority. --- async-http.gemspec | 2 +- lib/async/http/protocol/http2/output.rb | 2 ++ lib/async/http/protocol/http2/request.rb | 8 ++++---- lib/async/http/protocol/http2/response.rb | 4 ++-- lib/async/http/protocol/http2/stream.rb | 4 +++- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/async-http.gemspec b/async-http.gemspec index b711ffa..e498ba0 100644 --- a/async-http.gemspec +++ b/async-http.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |spec| spec.add_dependency "io-stream", "~> 0.6" spec.add_dependency "protocol-http", "~> 0.43" spec.add_dependency "protocol-http1", ">= 0.28.1" - spec.add_dependency "protocol-http2", "~> 0.19" + spec.add_dependency "protocol-http2", "~> 0.21" spec.add_dependency "traces", "~> 0.10" spec.add_dependency "metrics", "~> 0.12" end diff --git a/lib/async/http/protocol/http2/output.rb b/lib/async/http/protocol/http2/output.rb index 32ec3d8..f3538bb 100644 --- a/lib/async/http/protocol/http2/output.rb +++ b/lib/async/http/protocol/http2/output.rb @@ -37,6 +37,8 @@ def window_updated(size) @guard.synchronize do @window_updated.signal end + + return true end def write(chunk) diff --git a/lib/async/http/protocol/http2/request.rb b/lib/async/http/protocol/http2/request.rb index 84fdd5a..de418d8 100644 --- a/lib/async/http/protocol/http2/request.rb +++ b/lib/async/http/protocol/http2/request.rb @@ -112,7 +112,7 @@ def hijack? def send_response(response) if response.nil? - return @stream.send_headers(nil, NO_RESPONSE, ::Protocol::HTTP2::END_STREAM) + return @stream.send_headers(NO_RESPONSE, ::Protocol::HTTP2::END_STREAM) end protocol_headers = [ @@ -129,14 +129,14 @@ def send_response(response) # This function informs the headers object that any subsequent headers are going to be trailer. Therefore, it must be called *before* sending the headers, to avoid any race conditions. trailer = response.headers.trailer! - @stream.send_headers(nil, headers) + @stream.send_headers(headers) @stream.send_body(body, trailer) else # Ensure the response body is closed if we are ending the stream: response.close - @stream.send_headers(nil, headers, ::Protocol::HTTP2::END_STREAM) + @stream.send_headers(headers, ::Protocol::HTTP2::END_STREAM) end end @@ -149,7 +149,7 @@ def write_interim_response(status, headers = nil) interim_response_headers = ::Protocol::HTTP::Headers::Merged.new(interim_response_headers, headers) end - @stream.send_headers(nil, interim_response_headers) + @stream.send_headers(interim_response_headers) end end end diff --git a/lib/async/http/protocol/http2/response.rb b/lib/async/http/protocol/http2/response.rb index c952c47..5792f05 100644 --- a/lib/async/http/protocol/http2/response.rb +++ b/lib/async/http/protocol/http2/response.rb @@ -222,7 +222,7 @@ def send_request(request) ) if request.body.nil? - @stream.send_headers(nil, headers, ::Protocol::HTTP2::END_STREAM) + @stream.send_headers(headers, ::Protocol::HTTP2::END_STREAM) else if length = request.body.length # This puts it at the end of the pseudo-headers: @@ -233,7 +233,7 @@ def send_request(request) trailer = request.headers.trailer! begin - @stream.send_headers(nil, headers) + @stream.send_headers(headers) rescue raise RequestFailed end diff --git a/lib/async/http/protocol/http2/stream.rb b/lib/async/http/protocol/http2/stream.rb index cf50fdb..3c077d2 100644 --- a/lib/async/http/protocol/http2/stream.rb +++ b/lib/async/http/protocol/http2/stream.rb @@ -131,7 +131,7 @@ def finish_output(error = nil) else # Write trailer? if trailer&.any? - send_headers(nil, trailer, ::Protocol::HTTP2::END_STREAM) + send_headers(trailer, ::Protocol::HTTP2::END_STREAM) else send_data(nil, ::Protocol::HTTP2::END_STREAM) end @@ -142,6 +142,8 @@ def window_updated(size) super @output&.window_updated(size) + + return true end # When the stream transitions to the closed state, this method is called. There are roughly two ways this can happen: