Skip to content

Hijacking in Rack 3 #2162

Answered by ioquatix
ayushn21 asked this question in Q&A
Mar 6, 2024 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Let's step back a little bit.

In Rack 2, there was no way to advertise support for only partial hijack or only full hijack. The presence and truthiness of env['rack.hijack?'] implied:

  1. You could respond with a partial hijack [200, {'rack.hijack' => body}, nil].
  2. env['rack.hijack'] is available for full hijack.

This is enforced by Rack::Lint.

Let's clarify what's actually required:

  • A partial hijack goes via the response headers - support for this has to be advertised, and that can be done by env['rack.hijack?'].
  • A full hijack must invoke env['rack.hijack']. The mere presence of that field is sufficient to indicate that full hijack is possible.

Full and partial hijack are distinct operati…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ayushn21
Comment options

Answer selected by ayushn21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants