response.rb
assert_ok
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/response.rb
in
assert_ok
def [](key)
@payload[key]
end
private
def assert_ok
e = error
raise e if e
return unless @code.nil? || @code >= 400
raise Error::ServerError, self
end
def add_backtrace(ex)
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/response.rb
in
initialize
attr_reader :code, :payload
attr_writer :payload
def initialize(code, payload = nil)
@code = code
@payload = payload || {}
assert_ok
end
def error
klass = Error.for_code(status) || return
ex = klass.new(error_message)
ex.set_backtrace(caller)
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/http/common.rb
in
new
body = body.to_s.strip
content_type = content_type.to_s
WebDriver.logger.info("<- #{body}")
if content_type.include? CONTENT_TYPE
raise Error::WebDriverError, "empty body: #{content_type.inspect} (#{code})\n#{body}" if body.empty?
Response.new(code, JSON.parse(body))
elsif code == 204
Response.new(code)
else
msg = if body.empty?
"unexpected response, code=#{code}, content-type=#{content_type.inspect}"
else
"unexpected response, code=#{code}, content-type=#{content_type.inspect}\n#{body}"
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/http/common.rb
in
create_response
body = body.to_s.strip
content_type = content_type.to_s
WebDriver.logger.info("<- #{body}")
if content_type.include? CONTENT_TYPE
raise Error::WebDriverError, "empty body: #{content_type.inspect} (#{code})\n#{body}" if body.empty?
Response.new(code, JSON.parse(body))
elsif code == 204
Response.new(code)
else
msg = if body.empty?
"unexpected response, code=#{code}, content-type=#{content_type.inspect}"
else
"unexpected response, code=#{code}, content-type=#{content_type.inspect}\n#{body}"
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/http/default.rb
in
request
end
if response.is_a? Net::HTTPRedirection
raise Error::WebDriverError, 'too many redirects' if redirects >= MAX_REDIRECTS
request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
else
create_response response.code, response.body, response.content_type
end
end
def new_request_for(verb, url, headers, payload)
req = Net::HTTP.const_get(verb.to_s.capitalize).new(url.path, headers)
req.basic_auth server_url.user, server_url.password if server_url.userinfo
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/http/common.rb
in
call
WebDriver.logger.info(" >>> #{url} | #{payload}")
WebDriver.logger.debug(" > #{headers.inspect}")
elsif verb == :post
payload = '{}'
headers['Content-Length'] = '2'
end
request verb, url, headers, payload
end
private
def server_url
return @server_url if @server_url
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/bridge.rb
in
execute
begin
opts.each { |key, value| path[key.inspect] = escaper.escape(value.to_s) }
rescue IndexError
raise ArgumentError, "#{opts.inspect} invalid for #{command.inspect}"
end
WebDriver.logger.info("-> #{verb.to_s.upcase} #{path}")
http.call(verb, path, command_hash)
end
def escaper
@escaper ||= defined?(URI::Parser) ? URI::DEFAULT_PARSER : URI
end
def commands(command)
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/w3c/bridge.rb
in
execute
ids.map { |id| Element.new self, element_id_from(id) }
end
private
def execute(*)
super['value']
end
def convert_locators(how, what)
case how
when 'class name'
how = 'css selector'
what = ".#{escape_css(what)}"
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/remote/w3c/bridge.rb
in
get
end
def status
execute :status
end
def get(url)
execute :get, {}, {url: url}
end
def implicit_wait_timeout=(milliseconds)
timeout('implicit', milliseconds)
end
def script_timeout=(milliseconds)
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/common/navigation.rb
in
to
end
#
# Navigate to the given URL
#
def to(url)
@bridge.get url
end
#
# Move back a single entry in the browser's history.
#
def back
/usr/local/bundle/gems/selenium-webdriver-3.141.5926/lib/selenium/webdriver/common/driver.rb
in
get
end
#
# Opens the specified URL in the browser.
#
def get(url)
navigate.to(url)
end
#
# Get the URL of the current page
#
# @return [String]
#
/app/selenium_http_client.rb
in
block in get
STDERR.puts(message)
end
end
def get(url)
@mutex.synchronize do
begin
@selenium.get(url)
decode_page_source
rescue Selenium::WebDriver::Error::WebDriverError, Net::ReadTimeout, Selenium::WebDriver::Error::TimeOutError, Selenium::WebDriver::Error::TimeoutError
error "Caught error #{$!.class}: #{$!}, retrying\n#{$!.backtrace.join("\n")}"
tries ||= 0
close
connect_selenium
if $!.message =~ /unknown error/
/app/selenium_http_client.rb
in
synchronize
Rails.logger.error message
else
STDERR.puts(message)
end
end
def get(url)
@mutex.synchronize do
begin
@selenium.get(url)
decode_page_source
rescue Selenium::WebDriver::Error::WebDriverError, Net::ReadTimeout, Selenium::WebDriver::Error::TimeOutError, Selenium::WebDriver::Error::TimeoutError
error "Caught error #{$!.class}: #{$!}, retrying\n#{$!.backtrace.join("\n")}"
tries ||= 0
close
/app/selenium_http_client.rb
in
get
Rails.logger.error message
else
STDERR.puts(message)
end
end
def get(url)
@mutex.synchronize do
begin
@selenium.get(url)
decode_page_source
rescue Selenium::WebDriver::Error::WebDriverError, Net::ReadTimeout, Selenium::WebDriver::Error::TimeOutError, Selenium::WebDriver::Error::TimeoutError
error "Caught error #{$!.class}: #{$!}, retrying\n#{$!.backtrace.join("\n")}"
tries ||= 0
close
/app/selenium_http_client.rb
in
get
end
end
end
end
end
def self.get(*args)
instance.get(*args)
end
def self.open_uri(url)
body = get(url)
return yield(StringIO.new(body)) if block_given?
app.rb
in
block (2 levels) in <main>
end
get '/get' do
url = params[:url]
start_time = Time.now
mutex.synchronize do
log "Getting #{url}"
result = SeleniumHttpClient.get(url)
log "Got #{result.length} bytes in #{(Time.now - start_time).round(2)} s"
result
end
end
def log(message)
app.rb
in
synchronize
get '/' do
'OK'
end
get '/get' do
url = params[:url]
start_time = Time.now
mutex.synchronize do
log "Getting #{url}"
result = SeleniumHttpClient.get(url)
log "Got #{result.length} bytes in #{(Time.now - start_time).round(2)} s"
result
end
end
app.rb
in
block in <main>
get '/' do
'OK'
end
get '/get' do
url = params[:url]
start_time = Time.now
mutex.synchronize do
log "Getting #{url}"
result = SeleniumHttpClient.get(url)
log "Got #{result.length} bytes in #{(Time.now - start_time).round(2)} s"
result
end
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
call
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions, @conditions = @conditions, []
wrapper = block.arity != 0 ?
proc { |a, p| unbound_method.bind(a).call(*p) } :
proc { |a, p| unbound_method.bind(a).call }
[ pattern, conditions, wrapper ]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in compile!
pattern = compile(path, route_mustermann_opts)
method_name = "#{verb} #{path}"
unbound_method = generate_method(method_name, &block)
conditions, @conditions = @conditions, []
wrapper = block.arity != 0 ?
proc { |a, p| unbound_method.bind(a).call(*p) } :
proc { |a, p| unbound_method.bind(a).call }
[ pattern, conditions, wrapper ]
end
def compile(path, route_mustermann_opts = {})
Mustermann.new(path, **mustermann_opts.merge(route_mustermann_opts))
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block (3 levels) in route!
def route!(base = settings, pass_block = nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
route_eval
route_eval(&pass_block) if pass_block
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval
throw :halt, yield
end
# If the current request matches pattern and conditions, fill params
# with keys and call the given block.
# Revert params afterwards.
#
# Returns pass block.
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block (2 levels) in route!
def route!(base = settings, pass_block = nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in process_route
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue
@env['sinatra.error.params'] = @params
raise
ensure
params ||= {}
params.each { |k, _| @params.delete(k) } unless @env['sinatra.error.params']
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
catch
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue
@env['sinatra.error.params'] = @params
raise
ensure
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
process_route
captures = pattern.match(route).captures.map { |c| URI_INSTANCE.unescape(c) if c }
values += captures
@params[:captures] = force_encoding(captures) unless captures.nil? || captures.empty?
else
values += params.values.flatten
end
catch(:pass) do
conditions.each { |c| throw :pass if c.bind(self).call == false }
block ? block[self, values] : yield(self, values)
end
rescue
@env['sinatra.error.params'] = @params
raise
ensure
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in route!
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
# don't wipe out pass_block in superclass
pass_block = returned_pass_block if returned_pass_block
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
each
block.call(result) if block_given?
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
route!
block.call(result) if block_given?
end
end
# Run routes defined on the class and all superclasses.
def route!(base = settings, pass_block = nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, conditions, block|
response.delete_header('Content-Type') unless @pinned_response
returned_pass_block = process_route(pattern, conditions) do |*args|
env['sinatra.route'] = "#{@request.request_method} #{pattern}"
route_eval { block[*args] }
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in dispatch!
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before do
@pinned_response = !response['Content-Type'].nil?
end
route!
end
rescue ::Exception => boom
invoke { handle_exception!(boom) }
ensure
begin
filter! :after unless env['sinatra.static_file']
rescue ::Exception => boom
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(:disposition => nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
catch
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(:disposition => nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(:disposition => nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
dispatch!
# Avoid passing frozen string in force_encoding
@params.merge!(@request.params).each do |key, val|
next unless val.respond_to?(:force_encoding)
val = val.dup if val.frozen?
@params[key] = force_encoding(val)
end
invoke do
static! if settings.static? && (request.get? || request.head?)
filter! :before do
@pinned_response = !response['Content-Type'].nil?
end
route!
end
rescue ::Exception => boom
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
@pinned_response = nil
template_cache.clear if settings.reload_templates
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body && body[0].respond_to?(:content_type)
content_type body[0].content_type
elsif default = settings.default_content_type
content_type default
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(:disposition => nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
catch
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(:disposition => nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
invoke
env['sinatra.static_file'] = path
cache_control(*settings.static_cache_control) if settings.static_cache_control?
send_file path, options.merge(:disposition => nil)
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
res = [res] if Integer === res or String === res
if Array === res and Integer === res.first
res = res.dup
status(res.shift)
body(res.pop)
headers(*res)
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
call!
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
@pinned_response = nil
template_cache.clear if settings.reload_templates
invoke { dispatch! }
invoke { error_block!(response.status) } unless @env['sinatra.error']
unless @response['Content-Type']
if Array === body && body[0].respond_to?(:content_type)
content_type body[0].content_type
elsif default = settings.default_content_type
content_type default
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
call
@template_cache = Tilt::Cache.new
@pinned_response = nil # whether a before! filter pinned the content-type
yield self if block_given?
end
# Rack call interface.
def call(env)
dup.call!(env)
end
def call!(env) # :nodoc:
@env = env
@params = IndifferentHash.new
@request = Request.new(env)
@response = Response.new
/usr/local/bundle/gems/rack-protection-2.2.2/lib/rack/protection/xss_header.rb
in
call
#
# Options:
# xss_mode:: How the browser should prevent the attack (default: :block)
class XSSHeader < Base
default_options :xss_mode => :block, :nosniff => true
def call(env)
status, headers, body = @app.call(env)
headers['X-XSS-Protection'] ||= "1; mode=#{options[:xss_mode]}" if html? headers
headers['X-Content-Type-Options'] ||= 'nosniff' if options[:nosniff]
[status, headers, body]
end
end
end
end
/usr/local/bundle/gems/rack-protection-2.2.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)
encoding = path.encoding
dot = '.'.encode(encoding)
/usr/local/bundle/gems/rack-protection-2.2.2/lib/rack/protection/json_csrf.rb
in
call
class JsonCsrf < Base
default_options :allow_if => nil
alias react deny
def call(env)
request = Request.new(env)
status, headers, body = app.call(env)
if has_vector?(request, headers)
warn env, "attack prevented by #{self.class}"
react_and_close(env, body) or [status, headers, body]
else
[status, headers, body]
/usr/local/bundle/gems/rack-protection-2.2.2/lib/rack/protection/base.rb
in
call
end
def call(env)
unless accepts? env
instrument env
result = react env
end
result or app.call(env)
end
def react(env)
result = send(options[:reaction], env)
result if Array === result and result.size == 3
end
/usr/local/bundle/gems/rack-protection-2.2.2/lib/rack/protection/base.rb
in
call
end
def call(env)
unless accepts? env
instrument env
result = react env
end
result or app.call(env)
end
def react(env)
result = send(options[:reaction], env)
result if Array === result and result.size == 3
end
/usr/local/bundle/gems/rack-protection-2.2.2/lib/rack/protection/frame_options.rb
in
call
frame_options = options[:frame_options]
frame_options = options[:frame_options].to_s.upcase unless frame_options.respond_to? :to_str
frame_options.to_str
end
end
def call(env)
status, headers, body = @app.call(env)
headers['X-Frame-Options'] ||= frame_options if html? headers
[status, headers, body]
end
end
end
end
/usr/local/bundle/gems/rack-2.2.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/bundle/gems/rack-2.2.4/lib/rack/common_logger.rb
in
call
# will not be logged, so if exception handling middleware are used,
# they should be loaded after this middleware. Additionally, because
# the logging happens after the request body has been fully sent, any
# exceptions raised during the sending of the response body will
# cause the request not to be logged.
def call(env)
began_at = Utils.clock_time
status, headers, body = @app.call(env)
headers = Utils::HeaderHash[headers]
body = BodyProxy.new(body) { log(env, status, headers, began_at) }
[status, headers, body]
end
private
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
call
env['sinatra.commonlogger'] ? @app.call(env) : super
end
superclass.class_eval do
alias call_without_check call unless method_defined? :call_without_check
def call(env)
env['sinatra.commonlogger'] = true
call_without_check(env)
end
end
end
class BadRequest < TypeError #:nodoc:
def http_status; 400 end
end
/usr/local/bundle/gems/sinatra-2.2.2/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/bundle/gems/rack-2.2.4/lib/rack/head.rb
in
call
# all other requests unchanged.
class Head
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
if env[REQUEST_METHOD] == HEAD
[
status, headers, Rack::BodyProxy.new([]) do
body.close if body.respond_to? :close
end
]
/usr/local/bundle/gems/rack-2.2.4/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
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/show_exceptions.rb
in
call
def @@eats_errors.puts(*) end
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
rescue Exception => e
errors, env["rack.errors"] = env["rack.errors"], @@eats_errors
if prefers_plain_text?(env)
content_type = "text/plain"
body = dump_exception(e)
else
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
call
# Some Rack handlers (Rainbows!) implement an extended body object protocol, however,
# some middleware (namely Rack::Lint) will break it by not mirroring the methods in question.
# This middleware will detect an extended body object and will make sure it reaches the
# handler directly. We do this here, so our middleware and middleware set up by the app will
# still be able to run.
class ExtendedRack < Struct.new(:app)
def call(env)
result, callback = app.call(env), env['async.callback']
return result unless callback and async?(*result)
after_response { callback.call result }
setup_close(env, *result)
throw :async
end
private
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
call
end
def helpers
@instance
end
def call(env)
@stack.call(env)
end
def inspect
"#<#{@instance.class} app_file=#{settings.app_file.inspect}>"
end
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
block in call
setup_default_middleware builder
setup_middleware builder
builder.run app
builder
end
def call(env)
synchronize { prototype.call(env) }
end
# Like Kernel#caller but excluding certain magic entries and without
# line / method information; the resulting array contains filenames only.
def caller_files
cleaned_caller(1).flatten
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
synchronize
end
@@mutex = Mutex.new
def synchronize(&block)
if lock?
@@mutex.synchronize(&block)
else
yield
end
end
# used for deprecation warnings
def warn(message)
super message + "\n\tfrom #{cleaned_caller.first.join(':')}"
end
/usr/local/bundle/gems/sinatra-2.2.2/lib/sinatra/base.rb
in
call
setup_default_middleware builder
setup_middleware builder
builder.run app
builder
end
def call(env)
synchronize { prototype.call(env) }
end
# Like Kernel#caller but excluding certain magic entries and without
# line / method information; the resulting array contains filenames only.
def caller_files
cleaned_caller(1).flatten
end
/usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb
in
block in pre_process
# When we're under a non-async framework like rails, we can still spawn
# off async responses using the callback info, so there's little point
# in removing this.
response = AsyncResponse
catch(:async) do
# Process the request calling the Rack adapter
response = @app.call(@request.env)
end
response
rescue Exception => e
unexpected_error(e)
# Pass through error response
can_persist? && @request.persistent? ? Response::PERSISTENT_ERROR : Response::ERROR
end
/usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb
in
catch
end
end
# When we're under a non-async framework like rails, we can still spawn
# off async responses using the callback info, so there's little point
# in removing this.
response = AsyncResponse
catch(:async) do
# Process the request calling the Rack adapter
response = @app.call(@request.env)
end
response
rescue Exception => e
unexpected_error(e)
# Pass through error response
/usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb
in
pre_process
end
end
# When we're under a non-async framework like rails, we can still spawn
# off async responses using the callback info, so there's little point
# in removing this.
response = AsyncResponse
catch(:async) do
# Process the request calling the Rack adapter
response = @app.call(@request.env)
end
response
rescue Exception => e
unexpected_error(e)
# Pass through error response
/usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb
in
block in process
end
# Called when all data was received and the request
# is ready to be processed.
def process
if threaded?
@request.threaded = true
EventMachine.defer { post_process(pre_process) }
else
@request.threaded = false
post_process(pre_process)
end
end
def ssl_verify_peer(cert)
/usr/local/bundle/gems/eventmachine-1.2.7/lib/eventmachine.rb
in
block in spawn_threadpool
begin
op, cback, eback = *@threadqueue.pop
rescue ThreadError
$stderr.puts $!.message
break # Ruby 2.0 may fail at Queue.pop
end
begin
result = op.call
@resultqueue << [result, cback]
rescue Exception => error
raise error unless eback
@resultqueue << [error, eback]
end
signal_loopbreak
end
Variable | Value |
---|---|
url | "" |
No POST data.
Variable | Value |
---|---|
GATEWAY_INTERFACE | CGI/1.2 |
HTTP_ACCEPT | */* |
HTTP_ACCEPT_ENCODING | gzip;q=1.0,deflate;q=0.6,identity;q=0.3 |
HTTP_HOST | chrome-get.intra.equisolve.com:8443 |
HTTP_USER_AGENT | Ruby |
HTTP_VERSION | HTTP/1.1 |
HTTP_X_AMZN_TRACE_ID | Root=1-62f5671f-1039f74f6661623577a2f12f |
HTTP_X_FORWARDED_FOR | 54.234.185.177 |
HTTP_X_FORWARDED_PORT | 8443 |
HTTP_X_FORWARDED_PROTO | https |
PATH_INFO | /get |
QUERY_STRING | url= |
REMOTE_ADDR | 192.168.149.33 |
REQUEST_METHOD | GET |
REQUEST_PATH | /get |
REQUEST_URI | /get?url= |
SCRIPT_NAME | |
SERVER_NAME | chrome-get.intra.equisolve.com |
SERVER_PORT | 8443 |
SERVER_PROTOCOL | HTTP/1.1 |
SERVER_SOFTWARE | thin 1.8.1 codename Infinite Smoothie |
async.callback | #<Method: #<Thin::Connection:0x00007f407c106b48 @signature=156863, @request=#<Thin::Request:0x000055dc31c8cfb8 @parser=#<Thin::HttpParser:0x000055dc31c8c950>, @data=nil, @nparsed=301, @body=#<StringIO:0x000055dc31c87f68>, @env={"SERVER_SOFTWARE"=>"thin 1.8.1 codename Infinite Smoothie", "SERVER_NAME"=>"chrome-get.intra.equisolve.com", "rack.input"=>#<StringIO:0x000055dc31c87f68>, "rack.version"=>[1, 0], "rack.errors"=>#<Object:0x000055dc31fa8508>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/get", "PATH_INFO"=>"/get", "QUERY_STRING"=>"url=", "REQUEST_URI"=>"/get?url=", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_X_FORWARDED_FOR"=>"54.234.185.177", "HTTP_X_FORWARDED_PROTO"=>"https", "HTTP_X_FORWARDED_PORT"=>"8443", "HTTP_HOST"=>"chrome-get.intra.equisolve.com:8443", "HTTP_X_AMZN_TRACE_ID"=>"Root=1-62f5671f-1039f74f6661623577a2f12f", "HTTP_ACCEPT_ENCODING"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "HTTP_ACCEPT"=>"*/*", "HTTP_USER_AGENT"=>"Ruby", "GATEWAY_INTERFACE"=>"CGI/1.2", "SERVER_PORT"=>"8443", "SERVER_PROTOCOL"=>"HTTP/1.1", "rack.url_scheme"=>"http", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"192.168.149.33", "async.callback"=>#<Method: #<Thin::Connection:0x00007f407c106b48 ...>.post_process(result) /usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb:95>, "async.close"=>#<EventMachine::DefaultDeferrable:0x000055dc327e4e88>, "sinatra.commonlogger"=>true, "rack.logger"=>#<Logger:0x000055dc327e4e60 @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x000055dc327e4e38 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x000055dc327e4de8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x000055dc327e4dc0>, @mon_data_owner_object_id=5616900>>, "rack.request.query_string"=>"url=", "rack.request.query_hash"=>{"url"=>""}, "sinatra.route"=>"GET /get", "sinatra.error.params"=>{"url"=>""}, "sinatra.error"=>#<Selenium::WebDriver::Error::InvalidArgumentError: invalid argument
(Session info: chrome=103.0.5060.66)>, "sinatra.accept"=>[#<Sinatra::Request::AcceptEntry:0x00007f40940bf4d8 @entry="*/*", @type="*/*", @params={}, @q=1.0>], "rack.request.cookie_hash"=>{}}>, @response=#<Thin::Response:0x000055dc31c87d60 @headers=#<Thin::Headers:0x000055dc31c87bf8 @sent={}, @out=[]>, @status=200, @persistent=false, @skip_body=false>, @backend=#<Thin::Backends::TcpServer:0x000055dc326b34b0 @host="0.0.0.0", @port=3000, @connections={5609700=>#<Thin::Connection:0x00007f407c086dd0 @signature=156814, @request=#<Thin::Request:0x000055dc327e5568 @parser=#<Thin::HttpParser:0x000055dc327e5540>, @data="", @nparsed=0, @body=#<StringIO:0x000055dc327e54c8>, @env={"SERVER_SOFTWARE"=>"thin 1.8.1 codename Infinite Smoothie", "SERVER_NAME"=>"localhost", "rack.input"=>#<StringIO:0x000055dc327e54c8>, "rack.version"=>[1, 0], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false}>, @response=#<Thin::Response:0x000055dc327e5478 @headers=#<Thin::Headers:0x000055dc327e5450 @sent={}, @out=[]>, @status=200, @persistent=false, @skip_body=false>, @backend=#<Thin::Backends::TcpServer:0x000055dc326b34b0 ...>, @app=Sinatra::Application, @threaded=true, @can_persist=true, @idle=true>, 5610620=>#<Thin::Connection:0x00007f407000b9c0 @signature=156845, @request=#<Thin::Request:0x00007f40686b08a0 @parser=#<Thin::HttpParser:0x00007f40686b0878>, @data="", @nparsed=0, @body=#<StringIO:0x00007f40686b0800>, @env={"SERVER_SOFTWARE"=>"thin 1.8.1 codename Infinite Smoothie", "SERVER_NAME"=>"localhost", "rack.input"=>#<StringIO:0x00007f40686b0800>, "rack.version"=>[1, 0], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false}>, @response=#<Thin::Response:0x00007f40686b07b0 @headers=#<Thin::Headers:0x00007f40686b0788 @sent={}, @out=[]>, @status=200, @persistent=false, @skip_body=false>, @backend=#<Thin::Backends::TcpServer:0x000055dc326b34b0 ...>, @app=Sinatra::Application, @threaded=true, @can_persist=true, @idle=true>, 5611100=>#<Thin::Connection:0x00007f407c106b48 ...>, 5611820=>#<Thin::Connection:0x000055dc32335860 @signature=156885, @request=#<Thin::Request:0x00007f407c192490 @parser=#<Thin::HttpParser:0x00007f407c192468>, @data=nil, @nparsed=474, @body=#<StringIO:0x00007f407c1923f0>, @env={"SERVER_SOFTWARE"=>"thin 1.8.1 codename Infinite Smoothie", "SERVER_NAME"=>"chrome-get.intra.equisolve.com", "rack.input"=>#<StringIO:0x00007f407c1923f0>, "rack.version"=>[1, 0], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/get", "PATH_INFO"=>"/get", "QUERY_STRING"=>"url=https%3A%2F%2Fwww.sec.gov%2Fcgi-bin%2Fbrowse-edgar%3Faction%3Dgetcurrent%26CIK%3D%26type%3D%26company%3D%26dateb%3D%26owner%3Dinclude%26start%3D0%26count%3D100%26output%3Datom", "REQUEST_URI"=>"/get?url=https%3A%2F%2Fwww.sec.gov%2Fcgi-bin%2Fbrowse-edgar%3Faction%3Dgetcurrent%26CIK%3D%26type%3D%26company%3D%26dateb%3D%26owner%3Dinclude%26start%3D0%26count%3D100%26output%3Datom", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_X_FORWARDED_FOR"=>"54.152.40.57", "HTTP_X_FORWARDED_PROTO"=>"https", "HTTP_X_FORWARDED_PORT"=>"8443", "HTTP_HOST"=>"chrome-get.intra.equisolve.com:8443", "HTTP_X_AMZN_TRACE_ID"=>"Root=1-62f56723-5242bac674d542b17ac6c6c1", "HTTP_ACCEPT_ENCODING"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "HTTP_ACCEPT"=>"*/*", "HTTP_USER_AGENT"=>"Ruby", "GATEWAY_INTERFACE"=>"CGI/1.2", "SERVER_PORT"=>"8443", "SERVER_PROTOCOL"=>"HTTP/1.1", "rack.url_scheme"=>"http", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"192.168.128.5", "async.callback"=>#<Method: #<Thin::Connection:0x000055dc32335860 ...>.post_process(result) /usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb:95>, "async.close"=>#<EventMachine::DefaultDeferrable:0x00007f40700e9518>, "sinatra.commonlogger"=>true, "rack.logger"=>#<Logger:0x00007f40700e94f0 @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f40700e94c8 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f40700e9478 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f40700e9450>, @mon_data_owner_object_id=5616920>>, "rack.request.query_string"=>"url=https%3A%2F%2Fwww.sec.gov%2Fcgi-bin%2Fbrowse-edgar%3Faction%3Dgetcurrent%26CIK%3D%26type%3D%26company%3D%26dateb%3D%26owner%3Dinclude%26start%3D0%26count%3D100%26output%3Datom", "rack.request.query_hash"=>{"url"=>"https://www.sec.gov/cgi-bin/browse-edgar?action=getcurrent&CIK=&type=&company=&dateb=&owner=include&start=0&count=100&output=atom"}, "sinatra.route"=>"GET /get"}>, @response=#<Thin::Response:0x00007f407c1923a0 @headers=#<Thin::Headers:0x00007f407c192378 @sent={}, @out=[]>, @status=200, @persistent=false, @skip_body=false>, @backend=#<Thin::Backends::TcpServer:0x000055dc326b34b0 ...>, @app=Sinatra::Application, @threaded=true, @can_persist=true, @idle=false>, 5613820=>#<Thin::Connection:0x000055dc32212b68 @signature=156938, @request=#<Thin::Request:0x00007f4068579b30 @parser=#<Thin::HttpParser:0x00007f4068579b08>, @data="", @nparsed=0, @body=#<StringIO:0x00007f4068579a90>, @env={"SERVER_SOFTWARE"=>"thin 1.8.1 codename Infinite Smoothie", "SERVER_NAME"=>"localhost", "rack.input"=>#<StringIO:0x00007f4068579a90>, "rack.version"=>[1, 0], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false}>, @response=#<Thin::Response:0x00007f4068579a40 @headers=#<Thin::Headers:0x00007f4068579a18 @sent={}, @out=[]>, @status=200, @persistent=false, @skip_body=false>, @backend=#<Thin::Backends::TcpServer:0x000055dc326b34b0 ...>, @app=Sinatra::Application, @threaded=true, @can_persist=true, @idle=true>, 5614520=>#<Thin::Connection:0x000055dc31f21648 @signature=156954, @request=#<Thin::Request:0x00007f407c222f40 @parser=#<Thin::HttpParser:0x00007f407c222e00>, @data=nil, @nparsed=472, @body=#<StringIO:0x00007f407c222d38>, @env={"SERVER_SOFTWARE"=>"thin 1.8.1 codename Infinite Smoothie", "SERVER_NAME"=>"chrome-get.intra.equisolve.com", "rack.input"=>#<StringIO:0x00007f407c222d38>, "rack.version"=>[1, 0], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/get", "PATH_INFO"=>"/get", "QUERY_STRING"=>"url=https%3A%2F%2Fwww.sec.gov%2Fcgi-bin%2Fbrowse-edgar%3Faction%3Dgetcompany%26CIK%3D0001392694%26type%3D%26dateb%3D%26owner%3Dinclude%26start%3D0%26count%3D40%26output%3Datom", "REQUEST_URI"=>"/get?url=https%3A%2F%2Fwww.sec.gov%2Fcgi-bin%2Fbrowse-edgar%3Faction%3Dgetcompany%26CIK%3D0001392694%26type%3D%26dateb%3D%26owner%3Dinclude%26start%3D0%26count%3D40%26output%3Datom", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_X_FORWARDED_FOR"=>"54.234.185.177", "HTTP_X_FORWARDED_PROTO"=>"https", "HTTP_X_FORWARDED_PORT"=>"8443", "HTTP_HOST"=>"chrome-get.intra.equisolve.com:8443", "HTTP_X_AMZN_TRACE_ID"=>"Root=1-62f56723-6e5ee38e66d4ecb121e35dad", "HTTP_ACCEPT_ENCODING"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "HTTP_ACCEPT"=>"*/*", "HTTP_USER_AGENT"=>"Ruby", "GATEWAY_INTERFACE"=>"CGI/1.2", "SERVER_PORT"=>"8443", "SERVER_PROTOCOL"=>"HTTP/1.1", "rack.url_scheme"=>"http", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"192.168.227.129", "async.callback"=>#<Method: #<Thin::Connection:0x000055dc31f21648 ...>.post_process(result) /usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb:95>, "async.close"=>#<EventMachine::DefaultDeferrable:0x00007f40940335a0>, "sinatra.commonlogger"=>true, "rack.logger"=>#<Logger:0x00007f4094033578 @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007f4094033550 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007f4094033500 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x00007f40940334d8>, @mon_data_owner_object_id=5616940>>, "rack.request.query_string"=>"url=https%3A%2F%2Fwww.sec.gov%2Fcgi-bin%2Fbrowse-edgar%3Faction%3Dgetcompany%26CIK%3D0001392694%26type%3D%26dateb%3D%26owner%3Dinclude%26start%3D0%26count%3D40%26output%3Datom", "rack.request.query_hash"=>{"url"=>"https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=0001392694&type=&dateb=&owner=include&start=0&count=40&output=atom"}, "sinatra.route"=>"GET /get"}>, @response=#<Thin::Response:0x00007f407c222ae0 @headers=#<Thin::Headers:0x00007f407c2229f0 @sent={}, @out=[]>, @status=200, @persistent=false, @skip_body=false>, @backend=#<Thin::Backends::TcpServer:0x000055dc326b34b0 ...>, @app=Sinatra::Application, @threaded=true, @can_persist=true, @idle=false>}, @timeout=30, @persistent_connection_count=6, @maximum_connections=1024, @maximum_persistent_connections=100, @no_epoll=false, @running=true, @ssl=nil, @started_reactor=true, @stopping=false, @threaded=true, @server=#<Thin::Server:0x000055dc326b3578 @app=Sinatra::Application, @tag=nil, @backend=#<Thin::Backends::TcpServer:0x000055dc326b34b0 ...>, @setup_signals=true, @signal_queue=[], @signal_timer=#<EventMachine::PeriodicTimer:0x000055dc326cc988 @interval=1, @code=#<Proc:0x000055dc326cc9b0 /usr/local/bundle/gems/thin-1.8.1/lib/thin/server.rb:244>, @cancelled=false, @work=#<Method: EventMachine::PeriodicTimer#fire() /usr/local/bundle/gems/eventmachine-1.2.7/lib/em/timers.rb:54>>>, @signature=2>, @app=Sinatra::Application, @threaded=true, @can_persist=true, @idle=false>.post_process(result) /usr/local/bundle/gems/thin-1.8.1/lib/thin/connection.rb:95> |
async.close | #<EventMachine::DefaultDeferrable:0x000055dc327e4e88> |
rack.errors | #<Object:0x000055dc31fa8508> |
rack.input | #<StringIO:0x000055dc31c87f68> |
rack.logger | #<Logger:0x000055dc327e4e60 @level=1, @progname=nil, @default_formatter=#<Logger::Formatter:0x000055dc327e4e38 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x000055dc327e4de8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @binmode=false, @mon_data=#<Monitor:0x000055dc327e4dc0>, @mon_data_owner_object_id=5616900>> |
rack.multiprocess | false |
rack.multithread | true |
rack.request.cookie_hash | {} |
rack.request.query_hash | {"url"=>""} |
rack.request.query_string | url= |
rack.run_once | false |
rack.url_scheme | http |
rack.version | [1, 0] |
sinatra.accept | [#<Sinatra::Request::AcceptEntry:0x00007f40940bf4d8 @entry="*/*", @type="*/*", @params={}, @q=1.0>] |
sinatra.commonlogger | true |
sinatra.error | #<Selenium::WebDriver::Error::InvalidArgumentError: invalid argument
(Session info: chrome=103.0.5060.66)> |
sinatra.error.params | {"url"=>""} |
sinatra.route | GET /get |
You're seeing this error because you have
enabled the show_exceptions
setting.