postgres.rb
async_exec
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
async_exec
end
private
# Return the PGResult object that is returned by executing the given
# sql and args.
def execute_query(sql, args)
@db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}
end
end
# Database class for PostgreSQL databases used with Sequel and the
# pg, postgres, or postgres-pr driver.
class Database < Sequel::Database
include Sequel::Postgres::DatabaseMethods
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
block in execute_query
end
private
# Return the PGResult object that is returned by executing the given
# sql and args.
def execute_query(sql, args)
@db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}
end
end
# Database class for PostgreSQL databases used with Sequel and the
# pg, postgres, or postgres-pr driver.
class Database < Sequel::Database
include Sequel::Postgres::DatabaseMethods
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/database/logging.rb
in
log_connection_yield
Sequel::Deprecation.deprecate("Sequel::Database#log_yield", "Update the adapter to use Sequel::Database#log_connection_yield")
log_connection_yield(sql, nil, args, &block)
end
# Yield to the block, logging any errors at error level to all loggers,
# and all other queries with the duration at warn or info level.
def log_connection_yield(sql, conn, args=nil)
return yield if @loggers.empty?
sql = "#{connection_info(conn) if conn && log_connection_info}#{sql}#{"; #{args.inspect}" if args}"
start = Time.now
begin
yield
rescue => e
log_exception(e, sql)
raise
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
execute_query
end
private
# Return the PGResult object that is returned by executing the given
# sql and args.
def execute_query(sql, args)
@db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}
end
end
# Database class for PostgreSQL databases used with Sequel and the
# pg, postgres, or postgres-pr driver.
class Database < Sequel::Database
include Sequel::Postgres::DatabaseMethods
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
block in execute
end
end
# Execute the given SQL with this connection. If a block is given,
# yield the results, otherwise, return the number of changed rows.
def execute(sql, args=nil)
args = args.map{|v| @db.bound_variable_arg(v, self)} if args
q = check_disconnect_errors{execute_query(sql, args)}
begin
block_given? ? yield(q) : q.cmd_tuples
ensure
q.clear if q && q.respond_to?(:clear)
end
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
check_disconnect_errors
attr_reader(:prepared_statements) if USES_PG
# Raise a Sequel::DatabaseDisconnectError if a one of the disconnect
# error classes is raised, or a PGError is raised and the connection
# status cannot be determined or it is not OK.
def check_disconnect_errors
begin
yield
rescue *DISCONNECT_ERROR_CLASSES => e
disconnect = true
raise(Sequel.convert_exception_class(e, Sequel::DatabaseDisconnectError))
rescue PGError => e
disconnect = false
begin
s = status
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
execute
end
end
# Execute the given SQL with this connection. If a block is given,
# yield the results, otherwise, return the number of changed rows.
def execute(sql, args=nil)
args = args.map{|v| @db.bound_variable_arg(v, self)} if args
q = check_disconnect_errors{execute_query(sql, args)}
begin
block_given? ? yield(q) : q.cmd_tuples
ensure
q.clear if q && q.respond_to?(:clear)
end
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
_execute
private
# Execute the given SQL string or prepared statement on the connection object.
def _execute(conn, sql, opts, &block)
if sql.is_a?(Symbol)
execute_prepared_statement(conn, sql, opts, &block)
else
conn.execute(sql, opts[:arguments], &block)
end
end
# Execute the prepared statement name with the given arguments on the connection.
def _execute_prepared_statement(conn, ps_name, args, opts)
conn.exec_prepared(ps_name, args)
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
block (2 levels) in execute
h[:type] = r.error_field(::PG::PG_DIAG_DATATYPE_NAME)
h
end
end
# Execute the given SQL with the given args on an available connection.
def execute(sql, opts=OPTS, &block)
synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}
end
if USES_PG
# +copy_table+ uses PostgreSQL's +COPY TO STDOUT+ SQL statement to return formatted
# results directly to the caller. This method is only supported if pg is the
# underlying ruby driver. This method should only be called if you want
# results returned to the client. If you are using +COPY TO+
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
check_database_errors
conversion_procs[1082] = TYPE_TRANSLATOR.method(:date) if @use_iso_date_format
self.convert_infinite_timestamps = @opts[:convert_infinite_timestamps]
end
# Convert exceptions raised from the block into DatabaseErrors.
def check_database_errors
begin
yield
rescue => e
raise_error(e, :classes=>CONVERTED_EXCEPTIONS)
end
end
# Set the DateStyle to ISO if configured, for faster date parsing.
def connection_configuration_sqls
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
block in execute
h[:type] = r.error_field(::PG::PG_DIAG_DATATYPE_NAME)
h
end
end
# Execute the given SQL with the given args on an available connection.
def execute(sql, opts=OPTS, &block)
synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}
end
if USES_PG
# +copy_table+ uses PostgreSQL's +COPY TO STDOUT+ SQL statement to return formatted
# results directly to the caller. This method is only supported if pg is the
# underlying ruby driver. This method should only be called if you want
# results returned to the client. If you are using +COPY TO+
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/database/connecting.rb
in
block in synchronize
# If a server option is given, acquires a connection for that specific
# server, instead of the :default server.
#
# DB.synchronize do |conn|
# # ...
# end
def synchronize(server=nil)
@pool.hold(server || :default){|conn| yield conn}
end
else
# :nocov:
def synchronize(server=nil, &block)
@pool.hold(server || :default, &block)
end
# :nocov:
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/connection_pool/threaded.rb
in
hold
def hold(server=nil)
t = Thread.current
if conn = owned_connection(t)
return yield(conn)
end
begin
conn = acquire(t)
yield conn
rescue Sequel::DatabaseDisconnectError, *@error_classes => e
if disconnect_error?(e)
oconn = conn
conn = nil
disconnect_connection(oconn) if oconn
@allocated.delete(t)
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/database/connecting.rb
in
synchronize
# If a server option is given, acquires a connection for that specific
# server, instead of the :default server.
#
# DB.synchronize do |conn|
# # ...
# end
def synchronize(server=nil)
@pool.hold(server || :default){|conn| yield conn}
end
else
# :nocov:
def synchronize(server=nil, &block)
@pool.hold(server || :default, &block)
end
# :nocov:
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
execute
h[:type] = r.error_field(::PG::PG_DIAG_DATATYPE_NAME)
h
end
end
# Execute the given SQL with the given args on an available connection.
def execute(sql, opts=OPTS, &block)
synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}
end
if USES_PG
# +copy_table+ uses PostgreSQL's +COPY TO STDOUT+ SQL statement to return formatted
# results directly to the caller. This method is only supported if pg is the
# underlying ruby driver. This method should only be called if you want
# results returned to the client. If you are using +COPY TO+
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/dataset/actions.rb
in
execute
def execute(sql, opts=OPTS, &block)
db = @db
if db.sharded?
opts = Hash[opts]
opts[:server] = @opts[:server] || (@opts[:lock] ? :default : :read_only)
opts
end
db.execute(sql, opts, &block)
end
# Execute the given SQL on the database using execute_ddl.
def execute_ddl(sql, opts=OPTS, &block)
@db.execute_ddl(sql, default_server_opts(opts), &block)
nil
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/adapters/postgres.rb
in
fetch_rows
DEFAULT_CURSOR_NAME = 'sequel_cursor'.freeze
Sequel::Deprecation.deprecate_constant(self, :DEFAULT_CURSOR_NAME)
# Yield all rows returned by executing the given SQL and converting
# the types.
def fetch_rows(sql)
return cursor_fetch_rows(sql){|h| yield h} if @opts[:cursor]
execute(sql){|res| yield_hash_rows(res, fetch_rows_set_cols(res)){|h| yield h}}
end
# Use a cursor for paging.
def paged_each(opts=OPTS, &block)
use_cursor(opts).each(&block)
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/model/base.rb
in
primary_key_lookup
# it is overridden by plugins which assume that the passed argument
# is valid.
def primary_key_lookup(pk)
if sql = @fast_pk_lookup_sql
sql = sql.dup
ds = dataset
ds.literal_append(sql, pk)
ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}
nil
elsif dataset.joined_dataset?
dataset.first(qualified_primary_key_hash(pk))
else
dataset.first(primary_key_hash(pk))
end
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sequel-4.47.0/lib/sequel/model/base.rb
in
[]
# Artist[1] # SELECT * FROM artists WHERE id = 1
# # => #<Artist {:id=>1, ...}>
#
# Artist[:name=>'Bob'] # SELECT * FROM artists WHERE (name = 'Bob') LIMIT 1
# # => #<Artist {:name=>'Bob', ...}>
def [](*args)
args = args.first if args.size <= 1
args.is_a?(Hash) ? first(args) : (primary_key_lookup(args) unless args.nil?)
end
# Initializes a model instance as an existing record. This constructor is
# used by Sequel to initialize model instances when fetching records.
# Requires that values be a hash where all keys are symbols. It
# probably should not be used by external code.
def call(values)
/home/ujif/funcat/app/app.rb
in
block in <class:App>
get "/" do
@objects = Archive.order_by(:code)
render 'archive'
end
get "archive/:id" do
@archive = Archive[params[:id]] or not_found
funds = @archive.funds
offset, limit = paginate(funds)
@objects = funds.order_by(*FUNDS_ORDER).offset(offset).limit(limit)
render "archive-funds"
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/application/routing.rb
in
call
path, name, route_parents, options, route_options = *parse_route(path, route_options, verb)
options.reverse_merge!(@_conditions) if @_conditions
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
block = if block.arity == 0
proc{ |request, _| unbound_method.bind(request).call }
else
proc{ |request, block_params| unbound_method.bind(request).call(*block_params) }
end
invoke_hook(:route_added, verb, path, block)
# HTTPRouter route construction
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/application/routing.rb
in
block in route
path, name, route_parents, options, route_options = *parse_route(path, route_options, verb)
options.reverse_merge!(@_conditions) if @_conditions
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
block = if block.arity == 0
proc{ |request, _| unbound_method.bind(request).call }
else
proc{ |request, block_params| unbound_method.bind(request).call(*block_params) }
end
invoke_hook(:route_added, verb, path, block)
# HTTPRouter route construction
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/ext/http_router.rb
in
[]
parent_layout = @layout
successful = false
begin
filter! :before
(@route.before_filters - settings.filters[:before]).each { |block| instance_eval(&block) }
@layout = path.route.use_layout if path.route.use_layout
@route.custom_conditions.each { |block| pass if block.bind(self).call == false }
halt_response = catch(:halt) { route_eval { @route.dest[self, @block_params] } }
@_response_buffer = halt_response.is_a?(Array) ? halt_response.last : halt_response
successful = true
halt halt_response
ensure
(@route.after_filters - settings.filters[:after]).each { |block| instance_eval(&block) } if successful
@layout = parent_layout
@params = original_params
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/ext/http_router.rb
in
block (3 levels) in process_destination_path
parent_layout = @layout
successful = false
begin
filter! :before
(@route.before_filters - settings.filters[:before]).each { |block| instance_eval(&block) }
@layout = path.route.use_layout if path.route.use_layout
@route.custom_conditions.each { |block| pass if block.bind(self).call == false }
halt_response = catch(:halt) { route_eval { @route.dest[self, @block_params] } }
@_response_buffer = halt_response.is_a?(Array) ? halt_response.last : halt_response
successful = true
halt halt_response
ensure
(@route.after_filters - settings.filters[:after]).each { |block| instance_eval(&block) } if successful
@layout = parent_layout
@params = original_params
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/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/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/ext/http_router.rb
in
block (2 levels) in process_destination_path
parent_layout = @layout
successful = false
begin
filter! :before
(@route.before_filters - settings.filters[:before]).each { |block| instance_eval(&block) }
@layout = path.route.use_layout if path.route.use_layout
@route.custom_conditions.each { |block| pass if block.bind(self).call == false }
halt_response = catch(:halt) { route_eval { @route.dest[self, @block_params] } }
@_response_buffer = halt_response.is_a?(Array) ? halt_response.last : halt_response
successful = true
halt halt_response
ensure
(@route.after_filters - settings.filters[:after]).each { |block| instance_eval(&block) } if successful
@layout = parent_layout
@params = original_params
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/ext/http_router.rb
in
catch
parent_layout = @layout
successful = false
begin
filter! :before
(@route.before_filters - settings.filters[:before]).each { |block| instance_eval(&block) }
@layout = path.route.use_layout if path.route.use_layout
@route.custom_conditions.each { |block| pass if block.bind(self).call == false }
halt_response = catch(:halt) { route_eval { @route.dest[self, @block_params] } }
@_response_buffer = halt_response.is_a?(Array) ? halt_response.last : halt_response
successful = true
halt halt_response
ensure
(@route.after_filters - settings.filters[:after]).each { |block| instance_eval(&block) } if successful
@layout = parent_layout
@params = original_params
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/ext/http_router.rb
in
block in process_destination_path
parent_layout = @layout
successful = false
begin
filter! :before
(@route.before_filters - settings.filters[:before]).each { |block| instance_eval(&block) }
@layout = path.route.use_layout if path.route.use_layout
@route.custom_conditions.each { |block| pass if block.bind(self).call == false }
halt_response = catch(:halt) { route_eval { @route.dest[self, @block_params] } }
@_response_buffer = halt_response.is_a?(Array) ? halt_response.last : halt_response
successful = true
halt halt_response
ensure
(@route.after_filters - settings.filters[:after]).each { |block| instance_eval(&block) } if successful
@layout = parent_layout
@params = original_params
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/ext/http_router.rb
in
instance_eval
require 'http_router' unless defined?(HttpRouter)
class HttpRouter
def rewrite_partial_path_info(env, request); end
def rewrite_path_info(env, request); end
def process_destination_path(path, env)
Thread.current['padrino.instance'].instance_eval do
request.route_obj = path.route
@_response_buffer = nil
@route = path.route
@params ||= {}
@params.update(env['router.params'])
@block_params = if match_data = env['router.request'].extra_env['router.regex_match']
params_list = match_data.to_a
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/ext/http_router.rb
in
process_destination_path
require 'http_router' unless defined?(HttpRouter)
class HttpRouter
def rewrite_partial_path_info(env, request); end
def rewrite_path_info(env, request); end
def process_destination_path(path, env)
Thread.current['padrino.instance'].instance_eval do
request.route_obj = path.route
@_response_buffer = nil
@route = path.route
@params ||= {}
@params.update(env['router.params'])
@block_params = if match_data = env['router.request'].extra_env['router.regex_match']
params_list = match_data.to_a
/home/ujif/.rvm/gems/ruby-2.1.8/gems/http_router-0.11.2/lib/http_router.rb
in
raw_call
def raw_call(env, &blk)
rack_request = ::Rack::Request.new(env)
request = Request.new(rack_request.path_info, rack_request)
if blk
@root.call(request, &blk)
request
else
@root.call(request) or no_response(request, env)
end
end
private
def compile
return if @compiled
@root.compile(@routes)
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/application/routing.rb
in
route!
invoke { handle_exception!(boom) } unless @env['sinatra.error']
end
end
def route!(base=settings, pass_block=nil)
Thread.current['padrino.instance'] = self
if base.compiled_router && result = base.compiled_router.call(@request.env)
if result.respond_to?(:each)
route_eval do
response.headers.merge!(result[1])
route_missing if status(result[0]) == 404
route_missing if (allow = response['Allow']) && allow.include?(request.env['REQUEST_METHOD'])
end
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/application/routing.rb
in
block in dispatch!
def filter!(type, base=settings)
base.filters[type].each { |block| instance_eval(&block) }
end
def dispatch!
invoke do
static! if settings.static? && (request.get? || request.head?)
route!
end
rescue ::Exception => boom
filter! :before if boom.kind_of? ::Sinatra::NotFound
invoke { @boom_handled = handle_exception!(boom) }
ensure
@boom_handled or begin
filter! :after unless env['sinatra.static_file']
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
block in invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
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)
elsif res.respond_to? :each
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
catch
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
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)
elsif res.respond_to? :each
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
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)
elsif res.respond_to? :each
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/application/routing.rb
in
dispatch!
end
def filter!(type, base=settings)
base.filters[type].each { |block| instance_eval(&block) }
end
def dispatch!
invoke do
static! if settings.static? && (request.get? || request.head?)
route!
end
rescue ::Exception => boom
filter! :before if boom.kind_of? ::Sinatra::NotFound
invoke { @boom_handled = handle_exception!(boom) }
ensure
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
block in call!
@request = Request.new(env)
@response = Response.new
@params = indifferent_params(@request.params)
template_cache.clear if settings.reload_templates
force_encoding(@params)
@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/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
block in invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
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)
elsif res.respond_to? :each
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
catch
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
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)
elsif res.respond_to? :each
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
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)
elsif res.respond_to? :each
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/base.rb
in
call!
@request = Request.new(env)
@response = Response.new
@params = indifferent_params(@request.params)
template_cache.clear if settings.reload_templates
force_encoding(@params)
@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/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/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
@request = Request.new(env)
@response = Response.new
@params = indifferent_params(@request.params)
/home/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/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/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/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/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/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/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/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/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb
in
call
# Array prototype has been patched to track data. Checks the referrer
# even on GET requests if the content type is JSON.
class JsonCsrf < Base
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(env) or [status, headers, body]
else
[status, headers, body]
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/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/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/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/ujif/.rvm/gems/ruby-2.1.8/gems/rack-protection-1.5.3/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/ujif/.rvm/gems/ruby-2.1.8/gems/rack-1.5.5/lib/rack/head.rb
in
call
# Rack::Head returns an empty body for all HEAD requests. It leaves
# all other requests unchanged.
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
if env["REQUEST_METHOD"] == "HEAD"
body.close if body.respond_to? :close
[status, headers, []]
else
[status, headers, body]
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/rack-1.5.5/lib/rack/methodoverride.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 = req.POST[METHOD_OVERRIDE_PARAM_KEY] ||
env[HTTP_METHOD_OVERRIDE_HEADER]
method.to_s.upcase
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/reloader/rack.rb
in
call
# Invoked in order to perform the reload as part of the request stack.
def call(env)
if @cooldown && Time.now > @last + @cooldown
Thread.list.size > 1 ? Thread.exclusive { Padrino.reload! } : Padrino.reload!
@last = Time.now
end
@app.call(env)
end
end
end
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/logger.rb
in
call
@app = app
@uri_root = uri_root.sub(/\/$/,"")
end
def call(env)
env['rack.logger'] = Padrino.logger
began_at = Time.now
status, header, body = @app.call(env)
log(env, status, header, began_at) if logger.debug?
[status, header, body]
end
private
def log(env, status, header, began_at)
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/lib/sinatra/show_exceptions.rb
in
call
def initialize(app)
@app = app
@template = ERB.new(TEMPLATE)
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"
exception = dump_exception(e)
else
/home/ujif/.rvm/gems/ruby-2.1.8/gems/rack-1.5.5/lib/rack/session/abstract/id.rb
in
context
def call(env)
context(env)
end
def context(env, app=@app)
prepare_session(env)
status, headers, body = app.call(env)
commit_session(env, status, headers, body)
end
private
def initialize_sid
@sidbits = @default_options[:sidbits]
/home/ujif/.rvm/gems/ruby-2.1.8/gems/rack-1.5.5/lib/rack/session/abstract/id.rb
in
call
@default_options = self.class::DEFAULT_OPTIONS.merge(options)
@key = @default_options.delete(:key)
@cookie_only = @default_options.delete(:cookie_only)
initialize_sid
end
def call(env)
context(env)
end
def context(env, app=@app)
prepare_session(env)
status, headers, body = app.call(env)
commit_session(env, status, headers, body)
end
/home/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/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/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/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/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/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/ujif/.rvm/gems/ruby-2.1.8/gems/sinatra-1.4.8/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/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/router.rb
in
block in call
next unless path_info =~ match && rest = $1
next unless rest.empty? || rest[0] == ?/
rest = "/" if rest.empty?
env['SCRIPT_NAME'] = script_name + path
env['PATH_INFO'] = rest
last_result = app.call(env)
cascade_setting = app.respond_to?(:cascade) ? app.cascade : true
cascade_statuses = cascade_setting.respond_to?(:include?) ? cascade_setting : Mounter::DEFAULT_CASCADE
break unless cascade_setting && cascade_statuses.include?(last_result[0])
end
last_result || begin
env['SCRIPT_NAME'] = script_name
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/router.rb
in
each
def call(env)
began_at = Time.now
path_info = env["PATH_INFO"].to_s
script_name = env['SCRIPT_NAME']
http_host = env['HTTP_HOST']
last_result = nil
@mapping.each do |host, path, match, app|
next unless host.nil? || http_host =~ host
next unless path_info =~ match && rest = $1
next unless rest.empty? || rest[0] == ?/
rest = "/" if rest.empty?
env['SCRIPT_NAME'] = script_name + path
/home/ujif/.rvm/gems/ruby-2.1.8/gems/padrino-core-0.12.8/lib/padrino-core/router.rb
in
call
def call(env)
began_at = Time.now
path_info = env["PATH_INFO"].to_s
script_name = env['SCRIPT_NAME']
http_host = env['HTTP_HOST']
last_result = nil
@mapping.each do |host, path, match, app|
next unless host.nil? || http_host =~ host
next unless path_info =~ match && rest = $1
next unless rest.empty? || rest[0] == ?/
rest = "/" if rest.empty?
env['SCRIPT_NAME'] = script_name + path
/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb
in
process_request
env[HTTP_VERSION] = HTTP_1_1
# Rails somehow modifies env['REQUEST_METHOD'], so we perform the comparison
# before the Rack application object is called.
is_head_request = env[REQUEST_METHOD] == HEAD
begin
status, headers, body = @app.call(env)
rescue => e
if !should_swallow_app_error?(e, socket_wrapper)
# It's a good idea to catch application exceptions here because
# otherwise maliciously crafted responses can crash the app,
# forcing it to be respawned, and thereby effectively DoSing it.
print_exception("Rack application object", e)
log_exception_to_union_station(env, e)
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
in
accept_and_process_next_request
channel.io = connection
headers = parse_request(connection, channel, buffer)
end
if headers
prepare_request(connection, headers)
begin
if headers[REQUEST_METHOD] == GET
process_request(headers, connection, socket_wrapper, @protocol == :http)
elsif headers[REQUEST_METHOD] == PING
process_ping(headers, connection)
false
elsif headers[REQUEST_METHOD] == OOBW
process_oobw(headers, connection)
false
else
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
in
main_loop
buffer.force_encoding('binary') if buffer.respond_to?(:force_encoding)
@union_station_hooks_defined = defined?(UnionStationHooks)
begin
finish_callback.call
while true
hijacked = accept_and_process_next_request(socket_wrapper, channel, buffer)
socket_wrapper = Utils::UnseekableSocket.new if hijacked
end
rescue Interrupted
# Do nothing.
end
debug("Thread handler main loop exited normally")
ensure
/usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb
in
block (3 levels) in start_threads
@threads_mutex.synchronize do
@concurrency.times do |i|
thread = create_thread_and_abort_on_exception(i) do |number|
begin
Thread.current[:name] = "Worker #{number + 1}"
handler = thread_handler.new(self, main_socket_options)
handler.install
handler.main_loop(set_initialization_state_to_true)
ensure
set_initialization_state.call(false)
unregister_current_thread
end
end
@threads << thread
expected_nthreads += 1
/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb
in
block in create_thread_and_abort_on_exception
# This method requires 'thread' and 'ruby_core_enhancements'.
# If 'debug_logging' is loaded and included in the current module,
# it will use that for logging.
def create_thread_and_abort_on_exception(*args)
Thread.new do
Thread.current.abort_on_exception = true
begin
yield(*args)
rescue SystemExit
raise
rescue Exception => e
print_exception(nil, e)
exit(1)
end
end
Variable | Value |
---|---|
fund_id | "100000100395" |
page | "6" |
No POST data.
Variable | Value |
---|---|
HTTP_ACCEPT | */* |
HTTP_HOST | fc.gasur.ru |
HTTP_USER_AGENT | claudebot |
HTTP_VERSION | HTTP/1.1 |
HTTP_X_FORWARDED_FOR | 192.168.2.190 |
HTTP_X_REAL_IP | 192.168.2.190 |
PASSENGER_CONNECT_PASSWORD | TdBqnMUFuVOyONJ3 |
PATH_INFO | /archive/100000000010 |
QUERY_STRING | page=6&fund_id=100000100395 |
REMOTE_ADDR | 192.168.2.190 |
REMOTE_PORT | 41596 |
REQUEST_METHOD | GET |
REQUEST_URI | /archive/100000000010?page=6&fund_id=100000100395 |
SCRIPT_NAME | |
SERVER_NAME | fc.gasur.ru |
SERVER_PORT | 80 |
SERVER_PROTOCOL | HTTP/1.1 |
SERVER_SOFTWARE | Apache/2.2.22 (Debian) Phusion_Passenger/5.2.0 |
rack.errors | #<Object:0x90f61f4> |
rack.hijack | #<Proc:0x9df0814@/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:84 (lambda)> |
rack.hijack? | true |
rack.input | #<PhusionPassenger::Utils::TeeInput:0x9df088c @len=0, @socket=#<PhusionPassenger::Utils::UnseekableSocket:0x9bccd94 @socket=#<UNIXSocket:fd 15>, @simulate_eof=true>, @bytes_read=0, @tmp=#<StringIO:0x9df0864>> |
rack.logger | #<Padrino::Logger:0x84aff80 @buffer=[], @auto_flush=true, @level=3, @log=#<File:/home/ujif/funcat/log/development.log>, @format_datetime="%d/%b/%Y %H:%M:%S", @format_message="%s - %s %s", @log_static=false, @colorize_logging=true> |
rack.multiprocess | true |
rack.multithread | false |
rack.request.cookie_hash | {} |
rack.request.query_hash | {"page"=>"6", "fund_id"=>"100000100395"} |
rack.request.query_string | page=6&fund_id=100000100395 |
rack.run_once | false |
rack.session | {"session_id"=>"f040e89e85fa786e5cfdb977b04a056d53019770e11a8c8a6b1f2cda81876be4", "csrf"=>"2804ac64fc2d12d0924a50bb464f2cec", "tracking"=>{"HTTP_USER_AGENT"=>"ec0660ee20674482e3fbf9df2da732a482688d77", "HTTP_ACCEPT_LANGUAGE"=>"da39a3ee5e6b4b0d3255bfef95601890afd80709"}, "limit"=>nil} |
rack.session.options | {:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :sidbits=>128, :secure_random=>SecureRandom, :secret=>"ba0e0bff4006700ea93177cc08319c040f94ad6eff46bcbe39608f50a5719225", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x89b6d94>} |
rack.session.unpacked_cookie_data | {"session_id"=>"f040e89e85fa786e5cfdb977b04a056d53019770e11a8c8a6b1f2cda81876be4"} |
rack.url_scheme | http |
rack.version | [1, 2] |
router.params | {"id"=>"100000000010"} |
router.request | #<HttpRouter::Request:0x9dfa4a4 @rack_request=#<Rack::Request:0x9dfa4cc @env={"REQUEST_URI"=>"/archive/100000000010?page=6&fund_id=100000100395", "PATH_INFO"=>"/archive/100000000010", "SCRIPT_NAME"=>"", "QUERY_STRING"=>"page=6&fund_id=100000100395", "REQUEST_METHOD"=>"GET", "SERVER_NAME"=>"fc.gasur.ru", "SERVER_PORT"=>"80", "SERVER_SOFTWARE"=>"Apache/2.2.22 (Debian) Phusion_Passenger/5.2.0", "SERVER_PROTOCOL"=>"HTTP/1.1", "REMOTE_ADDR"=>"192.168.2.190", "REMOTE_PORT"=>"41596", "PASSENGER_CONNECT_PASSWORD"=>"TdBqnMUFuVOyONJ3", "HTTP_USER_AGENT"=>"claudebot", "HTTP_X_REAL_IP"=>"192.168.2.190", "HTTP_ACCEPT"=>"*/*", "HTTP_HOST"=>"fc.gasur.ru", "HTTP_X_FORWARDED_FOR"=>"192.168.2.190", "rack.version"=>[1, 2], "rack.input"=>#<PhusionPassenger::Utils::TeeInput:0x9df088c @len=0, @socket=#<PhusionPassenger::Utils::UnseekableSocket:0x9bccd94 @socket=#<UNIXSocket:fd 15>, @simulate_eof=true>, @bytes_read=0, @tmp=#<StringIO:0x9df0864>>, "rack.errors"=>#<Object:0x90f61f4>, "rack.multithread"=>false, "rack.multiprocess"=>true, "rack.run_once"=>false, "rack.url_scheme"=>"http", "rack.hijack?"=>true, "rack.hijack"=>#<Proc:0x9df0814@/usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:84 (lambda)>, "HTTP_VERSION"=>"HTTP/1.1", "rack.session"=>{"session_id"=>"f040e89e85fa786e5cfdb977b04a056d53019770e11a8c8a6b1f2cda81876be4", "csrf"=>"2804ac64fc2d12d0924a50bb464f2cec", "tracking"=>{"HTTP_USER_AGENT"=>"ec0660ee20674482e3fbf9df2da732a482688d77", "HTTP_ACCEPT_LANGUAGE"=>"da39a3ee5e6b4b0d3255bfef95601890afd80709"}, "limit"=>nil}, "rack.session.options"=>{:path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :sidbits=>128, :secure_random=>SecureRandom, :secret=>"ba0e0bff4006700ea93177cc08319c040f94ad6eff46bcbe39608f50a5719225", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x89b6d94>}, "rack.logger"=>#<Padrino::Logger:0x84aff80 @buffer=[], @auto_flush=true, @level=3, @log=#<File:/home/ujif/funcat/log/development.log>, @format_datetime="%d/%b/%Y %H:%M:%S", @format_message="%s - %s %s", @log_static=false, @colorize_logging=true>, "rack.request.cookie_hash"=>{}, "rack.session.unpacked_cookie_data"=>{"session_id"=>"f040e89e85fa786e5cfdb977b04a056d53019770e11a8c8a6b1f2cda81876be4"}, "rack.request.query_string"=>"page=6&fund_id=100000100395", "rack.request.query_hash"=>{"page"=>"6", "fund_id"=>"100000100395"}, "router.request"=>#<HttpRouter::Request:0x9dfa4a4 ...>, "router.params"=>{"id"=>"100000000010"}, "sinatra.error"=>#<Sequel::DatabaseDisconnectError: PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
>, "sinatra.accept"=>[#<Sinatra::Request::AcceptEntry:0x9df92e8 @entry="*/*", @type="*/*", @params={}, @q=1.0>]}>, @path=[], @extra_env={}, @params=["100000000010"], @acceptable_methods=#<Set: {"GET", "HEAD"}>> |
sinatra.accept | [#<Sinatra::Request::AcceptEntry:0x9df92e8 @entry="*/*", @type="*/*", @params={}, @q=1.0>] |
sinatra.error | #<Sequel::DatabaseDisconnectError: PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
> |
You're seeing this error because you have
enabled the show_exceptions
setting.