persistent.rb
rescue in request
/usr/local/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net/http/persistent.rb
in
rescue in request
if retried or not can_retry? req
due_to = "(due to #{e.message} - #{e.class})"
message = error_message connection
finish connection
raise Error, "too many connection resets #{due_to} #{message}"
end
reset connection
retried = true
retry
ensure
/usr/local/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net/http/persistent.rb
in
request
reset connection
retried = true
retry
ensure
Thread.current[@timeout_key][connection_id] = Time.now
end
@http_versions["#{uri.host}:#{uri.port}"] ||= response.http_version
response
end
##
/usr/local/lib/ruby/gems/1.9.1/gems/mechanize-2.5.1/lib/mechanize/http/agent.rb
in
fetch
request_log request
response_body_io = nil
# Send the request
begin
response = connection.request(uri, request) { |res|
response_log res
response_body_io = response_read res, request, uri
res
}
rescue Mechanize::ChunkedTerminationError => e
/usr/local/lib/ruby/gems/1.9.1/gems/mechanize-2.5.1/lib/mechanize.rb
in
get
else
Page.new referer
end
end
# fetch the page
headers ||= {}
page = @agent.fetch uri, method, headers, parameters, referer
add_to_history(page)
yield page if block_given?
page
end
##
# GET +url+ and return only its contents
/web/sites/indieauth.com/lib/relparser.rb
in
load_page
end
end
if secure == false
return []
end
@page = @agent.get url.to_s
rescue OpenSSL::SSL::SSLError => e
puts "!!!! SSL ERROR: #{e.message}"
er = SSLError.new
er.url = url
raise er
rescue => e # catch all errors and return a blank list
puts "!!!!! #{e}"
/web/sites/indieauth.com/lib/relparser.rb
in
rel_me_links
end
return false
end
def rel_me_links(opts={})
links = []
load_page
return links if @page.nil?
@page.search("a,link").each do |link|
rels = (link.attribute("rel").to_s || '').split(/ /)
if rels.include? 'me'
puts " --> #{link.attribute("href").value} rel=#{link.attribute("rel")}"
/web/sites/indieauth.com/controllers/auth-web.rb
in
find_all_relme_links
profile
end
def find_all_relme_links(me_parser, profile=nil)
# Find all the rel=me links on the specified page
begin
links = me_parser.rel_me_links
rescue SocketError
json_error 200, {error: 'connection_error', error_description: "Error retrieving: #{me_parser.url}"}
end
if links.nil?
json_error 200, {error: 'no_links_found', error_description: "No links found on #{me_parser.url} or could not parse the page"}
end
/web/sites/indieauth.com/controllers/auth-web.rb
in
block in <class:Controller>
me = verify_me_param
profile = verify_profile_param
user = save_user_record me
me_parser = RelParser.new me
links = find_all_relme_links me_parser
if !links.include?(profile)
@message = "\"#{params[:profile]}\" was not found on the site \"#{params[:me]}\". Try re-scanning after checking your rel=me links on your site."
title "Error"
return erb :error
end
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
call
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
pattern, keys = compile path
conditions, @conditions = @conditions, []
[ pattern, keys, conditions, block.arity != 0 ?
proc { |a,p| unbound_method.bind(a).call(*p) } :
proc { |a,p| unbound_method.bind(a).call } ]
end
def compile(path)
keys = []
if path.respond_to? :to_str
pattern = path.to_str.gsub(/[^\?\%\\\/\:\*\w]/) { |c| encoded(c) }
pattern.gsub!(/((:\w+)|\*)/) do |match|
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
block in compile!
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
pattern, keys = compile path
conditions, @conditions = @conditions, []
[ pattern, keys, conditions, block.arity != 0 ?
proc { |a,p| unbound_method.bind(a).call(*p) } :
proc { |a,p| unbound_method.bind(a).call } ]
end
def compile(path)
keys = []
if path.respond_to? :to_str
pattern = path.to_str.gsub(/[^\?\%\\\/\:\*\w]/) { |c| encoded(c) }
pattern.gsub!(/((:\w+)|\*)/) do |match|
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
[]
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, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do |*args|
route_eval { block[*args] }
end
end
end
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
return route!(base.superclass, pass_block)
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
block (3 levels) in route!
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, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do |*args|
route_eval { block[*args] }
end
end
end
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
return route!(base.superclass, pass_block)
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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.
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
block (2 levels) in route!
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, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do |*args|
route_eval { block[*args] }
end
end
end
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
return route!(base.superclass, pass_block)
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
block in process_route
if values.any?
original, @params = params, params.merge('splat' => [], 'captures' => values)
keys.zip(values) { |k,v| Array === @params[k] ? @params[k] << v : @params[k] = v if v }
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
ensure
@params = original if original
end
# No matching route was found or all routes passed. The default
# implementation is to forward the request downstream when running
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
catch
values += match.captures.to_a.map { |v| force_encoding URI.decode(v) if v }
if values.any?
original, @params = params, params.merge('splat' => [], 'captures' => values)
keys.zip(values) { |k,v| Array === @params[k] ? @params[k] << v : @params[k] = v if v }
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
ensure
@params = original if original
end
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
process_route
values += match.captures.to_a.map { |v| force_encoding URI.decode(v) if v }
if values.any?
original, @params = params, params.merge('splat' => [], 'captures' => values)
keys.zip(values) { |k,v| Array === @params[k] ? @params[k] << v : @params[k] = v if v }
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
ensure
@params = original if original
end
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do |*args|
route_eval { block[*args] }
end
end
end
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do |*args|
route_eval { block[*args] }
end
end
end
# Run routes defined in superclass.
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do |*args|
route_eval { block[*args] }
end
end
end
# Run routes defined in superclass.
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
dispatch!
end
end
# Dispatch a request with error handling.
def dispatch!
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
rescue ::Exception => boom
handle_exception!(boom)
ensure
filter! :after unless env['sinatra.static_file']
end
# Error handling during requests.
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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 @response['Content-Type']
if Array === body and body[0].respond_to? :content_type
content_type body[0].content_type
else
content_type :html
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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 Fixnum === res or String === res
if Array === res and Fixnum === res.first
status(res.shift)
body(res.pop)
headers(*res)
elsif res.respond_to? :each
body res
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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 Fixnum === res or String === res
if Array === res and Fixnum === res.first
status(res.shift)
body(res.pop)
headers(*res)
elsif res.respond_to? :each
body res
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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 Fixnum === res or String === res
if Array === res and Fixnum === res.first
status(res.shift)
body(res.pop)
headers(*res)
elsif res.respond_to? :each
body res
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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 @response['Content-Type']
if Array === body and body[0].respond_to? :content_type
content_type body[0].content_type
else
content_type :html
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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
attr_accessor :env, :request, :response, :params
def call!(env) # :nodoc:
@env = env
@request = Request.new(env)
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call!
return mock_call!(env) if OmniAuth.config.test_mode
return options_call if on_auth_path? && options_request?
return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
return callback_call if on_callback_path?
return other_phase if respond_to?(:other_phase)
@app.call(env)
end
# Responds to an OPTIONS request.
def options_call
verbs = OmniAuth.config.allowed_request_methods.map(&:to_s).map(&:upcase).join(', ')
return [ 200, { 'Allow' => verbs }, [] ]
end
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/strategy.rb
in
call
def log(level, message)
OmniAuth.logger.send(level, "(#{name}) #{message}")
end
# Duplicates this instance and runs #call! on it.
# @param [Hash] The Rack environment.
def call(env)
dup.call!(env)
end
# The logic for dispatching any additional actions that need
# to be taken. For instance, calling the request phase if
# the request path is recognized.
#
# @param env [Hash] The Rack environment.
/usr/local/lib/ruby/gems/1.9.1/gems/omniauth-1.1.1/lib/omniauth/builder.rb
in
call
end
args.last.is_a?(Hash) ? args.push(options.merge(args.pop)) : args.push(options)
use middleware, *args, &block
end
def call(env)
to_app.call(env)
end
end
end
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/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]
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/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
/usr/local/lib/ruby/gems/1.9.1/gems/rack-protection-1.3.2/lib/rack/protection/xss_header.rb
in
call
'X-Content-Type-Options' => "nosniff"
}
headers.delete("X-Content-Type-Options") unless options[:nosniff]
headers
end
def call(env)
status, headers, body = @app.call(env)
headers = header.merge(headers) if options[:nosniff] and html?(headers)
[status, headers, body]
end
end
end
end
/usr/local/lib/ruby/gems/1.9.1/gems/rack-protection-1.3.2/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)
parts = []
unescaped = path.gsub('%2e', '.').gsub('%2f', '/')
/usr/local/lib/ruby/gems/1.9.1/gems/rack-protection-1.3.2/lib/rack/protection/json_csrf.rb
in
call
# JSON GET APIs are vulnerable to being embedded as JavaScript while the
# Array prototype has been patched to track data. Checks the referrer
# even on GET requests if the content type is JSON.
class JsonCsrf < Base
default_reaction :deny
def call(env)
status, headers, body = app.call(env)
if headers['Content-Type'].to_s.split(';', 2).first =~ /^\s*application\/json\s*$/
if origin(env).nil? and referrer(env) != Request.new(env).host
result = react(env)
warn env, "attack prevented by #{self.class}"
end
end
result or [status, headers, body]
/usr/local/lib/ruby/gems/1.9.1/gems/rack-protection-1.3.2/lib/rack/protection/base.rb
in
call
end
def call(env)
unless accepts? env
warn env, "attack prevented by #{self.class}"
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
/usr/local/lib/ruby/gems/1.9.1/gems/rack-protection-1.3.2/lib/rack/protection/base.rb
in
call
end
def call(env)
unless accepts? env
warn env, "attack prevented by #{self.class}"
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
/usr/local/lib/ruby/gems/1.9.1/gems/rack-protection-1.3.2/lib/rack/protection/xss_header.rb
in
call
'X-Content-Type-Options' => "nosniff"
}
headers.delete("X-Content-Type-Options") unless options[:nosniff]
headers
end
def call(env)
status, headers, body = @app.call(env)
headers = header.merge(headers) if options[:nosniff] and html?(headers)
[status, headers, body]
end
end
end
end
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/logger.rb
in
call
end
def call(env)
logger = ::Logger.new(env['rack.errors'])
logger.level = @level
env['rack.logger'] = logger
@app.call(env)
end
end
end
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/commonlogger.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
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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 NotFound < NameError #:nodoc:
def code ; 404 ; end
end
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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)
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/head.rb
in
call
class Head
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
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/showexceptions.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 respond_to?(:prefers_plain_text?) and prefers_plain_text?(env)
content_type = "text/plain"
body = [dump_exception(e)]
else
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/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
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
block in call
setup_default_middleware builder
setup_middleware builder
builder.run new!(*args, &bk)
builder
end
def call(env)
synchronize { prototype.call(env) }
end
private
def setup_default_middleware(builder)
builder.use ExtendedRack
builder.use ShowExceptions if show_exceptions?
builder.use Rack::MethodOverride if method_override?
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
synchronize
end
@@mutex = Mutex.new
def synchronize(&block)
if lock?
@@mutex.synchronize(&block)
else
yield
end
end
public
CALLERS_TO_IGNORE = [ # :nodoc:
/\/sinatra(\/(base|main|showexceptions))?\.rb$/, # all sinatra code
/lib\/tilt.*\.rb$/, # all tilt code
/usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb
in
call
setup_default_middleware builder
setup_middleware builder
builder.run new!(*args, &bk)
builder
end
def call(env)
synchronize { prototype.call(env) }
end
private
def setup_default_middleware(builder)
builder.use ExtendedRack
builder.use ShowExceptions if show_exceptions?
builder.use Rack::MethodOverride if method_override?
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/builder.rb
in
call
def to_app
app = @map ? generate_map(@run, @map) : @run
fail "missing run or map statement" unless app
@use.reverse.inject(app) { |a,e| e[a] }
end
def call(env)
to_app.call(env)
end
private
def generate_map(default_app, mapping)
mapped = default_app ? {'/' => default_app} : {}
mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b) }
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/urlmap.rb
in
block in call
rest = m[1]
next unless !rest || rest.empty? || rest[0] == ?/
env['SCRIPT_NAME'] = (script_name + location)
env['PATH_INFO'] = rest
return app.call(env)
end
[404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found: #{path}"]]
ensure
env['PATH_INFO'] = path
env['SCRIPT_NAME'] = script_name
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/urlmap.rb
in
each
def call(env)
path = env["PATH_INFO"]
script_name = env['SCRIPT_NAME']
hHost = env['HTTP_HOST']
sName = env['SERVER_NAME']
sPort = env['SERVER_PORT']
@mapping.each do |host, location, match, app|
unless hHost == host \
|| sName == host \
|| (!host && (hHost == sName || hHost == sName+':'+sPort))
next
end
next unless m = match.match(path.to_s)
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/urlmap.rb
in
call
def call(env)
path = env["PATH_INFO"]
script_name = env['SCRIPT_NAME']
hHost = env['HTTP_HOST']
sName = env['SERVER_NAME']
sPort = env['SERVER_PORT']
@mapping.each do |host, location, match, app|
unless hHost == host \
|| sName == host \
|| (!host && (hHost == sName || hHost == sName+':'+sPort))
next
end
next unless m = match.match(path.to_s)
/usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.38/lib/phusion_passenger/rack/thread_handler_extension.rb
in
process_request
env[RACK_HIJACK_IO] ||= begin
connection.stop_simulating_eof!
connection
end
end
begin
status, headers, body = @app.call(env)
rescue => e
if should_reraise_app_error?(e, socket_wrapper)
raise e
elsif !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.
/usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.38/lib/phusion_passenger/request_handler/thread_handler.rb
in
accept_and_process_next_request
prepare_request(connection, headers)
begin
if headers[REQUEST_METHOD] == PING
process_ping(headers, connection)
elsif headers[REQUEST_METHOD] == OOBW
process_oobw(headers, connection)
else
process_request(headers, connection, socket_wrapper, @protocol == :http)
end
rescue Exception
has_error = true
raise
ensure
if headers[RACK_HIJACK_IO]
socket_wrapper = nil
/usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.38/lib/phusion_passenger/request_handler/thread_handler.rb
in
main_loop
channel = MessageChannel.new
buffer = ''
buffer.force_encoding('binary') if buffer.respond_to?(:force_encoding)
begin
finish_callback.call
while true
hijacked = accept_and_process_next_request(socket_wrapper, channel, buffer)
socket_wrapper = Utils::UnseekableSocket.new if hijacked
end
rescue Interrupted
# Do nothing.
end
debug("Thread handler main loop exited normally")
ensure
/usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.38/lib/phusion_passenger/request_handler.rb
in
block (3 levels) in start_threads
@concurrency.times do |i|
thread = Thread.new(i) do |number|
Thread.current.abort_on_exception = true
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
Variable | Value |
---|---|
me | "http://waterpigs.co.uk" |
profile | "https://github.com/barnabywalters" |
redirect_uri | "" |
No POST data.
Variable | Value |
---|---|
DOCUMENT_ROOT | /web/sites/indieauth.com/public |
HTTPS | on |
HTTP_ACCEPT | text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 |
HTTP_ACCEPT_ENCODING | gzip, deflate |
HTTP_ACCEPT_LANGUAGE | en-US,en;q=0.5 |
HTTP_CONNECTION | keep-alive |
HTTP_COOKIE | __utma=119821008.470280486.1350149500.1402264139.1402267487.44; indieauth.com=BAh7CUkiD3Nlc3Npb25faWQGOgZFRiJFNjZkZDQzYWNjM2EwZGFiNGIyOTAw%0ANDg2MDQwYzE0YTZlYzg1YzY5OTA2MWNlODkxMThmZjUzOTBmOTNiNzE5Nkki%0AEmF0dGVtcHRlZF91cmkGOwBGSSIbaHR0cDovL3dhdGVycGlncy5jby51awY7%0AAFRJIhJyZXNwb25zZV90eXBlBjsARkkiCnRva2VuBjsARkkiCm9hdXRoBjsA%0ARnsGSSIMdHdpdHRlcgY7AEZ7BkkiF2NhbGxiYWNrX2NvbmZpcm1lZAY7AEZU%0A--dcc88310688812c0bc01f66e7b05797a2222daf5; __utmz=119821008.1402267487.44.11.utmcsr=localhost:9005|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmc=119821008; __utmb=119821008.1.10.1402267487 |
HTTP_HOST | indieauth.com |
HTTP_REFERER | https://indieauth.com/auth?me=http://waterpigs.co.uk&redirect_url=/ |
HTTP_USER_AGENT | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0 |
PASSENGER_APP_TYPE | rack |
PASSENGER_CONNECT_PASSWORD | oEjoxtu1ZqZ3rHaL3UMaAdf2EJirdtTu6P6rRmnKWLq |
PATH_INFO | /auth/start |
QUERY_STRING | me=http%3A%2F%2Fwaterpigs.co.uk&profile=https%3A%2F%2Fgithub.com%2Fbarnabywalters&redirect_uri= |
REMOTE_ADDR | 89.17.128.127 |
REMOTE_PORT | 35313 |
REQUEST_METHOD | GET |
REQUEST_URI | /auth/start?me=http%3A%2F%2Fwaterpigs.co.uk&profile=https%3A%2F%2Fgithub.com%2Fbarnabywalters&redirect_uri= |
SCGI | 1 |
SCRIPT_NAME | |
SERVER_ADDR | 173.230.155.197 |
SERVER_NAME | indieauth.com |
SERVER_PORT | 443 |
SERVER_PROTOCOL | HTTP/1.1 |
SERVER_SOFTWARE | nginx/1.4.6 |
rack.errors | #<Object:0x00000000b44470> |
rack.hijack | #<Proc:0x0000000301d1e8@/usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.38/lib/phusion_passenger/rack/thread_handler_extension.rb:69 (lambda)> |
rack.hijack? | true |
rack.input | #<PhusionPassenger::Utils::TeeInput:0x0000000301d6e8 @len=nil, @socket=#<PhusionPassenger::Utils::UnseekableSocket:0x0000000126a128 @socket=#<UNIXSocket:fd 9>, @simulate_eof=true>, @tmp=#<PhusionPassenger::Utils::TmpIO:/tmp/PassengerTeeInput-1yknmp7>> |
rack.logger | #<Logger:0x0000000301ce00 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x0000000301cdd8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x0000000301cd88 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x0000000301cd60 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x0000000301cd10>>>> |
rack.multiprocess | true |
rack.multithread | false |
rack.request.cookie_hash | {"__utma"=>"119821008.470280486.1350149500.1402264139.1402267487.44", "indieauth.com"=>"BAh7CUkiD3Nlc3Npb25faWQGOgZFRiJFNjZkZDQzYWNjM2EwZGFiNGIyOTAw\nNDg2MDQwYzE0YTZlYzg1YzY5OTA2MWNlODkxMThmZjUzOTBmOTNiNzE5Nkki\nEmF0dGVtcHRlZF91cmkGOwBGSSIbaHR0cDovL3dhdGVycGlncy5jby51awY7\nAFRJIhJyZXNwb25zZV90eXBlBjsARkkiCnRva2VuBjsARkkiCm9hdXRoBjsA\nRnsGSSIMdHdpdHRlcgY7AEZ7BkkiF2NhbGxiYWNrX2NvbmZpcm1lZAY7AEZU\n--dcc88310688812c0bc01f66e7b05797a2222daf5", "__utmz"=>"119821008.1402267487.44.11.utmcsr=localhost:9005|utmccn=(referral)|utmcmd=referral|utmcct=/", "__utmc"=>"119821008", "__utmb"=>"119821008.1.10.1402267487"} |
rack.request.cookie_string | __utma=119821008.470280486.1350149500.1402264139.1402267487.44; indieauth.com=BAh7CUkiD3Nlc3Npb25faWQGOgZFRiJFNjZkZDQzYWNjM2EwZGFiNGIyOTAw%0ANDg2MDQwYzE0YTZlYzg1YzY5OTA2MWNlODkxMThmZjUzOTBmOTNiNzE5Nkki%0AEmF0dGVtcHRlZF91cmkGOwBGSSIbaHR0cDovL3dhdGVycGlncy5jby51awY7%0AAFRJIhJyZXNwb25zZV90eXBlBjsARkkiCnRva2VuBjsARkkiCm9hdXRoBjsA%0ARnsGSSIMdHdpdHRlcgY7AEZ7BkkiF2NhbGxiYWNrX2NvbmZpcm1lZAY7AEZU%0A--dcc88310688812c0bc01f66e7b05797a2222daf5; __utmz=119821008.1402267487.44.11.utmcsr=localhost:9005|utmccn=(referral)|utmcmd=referral|utmcct=/; __utmc=119821008; __utmb=119821008.1.10.1402267487 |
rack.request.query_hash | {"me"=>"http://waterpigs.co.uk", "profile"=>"https://github.com/barnabywalters", "redirect_uri"=>""} |
rack.request.query_string | me=http%3A%2F%2Fwaterpigs.co.uk&profile=https%3A%2F%2Fgithub.com%2Fbarnabywalters&redirect_uri= |
rack.run_once | false |
rack.session | #<Rack::Session::Abstract::SessionHash:0x180e318 not yet loaded> |
rack.session.options | {:path=>"/", :domain=>nil, :expire_after=>2592000, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :sidbits=>128, :secure_random=>SecureRandom, :secret=>"t*27hH.W&9)m__w", :coder=>#<Rack::Session::Cookie::Base64::Marshal:0x000000021dc020>} |
rack.url_scheme | https |
rack.version | [1, 2] |
sinatra.commonlogger | true |
sinatra.error | #<Net::HTTP::Persistent::Error: too many connection resets (due to end of file reached - EOFError) after 0 requests on 21421960, last used 1402268520.788479 seconds ago> |
You're seeing this error because you have
enabled the show_exceptions
setting.