sinatra/sinatra — pull request #612 by omikronn (2013-01-12 12:51:21+00:00)
Title: Infinite loop resulting in stack level too deep in Sinatra::Response#finish

If the call to *super* on line 86 returns a Rack::BodyProxy instance inside *result*, the equality comparison on line 87 fails. The end result will be an infinite loop when calling *#each* on *body*, which will cause a stack overflow.

Rather than add *|| Rack::BodyProxy === result* on line 86, I suggest we overload the "==" operator in Sinatra::Response, to perform compare instances based solely on the *status*, *headers*, *body* and *length* attribute (of course, the comparison on line 86 needs to be flipped to *self == result*).