# File lib/rack/deflater.rb, line 12
12:     def call(env)
13:       status, headers, body = @app.call(env)
14:       headers = Utils::HeaderHash.new(headers)
15: 
16:       # Skip compressing empty entity body responses and responses with
17:       # no-transform set.
18:       if Utils::STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
19:           headers['Cache-Control'].to_s =~ /\bno-transform\b/
20:         return [status, headers, body]
21:       end
22: 
23:       request = Request.new(env)
24: 
25:       encoding = Utils.select_best_encoding(%w(gzip deflate identity),
26:                                             request.accept_encoding)
27: 
28:       # Set the Vary HTTP header.
29:       vary = headers["Vary"].to_s.split(",").map { |v| v.strip }
30:       unless vary.include?("*") || vary.include?("Accept-Encoding")
31:         headers["Vary"] = vary.push("Accept-Encoding").join(",")
32:       end
33: 
34:       case encoding
35:       when "gzip"
36:         headers['Content-Encoding'] = "gzip"
37:         headers.delete('Content-Length')
38:         mtime = headers.key?("Last-Modified") ?
39:           Time.httpdate(headers["Last-Modified"]) : Time.now
40:         [status, headers, GzipStream.new(body, mtime)]
41:       when "deflate"
42:         headers['Content-Encoding'] = "deflate"
43:         headers.delete('Content-Length')
44:         [status, headers, DeflateStream.new(body)]
45:       when "identity"
46:         [status, headers, body]
47:       when nil
48:         message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found."
49:         [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, [message]]
50:       end
51:     end