query.rb
filter_expr
/home/sally/.rvm/gems/ruby-3.0.0/gems/sequel-5.60.1/lib/sequel/dataset/query.rb
in
filter_expr
case expr
when Hash
SQL::BooleanExpression.from_value_pairs(expr)
when Array
if Sequel.condition_specifier?(expr)
SQL::BooleanExpression.from_value_pairs(expr)
else
raise Error, "Invalid filter expression: #{expr.inspect}"
end
when LiteralString
LiteralString.new("(#{expr})")
when Numeric, SQL::NumericExpression, SQL::StringExpression, Proc, String
raise Error, "Invalid filter expression: #{expr.inspect}"
when TrueClass, FalseClass
if supports_where_true?
/home/sally/.rvm/gems/ruby-3.0.0/gems/sequel-5.60.1/lib/sequel/dataset/query.rb
in
add_filter
if cond == nil
cond = Sequel::NULL
end
if empty && block
cond = nil
end
cond = _invert_filter(filter_expr(cond, &block), invert)
cond = SQL::BooleanExpression.new(combine, @opts[clause], cond) if @opts[clause]
if cond.nil?
cond = Sequel::NULL
end
clone(clause => cond)
/home/sally/.rvm/gems/ruby-3.0.0/gems/sequel-5.60.1/lib/sequel/dataset/query.rb
in
where
# Multiple where calls can be chained for scoping:
#
# software = dataset.where(category: 'software').where{price < 100}
# # SELECT * FROM items WHERE ((category = 'software') AND (price < 100))
#
# See the {"Dataset Filtering" guide}[rdoc-ref:doc/dataset_filtering.rdoc] for more examples and details.
def where(*cond, &block)
add_filter(:where, cond, &block)
end
# Return a clone of the dataset with an addition named window that can be
# referenced in window functions. See Sequel::SQL::Window for a list of
# options that can be passed in. Example:
#
# DB[:items].window(:w, :partition=>:c1, :order=>:c2)
/home/sally/.rvm/gems/ruby-3.0.0/gems/sequel-5.60.1/lib/sequel/model/plugins.rb
in
where
# on the dataset. This is designed for plugins to define dataset methods
# inside ClassMethods that call the implementations in DatasetMethods.
#
# This should not be called with untrusted input or method names that
# can't be used literally, since it uses class_eval.
def self.def_dataset_methods(mod, meths)
Array(meths).each do |meth|
mod.class_eval("def #{meth}(*args, &block); dataset.#{meth}(*args, &block) end", __FILE__, __LINE__)
# :nocov:
mod.send(:ruby2_keywords, meth) if respond_to?(:ruby2_keywords, true)
# :nocov:
end
end
# Add method to +mod+ that overrides inherited_instance_variables to include the
/srv/api/ygo_top_decks/lib/top_decks/statistics.rb
in
top_duelists_for_time_range
:stats_type => 'duelists',
:start_date => start_date,
:end_date => end_date).select(:data).first
return JSON.parse db_item[:data]
end
# Build list of all tournament placed strings and ints
placed_items = DeckList.where(
Sequel.expr(:tournament_placed_int) < 9,
Sequel.~(:tournament_placed_int => 0),
Sequel.~(
Sequel.like(:tournament_placed, / \- 1[0-9]/)
)
).distinct(
:tournament_placed
/srv/api/ygo_top_decks/web/routes/miscellaneous.rb
in
block in <class:WebApp>
if params['start_date'] and params['end_date']
@start_date = Chronic.parse(params['start_date']).to_date
@end_date = Chronic.parse(params['end_date']).to_date
@filter = "#{@start_date} - #{@end_date}"
end
# Get statistics
@usage_stats = TopDecks::Statistics.top_duelists_for_time_range @start_date, @end_date
# Render page
@page_title = "Top Duelists (#{@filter})"
haml :top_duelists
end
end
/home/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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 != 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))
end
/home/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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 != 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))
end
/home/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
each
block.call(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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
route!
block.call(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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-protection-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-protection-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-protection-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-protection-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-protection-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-protection-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-protection-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb
in
context
def call(env)
context(env)
end
def context(env, app = @app)
req = make_request env
prepare_session(req)
status, headers, body = app.call(req.env)
res = Rack::Response::Raw.new status, headers
commit_session(req, res)
[status, headers, body]
end
private
/home/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/session/abstract/id.rb
in
call
@key = @default_options.delete(:key)
@cookie_only = @default_options.delete(:cookie_only)
@same_site = @default_options.delete(:same_site)
initialize_sid
end
def call(env)
context(env)
end
def context(env, app = @app)
req = make_request env
prepare_session(req)
status, headers, body = app.call(req.env)
res = Rack::Response::Raw.new status, headers
/home/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/null_logger.rb
in
call
class NullLogger
def initialize(app)
@app = app
end
def call(env)
env[RACK_LOGGER] = self
@app.call(env)
end
def info(progname = nil, &block); end
def debug(progname = nil, &block); end
def warn(progname = nil, &block); end
def error(progname = nil, &block); end
def fatal(progname = nil, &block); end
/home/sally/.rvm/gems/ruby-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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb
in
call
class TempfileReaper
def initialize(app)
@app = app
end
def call(env)
env[RACK_TEMPFILES] ||= []
status, headers, body = @app.call(env)
body_proxy = BodyProxy.new(body) do
env[RACK_TEMPFILES].each(&:close!) unless env[RACK_TEMPFILES].nil?
end
[status, headers, body_proxy]
end
end
end
/home/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/lint.rb
in
_call
assert("No env given") { env }
check_env env
env[RACK_INPUT] = InputWrapper.new(env[RACK_INPUT])
env[RACK_ERRORS] = ErrorWrapper.new(env[RACK_ERRORS])
## and returns an Array of exactly three values:
ary = @app.call(env)
assert("response is not an Array, but #{ary.class}") {
ary.kind_of? Array
}
assert("response array has #{ary.size} elements instead of 3") {
ary.size == 3
}
/home/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/lint.rb
in
call
## after to catch all mistakes.
## = Rack applications
## A Rack application is a Ruby object (not a class) that
## responds to +call+.
def call(env = nil)
dup._call(env)
end
def _call(env)
## It takes exactly one argument, the *environment*
assert("No env given") { env }
check_env env
/home/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/show_exceptions.rb
in
call
CONTEXT = 7
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
rescue StandardError, LoadError, SyntaxError => e
exception_string = dump_exception(e)
env[RACK_ERRORS].puts(exception_string)
env[RACK_ERRORS].flush
if accepts_html?(env)
/home/sally/.rvm/gems/ruby-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/sally/.rvm/gems/ruby-3.0.0/gems/sinatra-2.2.2/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/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/chunked.rb
in
call
end
end
# If the rack app returns a response that should have a body,
# but does not have Content-Length or Transfer-Encoding headers,
# modify the response to use chunked Transfer-Encoding.
def call(env)
status, headers, body = @app.call(env)
headers = HeaderHash[headers]
if chunkable_version?(env[SERVER_PROTOCOL]) &&
!STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) &&
!headers[CONTENT_LENGTH] &&
!headers[TRANSFER_ENCODING]
/home/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/content_length.rb
in
call
include Rack::Utils
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
headers = HeaderHash[headers]
if !STATUS_WITH_NO_ENTITY_BODY.key?(status.to_i) &&
!headers[CONTENT_LENGTH] &&
!headers[TRANSFER_ENCODING]
obody = body
/home/sally/.rvm/gems/ruby-3.0.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb
in
process_client
env["rack.early_hints"] = lambda do |headers|
e103_response_write(client, headers)
end
end
env["rack.after_reply"] = []
status, headers, body = @app.call(env)
begin
return if @request.hijacked?
if 100 == status.to_i
e100_response_write(client, env)
status, headers, body = @app.call(env)
/home/sally/.rvm/gems/ruby-3.0.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb
in
worker_loop
begin
reopen = reopen_worker_logs(worker.nr) if reopen
worker.tick = time_now.to_i
while sock = ready.shift
# Unicorn::Worker#kgio_tryaccept is not like accept(2) at all,
# but that will return false
if client = sock.kgio_tryaccept
process_client(client)
worker.tick = time_now.to_i
end
break if reopen
end
# timeout so we can .tick and keep parent from SIGKILL-ing us
worker.tick = time_now.to_i
/home/sally/.rvm/gems/ruby-3.0.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb
in
spawn_missing_workers
worker = Unicorn::Worker.new(worker_nr)
before_fork.call(self, worker)
pid = @worker_exec ? worker_spawn(worker) : fork
unless pid
after_fork_internal
worker_loop(worker)
exit
end
@workers[pid] = worker
worker.atfork_parent
end
rescue => e
/home/sally/.rvm/gems/ruby-3.0.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb
in
maintain_worker_count
rescue => e
@logger.error(e) rescue nil
exit!
end
def maintain_worker_count
(off = @workers.size - worker_processes) == 0 and return
off < 0 and return spawn_missing_workers
@workers.each_value { |w| w.nr >= worker_processes and w.soft_kill(:QUIT) }
end
# if we get any error, try to write something back to the client
# assuming we haven't closed the socket, but don't get hung up
# if the socket is already closed or broken. We'll always ensure
# the socket is closed at the end of this function
/home/sally/.rvm/gems/ruby-3.0.0/gems/unicorn-6.1.0/lib/unicorn/http_server.rb
in
join
# machine) comes out of suspend/hibernation
if (last_check + @timeout) >= (last_check = time_now)
sleep_time = murder_lazy_workers
else
sleep_time = @timeout/2.0 + 1
@logger.debug("waiting #{sleep_time}s after suspend/hibernation")
end
maintain_worker_count if respawn
master_sleep(sleep_time)
when :QUIT # graceful shutdown
break
when :TERM, :INT # immediate shutdown
stop(false)
break
when :USR1 # rotate logs
/home/sally/.rvm/gems/ruby-3.0.0/gems/unicorn-6.1.0/bin/unicorn
in
<top (required)>
:unicorn_options => options,
:app => app,
:daemonize => rackup_opts[:daemonize],
})
end
Unicorn::Launcher.daemonize!(options) if rackup_opts[:daemonize]
Unicorn::HttpServer.new(app, options).start.join
/home/sally/.rvm/gems/ruby-3.0.0/bin/unicorn
in
load
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('unicorn', 'unicorn', version)
else
gem "unicorn", version
load Gem.bin_path("unicorn", "unicorn", version)
end
/home/sally/.rvm/gems/ruby-3.0.0/bin/unicorn
in
<main>
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('unicorn', 'unicorn', version)
else
gem "unicorn", version
load Gem.bin_path("unicorn", "unicorn", version)
end
/home/sally/.rvm/gems/ruby-3.0.0/bin/ruby_executable_hooks
in
eval
content = File.read($0)
if (index = content.index("\n#!ruby\n")) && index > 0
skipped_content = content.slice!(0..index)
start_line = skipped_content.count("\n") + 1
eval content, binding, $0, start_line
else
eval content, binding, $0
end
/home/sally/.rvm/gems/ruby-3.0.0/bin/ruby_executable_hooks
in
<main>
content = File.read($0)
if (index = content.index("\n#!ruby\n")) && index > 0
skipped_content = content.slice!(0..index)
start_line = skipped_content.count("\n") + 1
eval content, binding, $0, start_line
else
eval content, binding, $0
end
Variable | Value |
---|---|
filter | "Last 3 Months" |
No POST data.
Variable | Value |
---|---|
HTTP_ACCEPT | */* |
HTTP_ACCEPT_ENCODING | gzip, br |
HTTP_CDN_LOOP | cloudflare |
HTTP_CF_CONNECTING_IP | 52.55.214.236 |
HTTP_CF_IPCOUNTRY | US |
HTTP_CF_RAY | 86b985582fe60f68-EWR |
HTTP_CF_VISITOR | {"scheme":"https"} |
HTTP_CONNECTION | close |
HTTP_HOST | yugiohtopdecks.com |
HTTP_REFERER | http://yugiohtopdecks.com/top_duelists?filter=Last+3+Months |
HTTP_USER_AGENT | claudebot |
HTTP_VERSION | HTTP/1.0 |
HTTP_X_FORWARDED_FOR | 52.55.214.236, 172.70.110.31 |
HTTP_X_FORWARDED_PROTO | https |
HTTP_X_REAL_IP | 172.70.110.31 |
PATH_INFO | /top_duelists |
QUERY_STRING | filter=Last+3+Months |
REMOTE_ADDR | 127.0.0.1 |
REQUEST_METHOD | GET |
REQUEST_PATH | /top_duelists |
REQUEST_URI | /top_duelists?filter=Last+3+Months |
SCRIPT_NAME | |
SERVER_NAME | yugiohtopdecks.com |
SERVER_PORT | 443 |
SERVER_PROTOCOL | HTTP/1.0 |
SERVER_SOFTWARE | Unicorn 6.1.0 |
rack.after_reply | [] |
rack.errors | #<Object:0x0000000002270a18> |
rack.hijack | #<Proc:0x000000003ada4ca8 /home/sally/.rvm/gems/ruby-3.0.0/gems/rack-2.2.4/lib/rack/lint.rb:567> |
rack.hijack? | true |
rack.input | #<Rack::Lint::InputWrapper:0x000000003ada4af0 @input=#<StringIO:0x0000000001c87b10>> |
rack.logger | #<Rack::NullLogger:0x00000000035461b0 @app=#<Rack::Session::Cookie:0x0000000003546408 @secrets=["d4127fb69dbfaded12e69eb9ddf844737df3e184c472be4931e9132e91ae18cfe3debf7f12ba2971bfaa33a84a2f80af5245c74a8631b2e068b86a274b6f5a07"], @hmac=OpenSSL::Digest::SHA1, @coder=#<Rack::Session::Cookie::Base64::Marshal:0x0000000003546340>, @app=#<Rack::Protection::FrameOptions:0x0000000003546598 @app=#<Rack::Protection::HttpOrigin:0x00000000035466d8 @app=#<Rack::Protection::IPSpoofing:0x00000000035467f0 @app=#<Rack::Protection::JsonCsrf:0x0000000003546c28 @app=#<Rack::Protection::RemoteToken:0x0000000003546e08 @app=#<Rack::Protection::SessionHijacking:0x0000000003546fc0 @app=#<Rack::Protection::XSSHeader:0x0000000003547128 @app=#<TopDecks::WebApp:0x00000000034aee00 @default_layout=:layout, @preferred_extension=nil, @app=nil, @template_cache=#<Tilt::Cache:0x00000000034aed10 @cache={}>, @pinned_response=nil>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml", "text/xml", "application/xml"], :xss_mode=>:block, :nosniff=>true, :img_src=>"'self' data:", :font_src=>"'self'", :except=>:path_traversal, :without_session=>false}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml", "text/xml", "application/xml"], :tracking_key=>:tracking, :encrypt_tracking=>true, :track=>["HTTP_USER_AGENT"], :img_src=>"'self' data:", :font_src=>"'self'", :except=>:path_traversal, :without_session=>false}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml", "text/xml", "application/xml"], :authenticity_param=>"authenticity_token", :key=>:csrf, :allow_if=>nil, :img_src=>"'self' data:", :font_src=>"'self'", :except=>:path_traversal, :without_session=>false}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml", "text/xml", "application/xml"], :allow_if=>nil, :img_src=>"'self' data:", :font_src=>"'self'", :except=>:path_traversal, :without_session=>false}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml", "text/xml", "application/xml"], :img_src=>"'self' data:", :font_src=>"'self'", :except=>:path_traversal, :without_session=>false}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml", "text/xml", "application/xml"], :allow_if=>nil, :img_src=>"'self' data:", :font_src=>"'self'", :except=>:path_traversal, :without_session=>false}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml", "text/xml", "application/xml"], :frame_options=>:sameorigin, :img_src=>"'self' data:", :font_src=>"'self'", :except=>:path_traversal, :without_session=>false}, @frame_options="SAMEORIGIN">, @default_options={:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :sidbits=>128, :secure_random=>SecureRandom, :secret=>"d4127fb69dbfaded12e69eb9ddf844737df3e184c472be4931e9132e91ae18cfe3debf7f12ba2971bfaa33a84a2f80af5245c74a8631b2e068b86a274b6f5a07", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x0000000003546340>}, @key="rack.session", @cookie_only=true, @same_site=nil, @sidbits=128, @sid_secure=SecureRandom, @sid_length=32>> |
rack.multiprocess | true |
rack.multithread | false |
rack.request.cookie_hash | {"currency"=>"USD"} |
rack.request.query_hash | {"filter"=>"Last 3 Months"} |
rack.request.query_string | filter=Last+3+Months |
rack.run_once | false |
rack.session | {"session_id"=>"30bd84c1f903445f07d2776a5420bceafc38310dc90c3127fa25371ea54c1147", "csrf"=>"FhI5Kc3W1P_YhCvpcl_t-8J7NG-NHWsaJgTDYts_AhM=", "tracking"=>{"HTTP_USER_AGENT"=>"ec0660ee20674482e3fbf9df2da732a482688d77"}} |
rack.session.options | {:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :sidbits=>128, :secure_random=>SecureRandom, :secret=>"d4127fb69dbfaded12e69eb9ddf844737df3e184c472be4931e9132e91ae18cfe3debf7f12ba2971bfaa33a84a2f80af5245c74a8631b2e068b86a274b6f5a07", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x0000000003546340>} |
rack.session.unpacked_cookie_data | {"session_id"=>"30bd84c1f903445f07d2776a5420bceafc38310dc90c3127fa25371ea54c1147"} |
rack.tempfiles | [] |
rack.url_scheme | https |
rack.version | [1, 2] |
sinatra.accept | [#<Sinatra::Request::AcceptEntry:0x000000003adfc7a0 @entry="*/*", @type="*/*", @params={}, @q=1.0>] |
sinatra.commonlogger | true |
sinatra.error | #<Sequel::Error: Invalid filter expression: [#<Sequel::SQL::BooleanExpression @op=>:<, @args=>[#<Sequel::SQL::Identifier @value=>"tournament_placed_int">, 9]>, #<Sequel::SQL::BooleanExpression @op=>:!=, @args=>[:tournament_placed_int, 0]>, #<Sequel::SQL::BooleanExpression @op=>:!~, @args=>[:tournament_placed, " \\- 1[0-9]"]>]> |
sinatra.error.params | {"filter"=>"Last 3 Months"} |
sinatra.route | GET /top_duelists |
unicorn.socket | #<Kgio::Socket:fd 8> |
You're seeing this error because you have
enabled the show_exceptions
setting.