This allows clients to receive streaming response bodies as they're generated by the application, not only when it's ideal for zlib. Space-efficiency is hurt somewhat, but there's no other way to allow this middleware to work without completely breaking otherwise valid applications.
Fixes undefined method `<<' for Zlib::GzipWriter on JRuby
There were two issues here that * String#length was used to determine the Content-Length resulting in off-by-one failures in expected length assertions. * The specs were using body.to_s to convert bodies to Strings. In Ruby 1.8, #to_s is like #join; in Ruby 1.9, #to_s is like #inspect
The ConditionalGet, ContentLength, Deflator, and ShowStatus middleware components were reading/checking headers case sensitively.
* There was a bug when performing gzip compression where the Last-Modified response header was assumed to be a Time object, and passed directly to Zlib::GzipWriter#mtime, causing an exception since it is always a String. This fix parses the Last-Modified header using Time.httpdate and returns a Time obejct, which can be safely passed to Zlib::GzipWriter#mtime.