template.rb
initialize
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt/template.rb
in
initialize
end
# !@endgroup
private
def read_template_file
data = File.open(file, 'rb') { |io| io.read }
if data.respond_to?(:force_encoding)
# Set it to the default external (without verifying)
data.force_encoding(Encoding.default_external) if Encoding.default_external
end
data
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt/template.rb
in
open
end
# !@endgroup
private
def read_template_file
data = File.open(file, 'rb') { |io| io.read }
if data.respond_to?(:force_encoding)
# Set it to the default external (without verifying)
data.force_encoding(Encoding.default_external) if Encoding.default_external
end
data
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt/template.rb
in
read_template_file
end
# !@endgroup
private
def read_template_file
data = File.open(file, 'rb') { |io| io.read }
if data.respond_to?(:force_encoding)
# Set it to the default external (without verifying)
data.force_encoding(Encoding.default_external) if Encoding.default_external
end
data
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt/template.rb
in
block in initialize
@compiled_method = {}
# used on 1.9 to set the encoding if it is not set elsewhere (like a magic comment)
# currently only used if template compiles to ruby
@default_encoding = @options.delete :default_encoding
# load template data and prepare (uses binread to avoid encoding issues)
@reader = block || lambda { |t| read_template_file }
@data = @reader.call(self)
if @data.respond_to?(:force_encoding)
if default_encoding
@data = @data.dup if @data.frozen?
@data.force_encoding(default_encoding)
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt/template.rb
in
initialize
# used on 1.9 to set the encoding if it is not set elsewhere (like a magic comment)
# currently only used if template compiles to ruby
@default_encoding = @options.delete :default_encoding
# load template data and prepare (uses binread to avoid encoding issues)
@reader = block || lambda { |t| read_template_file }
@data = @reader.call(self)
if @data.respond_to?(:force_encoding)
if default_encoding
@data = @data.dup if @data.frozen?
@data.force_encoding(default_encoding)
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
new
found = File.exist?(file)
if found
path = file
break
end
end
throw :layout_missing if eat_errors && !found
template.new(path, 1, options)
end
end
when Proc
compile_block_template(template, options, &data)
when String
template_cache.fetch engine, data, options, views do
compile_block_template(template, options) { data }
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in compile_template
found = File.exist?(file)
if found
path = file
break
end
end
throw :layout_missing if eat_errors && !found
template.new(path, 1, options)
end
end
when Proc
compile_block_template(template, options, &data)
when String
template_cache.fetch engine, data, options, views do
compile_block_template(template, options) { data }
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt.rb
in
block in fetch
# If a value has been previously cached for key then it is
# returned. Otherwise, block is yielded to and its return value
# which may be nil, is cached under key and returned.
# @yield
# @yieldreturn the value to cache for key
def fetch(*key)
@cache.fetch(key) do
@cache[key] = yield
end
end
# Clears the cache.
def clear
@cache = {}
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt.rb
in
fetch
# Caches a value for key, or returns the previously cached value.
# If a value has been previously cached for key then it is
# returned. Otherwise, block is yielded to and its return value
# which may be nil, is cached under key and returned.
# @yield
# @yieldreturn the value to cache for key
def fetch(*key)
@cache.fetch(key) do
@cache[key] = yield
end
end
# Clears the cache.
def clear
@cache = {}
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/tilt-2.0.11/lib/tilt.rb
in
fetch
# Caches a value for key, or returns the previously cached value.
# If a value has been previously cached for key then it is
# returned. Otherwise, block is yielded to and its return value
# which may be nil, is cached under key and returned.
# @yield
# @yieldreturn the value to cache for key
def fetch(*key)
@cache.fetch(key) do
@cache[key] = yield
end
end
# Clears the cache.
def clear
@cache = {}
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
compile_template
def compile_template(engine, data, options, views)
eat_errors = options.delete :eat_errors
template = Tilt[engine]
raise "Template engine not found: #{engine}" if template.nil?
case data
when Symbol
template_cache.fetch engine, data, options, views do
body, path, line = settings.templates[data]
if body
body = body.call if body.respond_to?(:call)
template.new(path, line.to_i, options) { body }
else
found = false
@preferred_extension = engine.to_s
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
render
options[:outvar] ||= '@_out_buf' unless exclude_outvar
options[:default_encoding] ||= settings.default_encoding
# compile and render template
begin
layout_was = @default_layout
@default_layout = false
template = compile_template(engine, data, options, views)
output = template.render(scope, locals, &block)
ensure
@default_layout = layout_was
end
# render layout
if layout
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
erb
def initialize
super
@default_layout = :layout
@preferred_extension = nil
end
def erb(template, options = {}, locals = {}, &block)
render(:erb, template, options, locals, &block)
end
def haml(template, options = {}, locals = {}, &block)
render(:haml, template, options, locals, &block)
end
def builder(template = nil, options = {}, locals = {}, &block)
/srv/www/painofsslvation.com/app.rb
in
block in <top (required)>
builder params[:part].to_sym
end
get '/lyrics/index.rhtml' do
@styles = ''
@styles << '<link type="text/css" rel="stylesheet" media="screen" href="/stylesheets/lyrics.css">'
@album_lyrics = params[:album].nil? ? nil : Nokogiri::HTML(erb "lyrics/#{params[:album]}".to_sym, layout: false)
erb "lyrics/index".to_sym
end
get '/lyrics/:part.rhtml' do
if !request.xhr?
redirect "/lyrics/?album=#{params[:part]}"
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions = @conditions
@conditions = []
wrapper = block.arity.zero? ?
proc { |a, _p| unbound_method.bind(a).call } :
proc { |a, p| unbound_method.bind(a).call(*p) }
[pattern, conditions, wrapper]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in compile!
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions = @conditions
@conditions = []
wrapper = block.arity.zero? ?
proc { |a, _p| unbound_method.bind(a).call } :
proc { |a, p| unbound_method.bind(a).call(*p) }
[pattern, conditions, wrapper]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block (3 levels) in route!
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
# Run routes defined in superclass.
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
route_eval
route_eval(&pass_block) if pass_block
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval
throw :halt, yield
end
# If the current request matches pattern and conditions, fill params
# with keys and call the given block.
# Revert params afterwards.
#
# Returns pass block.
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block (2 levels) in route!
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
# Run routes defined in superclass.
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in process_route
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue StandardError
@env['sinatra.error.params'] = @params
raise
ensure
params ||= {}
params.each { |k, _| @params.delete(k) } unless @env['sinatra.error.params']
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
catch
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue StandardError
@env['sinatra.error.params'] = @params
raise
ensure
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
process_route
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue StandardError
@env['sinatra.error.params'] = @params
raise
ensure
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in route!
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
each
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
route!
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in dispatch!
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before do
@pinned_response = !response['Content-Type'].nil?
end
route!
end
rescue ::Exception => e
invoke { handle_exception!(e) }
ensure
begin
filter! :after unless env['sinatra.static_file']
rescue ::Exception => e
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
catch
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
dispatch!
@params.merge!(@request.params).each do |key, val|
next unless val.respond_to?(:force_encoding)
val = val.dup if val.frozen?
@params[key] = force_encoding(val)
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before do
@pinned_response = !response['Content-Type'].nil?
end
route!
end
rescue ::Exception => e
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
@pinned_response = nil
template_cache.clear if settings.reload_templates
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body && body[0].respond_to?(:content_type)
content_type body[0].content_type
elsif (default = settings.default_content_type)
content_type default
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
catch
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
@pinned_response = nil
template_cache.clear if settings.reload_templates
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body && body[0].respond_to?(:content_type)
content_type body[0].content_type
elsif (default = settings.default_content_type)
content_type default
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
@template_cache = Tilt::Cache.new
@pinned_response = nil # whether a before! filter pinned the content-type
yield self if block_given?
end
# Rack call interface.
def call(env)
dup.call!(env)
end
def call!(env) # :nodoc:
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
/srv/www/painofsslvation.com/app.rb
in
block in <top (required)>
#set :show_exceptions, true
not_found do
erb :'404', layout: :panther
end
get '/lyrics/' do
status, headers, body = call request.env.merge("PATH_INFO" => '/lyrics/index.rhtml')
[status, body]
end
get '/' do
erb :index, layout: :panther
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions = @conditions
@conditions = []
wrapper = block.arity.zero? ?
proc { |a, _p| unbound_method.bind(a).call } :
proc { |a, p| unbound_method.bind(a).call(*p) }
[pattern, conditions, wrapper]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in compile!
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions = @conditions
@conditions = []
wrapper = block.arity.zero? ?
proc { |a, _p| unbound_method.bind(a).call } :
proc { |a, p| unbound_method.bind(a).call(*p) }
[pattern, conditions, wrapper]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block (3 levels) in route!
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
# Run routes defined in superclass.
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
route_eval
route_eval(&pass_block) if pass_block
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval
throw :halt, yield
end
# If the current request matches pattern and conditions, fill params
# with keys and call the given block.
# Revert params afterwards.
#
# Returns pass block.
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block (2 levels) in route!
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
# Run routes defined in superclass.
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in process_route
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue StandardError
@env['sinatra.error.params'] = @params
raise
ensure
params ||= {}
params.each { |k, _| @params.delete(k) } unless @env['sinatra.error.params']
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
catch
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue StandardError
@env['sinatra.error.params'] = @params
raise
ensure
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
process_route
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue StandardError
@env['sinatra.error.params'] = @params
raise
ensure
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in route!
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
each
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
route!
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
routes = base.routes[@request.request_method]
routes&.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in dispatch!
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before do
@pinned_response = !response['Content-Type'].nil?
end
route!
end
rescue ::Exception => e
invoke { handle_exception!(e) }
ensure
begin
filter! :after unless env['sinatra.static_file']
rescue ::Exception => e
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
catch
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
dispatch!
@params.merge!(@request.params).each do |key, val|
next unless val.respond_to?(:force_encoding)
val = val.dup if val.frozen?
@params[key] = force_encoding(val)
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before do
@pinned_response = !response['Content-Type'].nil?
end
route!
end
rescue ::Exception => e
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
@pinned_response = nil
template_cache.clear if settings.reload_templates
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body && body[0].respond_to?(:content_type)
content_type body[0].content_type
elsif (default = settings.default_content_type)
content_type default
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
catch
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(disposition: nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt, &block)
res = [res] if (Integer === res) || (String === res)
if (Array === res) && (Integer === res.first)
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
@pinned_response = nil
template_cache.clear if settings.reload_templates
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body && body[0].respond_to?(:content_type)
content_type body[0].content_type
elsif (default = settings.default_content_type)
content_type default
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
@template_cache = Tilt::Cache.new
@pinned_response = nil # whether a before! filter pinned the content-type
yield self if block_given?
end
# Rack call interface.
def call(env)
dup.call!(env)
end
def call!(env) # :nodoc:
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-protection-3.0.1/lib/rack/protection/xss_header.rb
in
call
#
# Options:
# xss_mode:: How the browser should prevent the attack (default: :block)
class XSSHeader < Base
default_options xss_mode: :block, nosniff: true
def call(env)
status, headers, body = @app.call(env)
headers['X-XSS-Protection'] ||= "1; mode=#{options[:xss_mode]}" if html? headers
headers['X-Content-Type-Options'] ||= 'nosniff' if options[:nosniff]
[status, headers, body]
end
end
end
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-protection-3.0.1/lib/rack/protection/path_traversal.rb
in
call
#
# Unescapes '/' and '.', expands +path_info+.
# Thus <tt>GET /foo/%2e%2e%2fbar</tt> becomes <tt>GET /bar</tt>.
class PathTraversal < Base
def call(env)
path_was = env['PATH_INFO']
env['PATH_INFO'] = cleanup path_was if path_was && !path_was.empty?
app.call env
ensure
env['PATH_INFO'] = path_was
end
def cleanup(path)
encoding = path.encoding
dot = '.'.encode(encoding)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-protection-3.0.1/lib/rack/protection/json_csrf.rb
in
call
class JsonCsrf < Base
default_options allow_if: nil
alias react deny
def call(env)
request = Request.new(env)
status, headers, body = app.call(env)
if has_vector?(request, headers)
warn env, "attack prevented by #{self.class}"
react_and_close(env, body) or [status, headers, body]
else
[status, headers, body]
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-protection-3.0.1/lib/rack/protection/base.rb
in
call
end
def call(env)
unless accepts? env
instrument env
result = react env
end
result or app.call(env)
end
def react(env)
result = send(options[:reaction], env)
result if (Array === result) && (result.size == 3)
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-protection-3.0.1/lib/rack/protection/base.rb
in
call
end
def call(env)
unless accepts? env
instrument env
result = react env
end
result or app.call(env)
end
def react(env)
result = send(options[:reaction], env)
result if (Array === result) && (result.size == 3)
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-protection-3.0.1/lib/rack/protection/frame_options.rb
in
call
frame_options = options[:frame_options]
frame_options = options[:frame_options].to_s.upcase unless frame_options.respond_to? :to_str
frame_options.to_str
end
end
def call(env)
status, headers, body = @app.call(env)
headers['X-Frame-Options'] ||= frame_options if html? headers
[status, headers, body]
end
end
end
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.4/lib/rack/logger.rb
in
call
end
def call(env)
logger = ::Logger.new(env[RACK_ERRORS])
logger.level = @level
env[RACK_LOGGER] = logger
@app.call(env)
end
end
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.4/lib/rack/common_logger.rb
in
call
# will not be logged, so if exception handling middleware are used,
# they should be loaded after this middleware. Additionally, because
# the logging happens after the request body has been fully sent, any
# exceptions raised during the sending of the response body will
# cause the request not to be logged.
def call(env)
began_at = Utils.clock_time
status, headers, body = @app.call(env)
headers = Utils::HeaderHash[headers]
body = BodyProxy.new(body) { log(env, status, headers, began_at) }
[status, headers, body]
end
private
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
env['sinatra.commonlogger'] ? @app.call(env) : super
end
superclass.class_eval do
alias_method :call_without_check, :call unless method_defined? :call_without_check
def call(env)
env['sinatra.commonlogger'] = true
call_without_check(env)
end
end
end
class Error < StandardError # :nodoc:
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
end
end
# Behaves exactly like Rack::CommonLogger with the notable exception that it does nothing,
# if another CommonLogger is already in the middleware chain.
class CommonLogger < Rack::CommonLogger
def call(env)
env['sinatra.commonlogger'] ? @app.call(env) : super
end
superclass.class_eval do
alias_method :call_without_check, :call unless method_defined? :call_without_check
def call(env)
env['sinatra.commonlogger'] = true
call_without_check(env)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.4/lib/rack/head.rb
in
call
# all other requests unchanged.
class Head
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
if env[REQUEST_METHOD] == HEAD
[
status, headers, Rack::BodyProxy.new([]) do
body.close if body.respond_to? :close
end
]
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/rack-2.2.4/lib/rack/method_override.rb
in
call
method = method_override(env)
if HTTP_METHODS.include?(method)
env[RACK_METHODOVERRIDE_ORIGINAL_METHOD] = env[REQUEST_METHOD]
env[REQUEST_METHOD] = method
end
end
@app.call(env)
end
def method_override(env)
req = Request.new(env)
method = method_override_param(req) ||
env[HTTP_METHOD_OVERRIDE_HEADER]
begin
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/show_exceptions.rb
in
call
def @@eats_errors.puts(*) end
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
rescue Exception => e
errors = env['rack.errors']
env['rack.errors'] = @@eats_errors
if prefers_plain_text?(env)
content_type = 'text/plain'
body = dump_exception(e)
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
# Some Rack handlers (Rainbows!) implement an extended body object protocol, however,
# some middleware (namely Rack::Lint) will break it by not mirroring the methods in question.
# This middleware will detect an extended body object and will make sure it reaches the
# handler directly. We do this here, so our middleware and middleware set up by the app will
# still be able to run.
class ExtendedRack < Struct.new(:app)
def call(env)
result = app.call(env)
callback = env['async.callback']
return result unless callback && async?(*result)
after_response { callback.call result }
setup_close(env, *result)
throw :async
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
end
def helpers
@instance
end
def call(env)
@stack.call(env)
end
def inspect
"#<#{@instance.class} app_file=#{settings.app_file.inspect}>"
end
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
block in call
setup_default_middleware builder
setup_middleware builder
builder.run app
builder
end
def call(env)
synchronize { prototype.call(env) }
end
# Like Kernel#caller but excluding certain magic entries and without
# line / method information; the resulting array contains filenames only.
def caller_files
cleaned_caller(1).flatten
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
synchronize
end
@@mutex = Mutex.new
def synchronize(&block)
if lock?
@@mutex.synchronize(&block)
else
yield
end
end
# used for deprecation warnings
def warn_for_deprecation(message)
warn message + "\n\tfrom #{cleaned_caller.first.join(':')}"
end
/home/nenya/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/sinatra-3.0.1/lib/sinatra/base.rb
in
call
setup_default_middleware builder
setup_middleware builder
builder.run app
builder
end
def call(env)
synchronize { prototype.call(env) }
end
# Like Kernel#caller but excluding certain magic entries and without
# line / method information; the resulting array contains filenames only.
def caller_files
cleaned_caller(1).flatten
end
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb
in
process_request
env[HTTP_VERSION] = HTTP_1_1
# Rails somehow modifies env['REQUEST_METHOD'], so we perform the comparison
# before the Rack application object is called.
is_head_request = env[REQUEST_METHOD] == HEAD
begin
status, headers, body = @app.call(env)
rescue => e
if e.is_a?(Errno::ENOBUFS)
raise e
end
if !should_swallow_app_error?(e, socket_wrapper)
# It's a good idea to catch application exceptions here because
# otherwise maliciously crafted responses can crash the app,
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
in
accept_and_process_next_request
channel.io = connection
headers = parse_request(connection, channel, buffer)
end
if headers
prepare_request(connection, headers)
begin
if headers[REQUEST_METHOD] == GET
process_request(headers, connection, socket_wrapper, @protocol == :http)
elsif headers[REQUEST_METHOD] == PING
process_ping(headers, connection)
false
elsif headers[REQUEST_METHOD] == OOBW
process_oobw(headers, connection)
false
else
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
in
main_loop
channel = MessageChannel.new
buffer = ''
buffer.force_encoding('binary') if buffer.respond_to?(:force_encoding)
begin
finish_callback.call
while true
hijacked = accept_and_process_next_request(socket_wrapper, channel, buffer)
socket_wrapper = Utils::UnseekableSocket.new if hijacked
end
rescue Interrupted
# Do nothing.
end
debug("Thread handler main loop exited normally")
ensure
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb
in
block (3 levels) in start_threads
@threads_mutex.synchronize do
@concurrency.times do |i|
thread = create_thread_and_abort_on_exception(i) do |number|
begin
Thread.current[:name] = "Worker #{number + 1}"
handler = thread_handler.new(self, main_socket_options)
handler.install
handler.main_loop(set_initialization_state_to_true)
ensure
set_initialization_state.call(false)
unregister_current_thread
end
end
@threads << thread
expected_nthreads += 1
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb
in
block in create_thread_and_abort_on_exception
# This method requires 'thread' and 'ruby_core_enhancements'.
# If 'debug_logging' is loaded and included in the current module,
# it will use that for logging.
def create_thread_and_abort_on_exception(*args)
Thread.new do
Thread.current.abort_on_exception = true
begin
yield(*args)
rescue SystemExit
raise
rescue Exception => e
print_exception(nil, e)
exit(1)
end
end
Variable | Value |
---|---|
album | "RemedyLane-Analysis" |
No POST data.
Variable | Value |
---|---|
HTTP_ACCEPT | */* |
HTTP_HOST | painofsslvation.com |
HTTP_REFERER | http://painofsslvation.com/lyrics/RemedyLane-Analysis.rhtml |
HTTP_USER_AGENT | claudebot |
HTTP_VERSION | HTTP/1.1 |
HTTP_X_FORWARDED_FOR | 52.205.159.48 |
HTTP_X_FORWARDED_HOST | painofsslvation.com |
HTTP_X_FORWARDED_PROTO | http |
HTTP_X_HOST | painofsslvation.com |
PASSENGER_CONNECT_PASSWORD | lGcaYHxy9uwfVmCZ |
PATH_INFO | /lyrics/ |
QUERY_STRING | album=RemedyLane-Analysis |
REMOTE_ADDR | 127.0.0.1 |
REMOTE_PORT | 57032 |
REQUEST_METHOD | GET |
REQUEST_URI | /lyrics/?album=RemedyLane-Analysis |
SCRIPT_NAME | |
SERVER_NAME | painofsslvation.com |
SERVER_PORT | 80 |
SERVER_PROTOCOL | HTTP/1.1 |
SERVER_SOFTWARE | nginx/1.22.1 Phusion_Passenger/6.0.17 |
rack.errors | #<Object:0x000055f42a4090b0> |
rack.hijack | #<Proc:0x00007fb505327d70 /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:94 (lambda)> |
rack.hijack? | true |
rack.input | #<PhusionPassenger::Utils::TeeInput:0x00007fb505327e10 @len=0, @socket=#<PhusionPassenger::Utils::UnseekableSocket:0x000055f42a81e8d0 @socket=#<UNIXSocket:fd 9>, @simulate_eof=true>, @bytes_read=0, @tmp=#<StringIO:0x00007fb505327dc0>> |
rack.logger | #<Logger:0x00007fb505327d48 @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007fb505327d20 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007fb505327cd0 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:/tmp/passenger.spawn.XXXXIGqRH1/stdout_and_err>, @binmode=false, @mon_data=#<Monitor:0x00007fb505327ca8>, @mon_data_owner_object_id=11517720>> |
rack.multiprocess | true |
rack.multithread | false |
rack.request.cookie_hash | {} |
rack.request.query_hash | {"album"=>"RemedyLane-Analysis"} |
rack.request.query_string | album=RemedyLane-Analysis |
rack.run_once | false |
rack.url_scheme | http |
rack.version | [1, 2] |
sinatra.accept | [#<Sinatra::Request::AcceptEntry:0x00007fb50531e1d0 @entry="*/*", @type="*/*", @params={}, @q=1.0>] |
sinatra.commonlogger | true |
sinatra.error | #<Errno::ENOENT: No such file or directory @ rb_sysopen - /srv/www/painofsslvation.com/views/lyrics/RemedyLane-Analysis.erb> |
sinatra.error.params | {"album"=>"RemedyLane-Analysis"} |
sinatra.route | GET /lyrics/ |
You're seeing this error because you have
enabled the show_exceptions
setting.