production_place.rb
parent_place
/var/www/bm-waddesdon-bequest-prod/models/production_place.rb
in
parent_place
else
name == other_object
end
end
def parent_place
SUB_PLACES.detect {|k,v| v.include?(name) }.try(:[], 0)
end
def sub_places
SUB_PLACES[name] || []
end
def techniques
/var/www/bm-waddesdon-bequest-prod/views/production_place.erb
in
__tilt_175380
<h1>
<a href="/made_in">Made in</a>
<% if @production_place.parent_place %>
<a href="/made_in/<%= @production_place.parent_place %>"><%= @production_place.parent_place %></a>,
<% end %>
<%= @production_place.name %>
</h1>
<div class="row">
<div class="four columns">
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tilt-2.0.10/lib/tilt/template.rb
in
call
#
# This method is only used by source generating templates. Subclasses that
# override render() may not support all features.
def evaluate(scope, locals, &block)
locals_keys = locals.keys
locals_keys.sort!{|x, y| x.to_s <=> y.to_s}
method = compiled_method(locals_keys, scope.is_a?(Module) ? scope : scope.class)
method.bind(scope).call(locals, &block)
end
# Generates all template source by combining the preamble, template, and
# postamble and returns a two-tuple of the form: [source, offset], where
# source is the string containing (Ruby) source code for the template and
# offset is the integer line offset where line reporting should begin.
#
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tilt-2.0.10/lib/tilt/template.rb
in
evaluate
#
# This method is only used by source generating templates. Subclasses that
# override render() may not support all features.
def evaluate(scope, locals, &block)
locals_keys = locals.keys
locals_keys.sort!{|x, y| x.to_s <=> y.to_s}
method = compiled_method(locals_keys, scope.is_a?(Module) ? scope : scope.class)
method.bind(scope).call(locals, &block)
end
# Generates all template source by combining the preamble, template, and
# postamble and returns a two-tuple of the form: [source, offset], where
# source is the string containing (Ruby) source code for the template and
# offset is the integer line offset where line reporting should begin.
#
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/tilt-2.0.10/lib/tilt/template.rb
in
render
# Render the template in the given scope with the locals specified. If a
# block is given, it is typically available within the template via
# +yield+.
def render(scope=nil, locals={}, &block)
scope ||= Object.new
current_template = Thread.current[:tilt_current_template]
Thread.current[:tilt_current_template] = self
evaluate(scope, locals || {}, &block)
ensure
Thread.current[:tilt_current_template] = current_template
end
# The basename of the template file.
def basename(suffix='')
File.basename(file, suffix) if file
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
render
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
options = options.merge(:views => views, :layout => false, :eat_errors => eat_errors, :scope => scope).
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-contrib-2.1.0/lib/sinatra/engine_tracking.rb
in
block in render
ensure
@current_engine = engine_was
end
private
def render(engine, *)
with_engine(engine) { super }
end
end
helpers EngineTracking
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-contrib-2.1.0/lib/sinatra/engine_tracking.rb
in
with_engine
@current_engine = :ruby
super
end
# @param engine [Symbol, String] Name of Engine to shift to.
def with_engine(engine)
@current_engine, engine_was = engine.to_sym, @current_engine
yield
ensure
@current_engine = engine_was
end
private
def render(engine, *)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-contrib-2.1.0/lib/sinatra/engine_tracking.rb
in
render
ensure
@current_engine = engine_was
end
private
def render(engine, *)
with_engine(engine) { super }
end
end
helpers EngineTracking
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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 erubis(template, options = {}, locals = {})
warn "Sinatra::Templates#erubis is deprecated and will be removed, use #erb instead.\n" \
"If you have Erubis installed, it will be used automatically."
render :erubis, template, options, locals
end
/var/www/bm-waddesdon-bequest-prod/app.rb
in
block in <top (required)>
@production_places = ProductionPlace.all.sort_by(&:museum_objects_count).reverse
erb :production_places, locals: {page_title: "Explore by Place - The Waddesdon Bequest"}
end
get %r{/made_in/(.*)} do |production_place|
@production_place = ProductionPlace.find_by_name!(production_place)
@museum_objects = @production_place.museum_objects.sort_by(&:gallery_order)
erb :production_place, locals: {page_title: "Made in #{@production_place.name} - The Waddesdon Bequest"}
end
get '/makers' do
@producers = Producer.all.sort_by(&:museum_objects_count).reverse
erb :makers, locals: {page_title: "Makers - The Waddesdon Bequest"}
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
call
options.each_pair { |option, args| send(option, *args) }
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions, @conditions = @conditions, []
wrapper = block.arity != 0 ?
proc { |a, p| unbound_method.bind(a).call(*p) } :
proc { |a, p| unbound_method.bind(a).call }
[ pattern, conditions, wrapper ]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
block in compile!
options.each_pair { |option, args| send(option, *args) }
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions, @conditions = @conditions, []
wrapper = block.arity != 0 ?
proc { |a, p| unbound_method.bind(a).call(*p) } :
proc { |a, p| unbound_method.bind(a).call }
[ pattern, conditions, wrapper ]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
block (3 levels) in route!
def route!(base = settings, pass_block = nil)
if 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
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
block (2 levels) in route!
def route!(base = settings, pass_block = nil)
if 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
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
@env['sinatra.error.params'] = @params
raise
ensure
params ||= {}
params.each { |k, _| @params.delete(k) } unless @env['sinatra.error.params']
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
@env['sinatra.error.params'] = @params
raise
ensure
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
@env['sinatra.error.params'] = @params
raise
ensure
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
block in route!
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
if 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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
each
yield result if block_given?
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
if 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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
route!
yield result if block_given?
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
if 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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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 => boom
invoke { handle_exception!(boom) }
ensure
begin
filter! :after unless env['sinatra.static_file']
rescue ::Exception => boom
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
block 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
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
dispatch!
# Avoid passing frozen string in force_encoding
@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 => boom
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
block in call!
def call!(env) # :nodoc:
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
block 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
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
call!
def call!(env) # :nodoc:
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-protection-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-protection-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-protection-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-protection-2.1.0/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 and result.size == 3
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-protection-2.1.0/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 and result.size == 3
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-protection-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/lib/sinatra/base.rb
in
call
env['sinatra.commonlogger'] ? @app.call(env) : super
end
superclass.class_eval do
alias 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 BadRequest < TypeError #:nodoc:
def http_status; 400 end
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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 call_without_check call unless method_defined? :call_without_check
def call(env)
env['sinatra.commonlogger'] = true
call_without_check(env)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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)
else
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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, callback = app.call(env), env['async.callback']
return result unless callback and async?(*result)
after_response { callback.call result }
setup_close(env, *result)
throw :async
end
private
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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(message)
super message + "\n\tfrom #{cleaned_caller.first.join(':')}"
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sinatra-2.1.0/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
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-rewrite-1.5.1/lib/rack/rewrite.rb
in
call
def call(env)
if matched_rule = find_first_matching_rule(env)
rack_response = matched_rule.apply!(env)
# Don't invoke the app if applying the rule returns a rack response
return rack_response unless rack_response === true
end
@app.call(env)
end
private
def find_first_matching_rule(env) #:nodoc:
@rule_set.rules.detect { |rule| rule.matches?(env) }
end
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/urlmap.rb
in
block in call
rest = m[1]
next unless !rest || rest.empty? || rest[0] == ?/
env[SCRIPT_NAME] = (script_name + location)
env[PATH_INFO] = rest
return app.call(env)
end
[404, { CONTENT_TYPE => "text/plain", "X-Cascade" => "pass" }, ["Not Found: #{path}"]]
ensure
env[PATH_INFO] = path
env[SCRIPT_NAME] = script_name
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/urlmap.rb
in
each
server_port = env[SERVER_PORT]
is_same_server = casecmp?(http_host, server_name) ||
casecmp?(http_host, "#{server_name}:#{server_port}")
is_host_known = @known_hosts.include? http_host
@mapping.each do |host, location, match, app|
unless casecmp?(http_host, host) \
|| casecmp?(server_name, host) \
|| (!host && is_same_server) \
|| (!host && !is_host_known) # If we don't have a matching host, default to the first without a specified host
next
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/urlmap.rb
in
call
server_port = env[SERVER_PORT]
is_same_server = casecmp?(http_host, server_name) ||
casecmp?(http_host, "#{server_name}:#{server_port}")
is_host_known = @known_hosts.include? http_host
@mapping.each do |host, location, match, app|
unless casecmp?(http_host, host) \
|| casecmp?(server_name, host) \
|| (!host && is_same_server) \
|| (!host && !is_host_known) # If we don't have a matching host, default to the first without a specified host
next
end
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/deflater.rb
in
call
@app = app
@condition = options[:if]
@compressible_types = options[:include]
@sync = options.fetch(:sync, true)
end
def call(env)
status, headers, body = @app.call(env)
headers = Utils::HeaderHash[headers]
unless should_deflate?(env, status, headers, body)
return [status, headers, body]
end
request = Request.new(env)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/configuration.rb
in
call
def initialize(config, app)
@config = config
@app = app
end
def call(env)
env[Const::PUMA_CONFIG] = @config
@app.call(env)
end
end
# Indicate if there is a properly configured app
#
def app_configured?
@options[:app] || File.exist?(rackup)
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/request.rb
in
block in handle_request
# array, we will invoke them when the request is done.
#
after_reply = env[RACK_AFTER_REPLY] = []
begin
begin
status, headers, res_body = @thread_pool.with_force_shutdown do
@app.call(env)
end
return :async if client.hijacked
status = status.to_i
if status == -1
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/thread_pool.rb
in
with_force_shutdown
# provided block if the thread is forced to shutdown during execution.
def with_force_shutdown
t = Thread.current
@shutdown_mutex.synchronize do
raise ForceShutdown if @force_shutdown
t[:with_force_shutdown] = true
end
yield
ensure
t[:with_force_shutdown] = false
end
# Tell all threads in the pool to exit and wait for them to finish.
# Wait +timeout+ seconds then raise +ForceShutdown+ in remaining threads.
# Next, wait an extra +grace+ seconds then force-kill remaining threads.
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/request.rb
in
handle_request
# A rack extension. If the app writes #call'ables to this
# array, we will invoke them when the request is done.
#
after_reply = env[RACK_AFTER_REPLY] = []
begin
begin
status, headers, res_body = @thread_pool.with_force_shutdown do
@app.call(env)
end
return :async if client.hijacked
status = status.to_i
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/server.rb
in
process_client
with_force_shutdown(client) do
client.finish(@first_data_timeout)
end
while true
@requests_count += 1
case handle_request(client, buffer)
when false
break
when :async
close_socket = false
break
when true
buffer.reset
/home/AZU-WEB-05_HSloane/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-5.1.1/lib/puma/thread_pool.rb
in
block in spawn_thread
end
if @clean_thread_locals
ThreadPool.clean_thread_locals
end
begin
@out_of_band_pending = true if block.call(work, *extra)
rescue Exception => e
STDERR.puts "Error reached top of thread-pool: #{e.message} (#{e.class})"
end
end
end
@workers << th
No GET data.
No POST data.
Variable | Value |
---|---|
GATEWAY_INTERFACE | CGI/1.2 |
HTTP_ACCEPT | */* |
HTTP_CONNECTION | Keep-Alive |
HTTP_HOST | 127.0.0.1:9293 |
HTTP_USER_AGENT | claudebot |
HTTP_VERSION | HTTP/1.1 |
HTTP_X_FORWARDED_FOR | 44.200.145.114 |
HTTP_X_FORWARDED_HOST | wb.britishmuseum.org |
HTTP_X_FORWARDED_SERVER | wb.britishmuseum.org |
PATH_INFO | /made_in/Florence |
QUERY_STRING | |
REMOTE_ADDR | 127.0.0.1 |
REQUEST_METHOD | GET |
REQUEST_PATH | /made_in/Florence |
REQUEST_URI | /made_in/Florence |
SCRIPT_NAME | |
SERVER_NAME | 127.0.0.1 |
SERVER_PORT | 9293 |
SERVER_PROTOCOL | HTTP/1.1 |
SERVER_SOFTWARE | puma 5.1.1 At Your Service |
puma.config | #<Puma::Configuration:0x000055e226e75a50 @options=#<Puma::UserFileDefaultOptions:0x000055e226e74e20 @user_options={:binds=>["tcp://0.0.0.0:9293"], :environment=>"development"}, @file_options={}, @default_options={:min_threads=>0, :max_threads=>5, :log_requests=>false, :debug=>false, :binds=>["tcp://0.0.0.0:9292"], :workers=>0, :mode=>:http, :worker_timeout=>60, :worker_boot_timeout=>60, :worker_shutdown_timeout=>30, :remote_address=>:socket, :tag=>"bm-waddesdon-bequest-prod", :environment=>"development", :rackup=>"config.ru", :logger=>#<IO:<STDOUT>>, :persistent_timeout=>20, :first_data_timeout=>30, :raise_exception_on_sigterm=>true, :max_fast_inline=>10, :preload_app=>false}>, @plugins=#<Puma::PluginLoader:0x000055e226e74dd0 @instances=[]>, @user_dsl=#<Puma::DSL:0x000055e226e74d58 @config=#<Puma::Configuration:0x000055e226e75a50 ...>, @options={:binds=>["tcp://0.0.0.0:9293"], :environment=>"development"}, @plugins=[]>, @file_dsl=#<Puma::DSL:0x000055e226e74ce0 @config=#<Puma::Configuration:0x000055e226e75a50 ...>, @options={}, @plugins=[]>, @default_dsl=#<Puma::DSL:0x000055e226e74b50 @config=#<Puma::Configuration:0x000055e226e75a50 ...>, @options={:min_threads=>0, :max_threads=>5, :log_requests=>false, :debug=>false, :binds=>["tcp://0.0.0.0:9292"], :workers=>0, :mode=>:http, :worker_timeout=>60, :worker_boot_timeout=>60, :worker_shutdown_timeout=>30, :remote_address=>:socket, :tag=>"bm-waddesdon-bequest-prod", :environment=>"development", :rackup=>"config.ru", :logger=>#<IO:<STDOUT>>, :persistent_timeout=>20, :first_data_timeout=>30, :raise_exception_on_sigterm=>true, :max_fast_inline=>10, :preload_app=>false}, @plugins=[]>> |
puma.request_body_wait | 0 |
puma.socket | #<TCPSocket:fd 12, AF_INET, 127.0.0.1, 9293> |
rack.after_reply | [] |
rack.errors | #<Object:0x000055e2274ffc90> |
rack.hijack | #<Puma::Client:0x2ad64 @ready=true> |
rack.hijack? | true |
rack.input | #<Puma::NullIO:0x000055e226e08770> |
rack.logger | #<Logger:0x000055e2275c50a8 @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x000055e2275c5080 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x000055e2275c4fe0 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x000055e2275c4fb8>, @mon_data_owner_object_id=175420>> |
rack.multiprocess | false |
rack.multithread | true |
rack.request.cookie_hash | {} |
rack.request.query_hash | {} |
rack.request.query_string | |
rack.run_once | false |
rack.url_scheme | http |
rack.version | [1, 6] |
sinatra.accept | [#<Sinatra::Request::AcceptEntry:0x000055e22750ae60 @entry="*/*", @type="*/*", @params={}, @q=1.0>] |
sinatra.commonlogger | true |
sinatra.error | #<NoMethodError: undefined method `try' for #<Array:0x000055e22754e818>> |
sinatra.error.params | {"captures"=>["Florence"]} |
sinatra.route | GET \/made_in\/(.*) |
You're seeing this error because you have
enabled the show_exceptions
setting.