X7ROOT File Manager
Current Path:
/opt/cpanel/ea-ruby27/root/usr/share/gems/gems/rack-2.2.17/lib/rack
opt
/
cpanel
/
ea-ruby27
/
root
/
usr
/
share
/
gems
/
gems
/
rack-2.2.17
/
lib
/
rack
/
📁
..
📁
auth
📄
body_proxy.rb
(1.27 KB)
📄
builder.rb
(8.21 KB)
📄
cascade.rb
(2.22 KB)
📄
chunked.rb
(3.19 KB)
📄
common_logger.rb
(2.98 KB)
📄
conditional_get.rb
(2.99 KB)
📄
config.rb
(410 B)
📄
content_length.rb
(919 B)
📄
content_type.rb
(684 B)
📁
core_ext
📄
deflater.rb
(5.15 KB)
📄
directory.rb
(5.9 KB)
📄
etag.rb
(2.14 KB)
📄
events.rb
(4.72 KB)
📄
file.rb
(88 B)
📄
files.rb
(5.74 KB)
📁
handler
📄
handler.rb
(2.87 KB)
📄
head.rb
(520 B)
📄
lint.rb
(31.77 KB)
📄
lobster.rb
(1.96 KB)
📄
lock.rb
(716 B)
📄
logger.rb
(384 B)
📄
media_type.rb
(1.82 KB)
📄
method_override.rb
(1.33 KB)
📄
mime.rb
(32.39 KB)
📄
mock.rb
(9.14 KB)
📁
multipart
📄
multipart.rb
(2.57 KB)
📄
null_logger.rb
(980 B)
📄
query_parser.rb
(8.32 KB)
📄
recursive.rb
(1.75 KB)
📄
reloader.rb
(3.12 KB)
📄
request.rb
(19.71 KB)
📄
response.rb
(8.78 KB)
📄
rewindable_input.rb
(2.85 KB)
📄
runtime.rb
(885 B)
📄
sendfile.rb
(5.45 KB)
📄
server.rb
(13.29 KB)
📁
session
📄
show_exceptions.rb
(13.3 KB)
📄
show_status.rb
(3.42 KB)
📄
static.rb
(6.15 KB)
📄
tempfile_reaper.rb
(661 B)
📄
urlmap.rb
(2.78 KB)
📄
utils.rb
(18.65 KB)
📄
version.rb
(786 B)
Editing: show_status.rb
# frozen_string_literal: true require 'erb' module Rack # Rack::ShowStatus catches all empty responses and replaces them # with a site explaining the error. # # Additional details can be put into <tt>rack.showstatus.detail</tt> # and will be shown as HTML. If such details exist, the error page # is always rendered, even if the reply was not empty. class ShowStatus def initialize(app) @app = app @template = ERB.new(TEMPLATE) end def call(env) status, headers, body = @app.call(env) headers = Utils::HeaderHash[headers] empty = headers[CONTENT_LENGTH].to_i <= 0 # client or server error, or explicit message if (status.to_i >= 400 && empty) || env[RACK_SHOWSTATUS_DETAIL] # This double assignment is to prevent an "unused variable" warning. # Yes, it is dumb, but I don't like Ruby yelling at me. req = req = Rack::Request.new(env) message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s # This double assignment is to prevent an "unused variable" warning. # Yes, it is dumb, but I don't like Ruby yelling at me. detail = detail = env[RACK_SHOWSTATUS_DETAIL] || message body = @template.result(binding) size = body.bytesize [status, headers.merge(CONTENT_TYPE => "text/html", CONTENT_LENGTH => size.to_s), [body]] else [status, headers, body] end end def h(obj) # :nodoc: case obj when String Utils.escape_html(obj) else Utils.escape_html(obj.inspect) end end # :stopdoc: # adapted from Django <www.djangoproject.com> # Copyright (c) Django Software Foundation and individual contributors. # Used under the modified BSD license: # http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5 TEMPLATE = <<'HTML' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><%=h message %> at <%=h req.script_name + req.path_info %></title> <meta name="robots" content="NONE,NOARCHIVE" /> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; background:#eee; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; margin-bottom:.4em; } h1 span { font-size:60%; color:#666; font-weight:normal; } table { border:none; border-collapse: collapse; width:100%; } td, th { vertical-align:top; padding:2px 3px; } th { width:12em; text-align:right; color:#666; padding-right:.5em; } #info { background:#f6f6f6; } #info ol { margin: 0.5em 4em; } #info ol li { font-family: monospace; } #summary { background: #ffc; } #explanation { background:#eee; border-bottom: 0px none; } </style> </head> <body> <div id="summary"> <h1><%=h message %> <span>(<%= status.to_i %>)</span></h1> <table class="meta"> <tr> <th>Request Method:</th> <td><%=h req.request_method %></td> </tr> <tr> <th>Request URL:</th> <td><%=h req.url %></td> </tr> </table> </div> <div id="info"> <p><%=h detail %></p> </div> <div id="explanation"> <p> You're seeing this error because you use <code>Rack::ShowStatus</code>. </p> </div> </body> </html> HTML # :startdoc: end end
Upload File
Create Folder