Skip to content

Commit 0247fee

Browse files
committed
Raise an exception when a full hijack has occurred.
Returning a nil response is invalid. See #105 for more details.
1 parent 45ca2be commit 0247fee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/falcon/adapters/rack.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ class Rack
6060
RACK_IS_HIJACK = 'rack.hijack?'
6161
RACK_HIJACK_IO = 'rack.hijack_io'
6262

63+
# Raised back up through the middleware when the underlying connection is hijacked.
64+
class FullHijack < Exception
65+
end
66+
6367
# Async::HTTP specific metadata:
6468

6569
ASYNC_HTTP_REQUEST = "async.http.request"
@@ -202,7 +206,7 @@ def call(request)
202206

203207
# If there was a full hijack:
204208
if full_hijack
205-
return nil
209+
raise FullHijack, "The connection was hijacked."
206210
else
207211
return Response.wrap(status, headers, body, request)
208212
end

0 commit comments

Comments
 (0)