Skip to content

Commit ad437a7

Browse files
committed
Minor fixes.
1 parent 5fe1a48 commit ad437a7

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

async-http.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
2929
spec.add_dependency "io-endpoint", "~> 0.11"
3030
spec.add_dependency "io-stream", "~> 0.4"
3131
spec.add_dependency "protocol-http", "~> 0.37"
32-
spec.add_dependency "protocol-http1", "~> 0.25"
33-
spec.add_dependency "protocol-http2", "~> 0.18"
32+
spec.add_dependency "protocol-http1", "~> 0.27"
33+
spec.add_dependency "protocol-http2", "~> 0.19"
3434
spec.add_dependency "traces", ">= 0.10"
3535
end

lib/async/http/protocol/http1/client.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ def initialize(...)
1818

1919
attr_accessor :pool
2020

21-
def closed!
21+
def closed(error = nil)
2222
super
2323

2424
if pool = @pool
2525
@pool = nil
26+
# If the connection is not reusable, this will retire it from the connection pool and invoke `#close`.
2627
pool.release(self)
2728
end
2829
end
@@ -73,13 +74,9 @@ def call(request, task: Task.current)
7374
write_body(@version, request.body, false, trailer)
7475
end
7576

76-
response = Response.read(self, request)
77-
78-
return response
77+
return Response.read(self, request)
7978
rescue => error
80-
# This will ensure that #reusable? returns false.
8179
self.close(error)
82-
8380
raise
8481
end
8582
end

lib/async/http/protocol/http1/connection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def http2?
4343

4444
def read_line?
4545
@stream.read_until(CRLF)
46+
rescue Errno::ECONNRESET
47+
return nil
4648
end
4749

4850
def read_line

lib/async/http/protocol/http1/server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def initialize(...)
2222
@ready = Async::Notification.new
2323
end
2424

25-
def closed!
25+
def closed(error = nil)
2626
super
2727

2828
@ready.signal

test/async/http/proxy.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@
153153
upstream.write(chunk)
154154
upstream.flush
155155
end
156-
rescue Async::Wrapper::Cancelled
157-
#ignore
158156
ensure
159157
Console.logger.debug(self) {"Finished writing to upstream..."}
160158
upstream.close_write

0 commit comments

Comments
 (0)