Software: Apache. PHP/5.6.40 uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24 uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) Safe-mode: OFF (not secure) /opt/alt/ruby19/lib64/ruby/gems/1.9.1/doc/rack-1.6.4/rdoc/Rack/ drwxr-xr-x |
Viewing file: Select action/file-type: In FilesParentNamespaceFilesClass/Module Index
Rack::DeflaterThis middleware enables compression of http responses. Currently supported compression algorithms: * gzip * deflate * identity (no transformation) The middleware automatically detects when compression is supported and allowed. For example no transformation is made when a cache directive of 'no-transform' is present, or when the response status code is one that doesn't allow an entity body. Public Class Methods
new(app, options = {})
click to toggle source
Creates Rack::Deflater middleware.
# File lib/rack/deflater.rb, line 27 def initialize(app, options = {}) @app = app @condition = options[:if] @compressible_types = options[:include] end Public Instance Methods
call(env)
click to toggle source
# File lib/rack/deflater.rb, line 34 def call(env) status, headers, body = @app.call(env) headers = Utils::HeaderHash.new(headers) unless should_deflate?(env, status, headers, body) return [status, headers, body] end request = Request.new(env) encoding = Utils.select_best_encoding(%(gzip deflate identity), request.accept_encoding) # Set the Vary HTTP header. vary = headers["Vary"].to_s.split(",").map { |v| v.strip } unless vary.include?("*") || vary.include?("Accept-Encoding") headers["Vary"] = vary.push("Accept-Encoding").join(",") end case encoding when "gzip" headers['Content-Encoding'] = "gzip" headers.delete(CONTENT_LENGTH) mtime = headers.key?("Last-Modified") ? Time.httpdate(headers["Last-Modified"]) : Time.now [status, headers, GzipStream.new(body, mtime)] when "deflate" headers['Content-Encoding'] = "deflate" headers.delete(CONTENT_LENGTH) [status, headers, DeflateStream.new(body)] when "identity" [status, headers, body] when nil message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found." bp = Rack::BodyProxy.new([message]) { body.close if body.respond_to?(:close) } [406, {CONTENT_TYPE => "text/plain", CONTENT_LENGTH => message.length.to_s}, bp] end end Generated with the Darkfish Rdoc Generator 2. |
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0749 ]-- |