$34 GRAYBYTE WORDPRESS FILE MANAGER $39

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.23
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/ruby30/share/gems/gems/rack-3.0.8/lib/rack/

HOME
Current File : /opt/alt/ruby30/share/gems/gems/rack-3.0.8/lib/rack//cascade.rb
# frozen_string_literal: true

require_relative 'constants'

module Rack
  # Rack::Cascade tries a request on several apps, and returns the
  # first response that is not 404 or 405 (or in a list of configured
  # status codes).  If all applications tried return one of the configured
  # status codes, return the last response.

  class Cascade
    # deprecated, no longer used
    NotFound = [404, { CONTENT_TYPE => "text/plain" }, []]

    # An array of applications to try in order.
    attr_reader :apps

    # Set the apps to send requests to, and what statuses result in
    # cascading.  Arguments:
    #
    # apps: An enumerable of rack applications.
    # cascade_for: The statuses to use cascading for.  If a response is received
    #              from an app, the next app is tried.
    def initialize(apps, cascade_for = [404, 405])
      @apps = []
      apps.each { |app| add app }

      @cascade_for = {}
      [*cascade_for].each { |status| @cascade_for[status] = true }
    end

    # Call each app in order.  If the responses uses a status that requires
    # cascading, try the next app.  If all responses require cascading,
    # return the response from the last app.
    def call(env)
      return [404, { CONTENT_TYPE => "text/plain" }, []] if @apps.empty?
      result = nil
      last_body = nil

      @apps.each do |app|
        # The SPEC says that the body must be closed after it has been iterated
        # by the server, or if it is replaced by a middleware action. Cascade
        # replaces the body each time a cascade happens. It is assumed that nil
        # does not respond to close, otherwise the previous application body
        # will be closed. The final application body will not be closed, as it
        # will be passed to the server as a result.
        last_body.close if last_body.respond_to? :close

        result = app.call(env)
        return result unless @cascade_for.include?(result[0].to_i)
        last_body = result[2]
      end

      result
    end

    # Append an app to the list of apps to cascade.  This app will
    # be tried last.
    def add(app)
      @apps << app
    end

    # Whether the given app is one of the apps to cascade to.
    def include?(app)
      @apps.include?(app)
    end

    alias_method :<<, :add
  end
end


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
1 Jan 1970 12.00 AM
root / root
0
auth
--
21 Mar 2024 12.54 PM
root / root
0755
multipart
--
21 Mar 2024 12.54 PM
root / root
0755
body_proxy.rb
1.3 KB
12 Feb 2024 9.23 PM
root / root
0644
builder.rb
8.562 KB
12 Feb 2024 9.23 PM
root / root
0644
cascade.rb
2.251 KB
12 Feb 2024 9.23 PM
root / root
0644
chunked.rb
3.301 KB
12 Feb 2024 9.23 PM
root / root
0644
common_logger.rb
3.117 KB
12 Feb 2024 9.23 PM
root / root
0644
conditional_get.rb
2.989 KB
12 Feb 2024 9.23 PM
root / root
0644
config.rb
0.4 KB
12 Feb 2024 9.23 PM
root / root
0644
constants.rb
2.474 KB
12 Feb 2024 9.23 PM
root / root
0644
content_length.rb
0.787 KB
12 Feb 2024 9.23 PM
root / root
0644
content_type.rb
0.679 KB
12 Feb 2024 9.23 PM
root / root
0644
deflater.rb
5.506 KB
12 Feb 2024 9.23 PM
root / root
0644
directory.rb
6.023 KB
12 Feb 2024 9.23 PM
root / root
0644
etag.rb
1.866 KB
12 Feb 2024 9.23 PM
root / root
0644
events.rb
4.801 KB
12 Feb 2024 9.23 PM
root / root
0644
file.rb
0.163 KB
12 Feb 2024 9.23 PM
root / root
0644
files.rb
5.661 KB
12 Feb 2024 9.23 PM
root / root
0644
head.rb
0.512 KB
12 Feb 2024 9.23 PM
root / root
0644
headers.rb
2.957 KB
12 Feb 2024 9.23 PM
root / root
0644
lint.rb
36.089 KB
12 Feb 2024 9.23 PM
root / root
0755
lock.rb
0.56 KB
12 Feb 2024 9.23 PM
root / root
0644
logger.rb
0.404 KB
12 Feb 2024 9.23 PM
root / root
0644
media_type.rb
1.399 KB
12 Feb 2024 9.23 PM
root / root
0644
method_override.rb
1.445 KB
12 Feb 2024 9.23 PM
root / root
0644
mime.rb
32.688 KB
12 Feb 2024 9.23 PM
root / root
0644
mock.rb
0.062 KB
12 Feb 2024 9.23 PM
root / root
0644
mock_request.rb
5.37 KB
12 Feb 2024 9.23 PM
root / root
0644
mock_response.rb
3.276 KB
12 Feb 2024 9.23 PM
root / root
0644
multipart.rb
1.166 KB
12 Feb 2024 9.23 PM
root / root
0644
null_logger.rb
1.185 KB
12 Feb 2024 9.23 PM
root / root
0644
query_parser.rb
8.37 KB
12 Feb 2024 9.23 PM
root / root
0644
recursive.rb
1.779 KB
12 Feb 2024 9.23 PM
root / root
0644
reloader.rb
3.022 KB
12 Feb 2024 9.23 PM
root / root
0644
request.rb
24.569 KB
12 Feb 2024 9.23 PM
root / root
0644
response.rb
10.724 KB
12 Feb 2024 9.23 PM
root / root
0644
rewindable_input.rb
3.123 KB
12 Feb 2024 9.23 PM
root / root
0644
runtime.rb
0.85 KB
12 Feb 2024 9.23 PM
root / root
0644
sendfile.rb
5.555 KB
12 Feb 2024 9.23 PM
root / root
0644
show_exceptions.rb
13.734 KB
12 Feb 2024 9.23 PM
root / root
0644
show_status.rb
3.576 KB
12 Feb 2024 9.23 PM
root / root
0644
static.rb
5.999 KB
12 Feb 2024 9.23 PM
root / root
0644
tempfile_reaper.rb
0.76 KB
12 Feb 2024 9.23 PM
root / root
0644
urlmap.rb
2.81 KB
12 Feb 2024 9.23 PM
root / root
0644
utils.rb
21.097 KB
12 Feb 2024 9.23 PM
root / root
0644
version.rb
0.936 KB
12 Feb 2024 9.23 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF