post.erb
block in singleton class
/home/ilya/ed-galaxy/views/post.erb
in
block in singleton class
<article class="blog-post">
<h2><%= @item.title %></h2>
<!-- <a class="comments" href="#">33 comments</a> -->
<!-- <a href="#"><img src="images/pic6.jpg" alt="" class="top blog-post-image" /></a> -->
<h3><a href="/blog/<%= @item.blog_id %>"><%= @item.blog_name %></a> / <%= @item.date_name %></h3>
<p><%= @item.content %></p>
<br>
<% @item.get_tags.each do |tag| %>
<a href="/tag/<%= tag.id %>"><div class="button"><%= tag.title %></div></a>
/home/ilya/.rvm/gems/ruby-2.2.2/gems/tilt-2.0.8/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)
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/ilya/.rvm/gems/ruby-2.2.2/gems/tilt-2.0.8/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)
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/ilya/.rvm/gems/ruby-2.2.2/gems/tilt-2.0.8/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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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 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
/home/ilya/ed-galaxy/app.rb
in
block in <top (required)>
@top_blogs = PostItem.top_blogs
erb :index
end
get '/post/:id' do
@item = PostItem.get(params[:id])
@top_blogs = PostItem.top_blogs
erb :post
end
get '/blog/:blog_id' do
@items = PostItem.blog_items(params[:blog_id])
@top_blogs = PostItem.top_blogs
erb :index
end
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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 != 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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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 != 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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
[]
# 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|
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
block (3 levels) 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|
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
block (2 levels) 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|
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
block in process_route
@params[:captures] = captures
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 = original if original
end
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
catch
captures = pattern.match(route).captures
values += captures
@params[:captures] = captures
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
process_route
captures = pattern.match(route).captures
values += captures
@params[:captures] = captures
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
block in route!
base.filters[type].each { |args| process_route(*args) }
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|
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
each
filter! type, base.superclass if base.superclass.respond_to?(:filters)
base.filters[type].each { |args| process_route(*args) }
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|
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
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
route!
filter! type, base.superclass if base.superclass.respond_to?(:filters)
base.filters[type].each { |args| process_route(*args) }
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|
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
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
block in dispatch!
# Dispatch a request with error handling.
def dispatch!
force_encoding(@params.merge!(@request.params))
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
end
rescue ::Exception => boom
invoke { handle_exception!(boom) }
ensure
begin
filter! :after unless env['sinatra.static_file']
rescue ::Exception => boom
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
dispatch!
nil # avoid double setting the same response tuple twice
end
# Dispatch a request with error handling.
def dispatch!
force_encoding(@params.merge!(@request.params))
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
end
rescue ::Exception => boom
invoke { handle_exception!(boom) }
ensure
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
block in call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
template_cache.clear if settings.reload_templates
@response['Content-Type'] = nil
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body and body[0].respond_to? :content_type
content_type body[0].content_type
else
content_type :html
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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
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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
template_cache.clear if settings.reload_templates
@response['Content-Type'] = nil
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body and body[0].respond_to? :content_type
content_type body[0].content_type
else
content_type :html
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
call
@app = app
@template_cache = Tilt::Cache.new
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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-protection-2.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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-protection-2.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)
if path.respond_to?(:encoding)
# Ruby 1.9+ M17N
/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-protection-2.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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-protection-2.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 and result.size == 3
end
/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-protection-2.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 and result.size == 3
end
/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-protection-2.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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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 call_without_check call unless method_defined? :call_without_check
def call(env)
env['sinatra.commonlogger'] = true
call_without_check(env)
/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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)
else
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/lib/sinatra/base.rb
in
call
# Some Rack handlers (Thin, 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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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(message)
super message + "\n\tfrom #{cleaned_caller.first.join(':')}"
end
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.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
/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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:
status, headers, @body = @app.call(env)
## The *status*,
check_status status
## the *headers*,
check_headers headers
check_hijack_response headers, env
/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/lib/rack/common_logger.rb
in
call
def initialize(app, logger=nil)
@app = app
@logger = logger
end
def call(env)
began_at = Time.now
status, header, body = @app.call(env)
header = Utils::HeaderHash.new(header)
body = BodyProxy.new(body) { log(env, status, header, began_at) }
[status, header, body]
end
private
/home/ilya/.rvm/gems/ruby-2.2.2/gems/sinatra-2.0.1/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/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/lib/rack/chunked.rb
in
call
false
else
true
end
end
def call(env)
status, headers, body = @app.call(env)
headers = HeaderHash.new(headers)
if ! chunkable_version?(env[HTTP_VERSION]) ||
STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
headers[CONTENT_LENGTH] ||
headers[TRANSFER_ENCODING]
[status, headers, body]
/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/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.new(headers)
if !STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) &&
!headers[CONTENT_LENGTH] &&
!headers[TRANSFER_ENCODING] &&
body.respond_to?(:to_ary)
/home/ilya/.rvm/gems/ruby-2.2.2/gems/unicorn-5.4.0/lib/unicorn/http_server.rb
in
process_client
"HTTP/1.1 100 Continue\r\n\r\n".freeze)
env.delete('HTTP_EXPECT'.freeze)
end
# once a client is accepted, it is processed in its entirety here
# in 3 easy steps: read request, call app, write app response
def process_client(client)
status, headers, body = @app.call(env = @request.read(client))
begin
return if @request.hijacked?
if 100 == status.to_i
e100_response_write(client, env)
status, headers, body = @app.call(env)
/home/ilya/.rvm/gems/ruby-2.2.2/gems/unicorn-5.4.0/lib/unicorn/http_server.rb
in
worker_loop
nr = 0
worker.tick = time_now.to_i
tmp = ready.dup
while sock = tmp.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)
nr += 1
worker.tick = time_now.to_i
end
break if nr < 0
end
# make the following bet: if we accepted clients this round,
/home/ilya/.rvm/gems/ruby-2.2.2/gems/unicorn-5.4.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/ilya/.rvm/gems/ruby-2.2.2/gems/unicorn-5.4.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/ilya/.rvm/gems/ruby-2.2.2/gems/unicorn-5.4.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/ilya/.rvm/gems/ruby-2.2.2/gems/unicorn-5.4.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/ilya/.rvm/gems/ruby-2.2.2/bin/unicorn
in
load
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
gem 'unicorn', version
load Gem.bin_path('unicorn', 'unicorn', version)
/home/ilya/.rvm/gems/ruby-2.2.2/bin/unicorn
in
<main>
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
gem 'unicorn', version
load Gem.bin_path('unicorn', 'unicorn', version)
/home/ilya/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks
in
eval
begin
require 'executable-hooks/hooks'
Gem::ExecutableHooks.run($0)
rescue LoadError
warn "unable to load executable-hooks/hooks" if ENV.key?('ExecutableHooks_DEBUG')
end
eval File.read($0), binding, $0
/home/ilya/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks
in
<main>
begin
require 'executable-hooks/hooks'
Gem::ExecutableHooks.run($0)
rescue LoadError
warn "unable to load executable-hooks/hooks" if ENV.key?('ExecutableHooks_DEBUG')
end
eval File.read($0), binding, $0
Variable | Value |
---|---|
CODE | "showTaglist" |
automodule | "minerva" |
tag | "галактика" |
No POST data.
Variable | Value |
---|---|
HTTP_ACCEPT | */* |
HTTP_CONNECTION | close |
HTTP_HOST | archive.novator.team |
HTTP_USER_AGENT | claudebot |
HTTP_VERSION | HTTP/1.0 |
HTTP_X_FORWARDED_FOR | 3.81.30.41 |
PATH_INFO | /post/index.php |
QUERY_STRING | automodule=minerva&CODE=showTaglist&tag=%D0%B3%D0%B0%D0%BB%D0%B0%D0%BA%D1%82%D0%B8%D0%BA%D0%B0 |
REMOTE_ADDR | 127.0.0.1 |
REQUEST_METHOD | GET |
REQUEST_PATH | /post/index.php |
REQUEST_URI | /post/index.php?automodule=minerva&CODE=showTaglist&tag=%D0%B3%D0%B0%D0%BB%D0%B0%D0%BA%D1%82%D0%B8%D0%BA%D0%B0 |
SCRIPT_NAME | |
SERVER_NAME | archive.novator.team |
SERVER_PORT | 80 |
SERVER_PROTOCOL | HTTP/1.0 |
SERVER_SOFTWARE | Unicorn 5.4.0 |
rack.errors | #<Object:0x00000002e6a3f0> |
rack.hijack | #<Proc:0x0000000a8e7150@/home/ilya/.rvm/gems/ruby-2.2.2/gems/rack-2.0.5/lib/rack/lint.rb:525> |
rack.hijack? | true |
rack.input | #<Rack::Lint::InputWrapper:0x0000000a8e6e58 @input=#<StringIO:0x0000000272d6f0>> |
rack.logger | #<Logger:0x0000000a8e6d90 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x0000000a8e6d68 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x0000000a8e6cf0 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<Rack::Lint::ErrorWrapper:0x0000000a8e6e30 @error=#<File:/home/ilya/ed-galaxy/log/unicorn.stderr.log>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x0000000a8e6cc8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x0000000a8e6c78>>>> |
rack.multiprocess | true |
rack.multithread | false |
rack.request.cookie_hash | {} |
rack.request.query_hash | {"automodule"=>"minerva", "CODE"=>"showTaglist", "tag"=>"галактика"} |
rack.request.query_string | automodule=minerva&CODE=showTaglist&tag=%D0%B3%D0%B0%D0%BB%D0%B0%D0%BA%D1%82%D0%B8%D0%BA%D0%B0 |
rack.run_once | false |
rack.tempfiles | [] |
rack.url_scheme | http |
rack.version | [1, 2] |
sinatra.accept | [#<Sinatra::Request::AcceptEntry:0x0000000abd1f00 @entry="*/*", @type="*/*", @params={}, @q=1.0>] |
sinatra.commonlogger | true |
sinatra.error | #<NoMethodError: undefined method `title' for nil:NilClass> |
sinatra.error.params | {"automodule"=>"minerva", "CODE"=>"showTaglist", "tag"=>"галактика", "id"=>"index.php"} |
sinatra.route | GET /post/:id |
unicorn.socket | #<Kgio::Socket:fd 10> |
You're seeing this error because you have
enabled the show_exceptions
setting.