Skip to content

Commit 73c6b38

Browse files
Anton Zhuravskyioquatix
authored andcommitted
Closing the body after hijack
1 parent 418ca04 commit 73c6b38

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ def each(task: Task.current)
5050
response = yield(request, self)
5151
body = response&.body
5252

53-
return if hijacked?
53+
if hijacked?
54+
body&.close
55+
return
56+
end
5457

5558
task.defer_stop do
5659
# If a response was generated, send it:

test/async/http/protocol/http11.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def around
103103
end
104104

105105
it "works properly" do
106-
expect(body).not.to receive(:close)
106+
expect(body).to receive(:close)
107107

108108
response = client.get("/")
109109

0 commit comments

Comments
 (0)