Skip to content

Commit

Permalink
Remove support for HTTP/2 priority.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Nov 28, 2024
1 parent f81e238 commit 16c9cd2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion async-http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions lib/async/http/protocol/http2/output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def window_updated(size)
@guard.synchronize do
@window_updated.signal
end

return true
end

def write(chunk)
Expand Down
8 changes: 4 additions & 4 deletions lib/async/http/protocol/http2/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/async/http/protocol/http2/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/async/http/protocol/http2/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 16c9cd2

Please sign in to comment.