Backport changes from the rack_hijack branch to support Puma and Rainbows.