econe-upload:
parser.rb
get_current_head_and_filename_and_content_type_and_name_and_body
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/multipart/parser.rb
in
get_current_head_and_filename_and_content_type_and_name_and_body
end
next
end
# Save the read body part.
if head && (@boundary_size+4 < @buf.size)
body << @buf.slice!(0, @buf.size - (@boundary_size+4))
end
content = @io.read(BUFSIZE < @content_length ? BUFSIZE : @content_length)
raise EOFError, "bad content body" if content.nil? || content.empty?
@buf << content
@content_length -= content.size
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/multipart/parser.rb
in
parse
def parse
return nil unless setup_parse
fast_forward_to_first_boundary
loop do
head, filename, content_type, name, body =
get_current_head_and_filename_and_content_type_and_name_and_body
# Save the rest.
if i = @buf.index(rx)
body << @buf.slice!(0, i)
@buf.slice!(0, @boundary_size+2)
@content_length = -1 if $1 == "--"
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/multipart/parser.rb
in
loop
end
def parse
return nil unless setup_parse
fast_forward_to_first_boundary
loop do
head, filename, content_type, name, body =
get_current_head_and_filename_and_content_type_and_name_and_body
# Save the rest.
if i = @buf.index(rx)
body << @buf.slice!(0, i)
@buf.slice!(0, @boundary_size+2)
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/multipart/parser.rb
in
parse
end
def parse
return nil unless setup_parse
fast_forward_to_first_boundary
loop do
head, filename, content_type, name, body =
get_current_head_and_filename_and_content_type_and_name_and_body
# Save the rest.
if i = @buf.index(rx)
body << @buf.slice!(0, i)
@buf.slice!(0, @boundary_size+2)
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/multipart.rb
in
parse_multipart
BROKEN_UNQUOTED = /^#{CONDISP}.*;\sfilename=(#{TOKEN})/i
MULTIPART_CONTENT_TYPE = /Content-Type: (.*)#{EOL}/ni
MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:.*\s+name="?([^\";]*)"?/ni
MULTIPART_CONTENT_ID = /Content-ID:\s*([^#{EOL}]*)/ni
class << self
def parse_multipart(env)
Parser.new(env).parse
end
def build_multipart(params, first = true)
Generator.new(params, first).dump
end
end
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/request.rb
in
parse_multipart
protected
def parse_query(qs)
Utils.parse_nested_query(qs)
end
def parse_multipart(env)
Rack::Multipart.parse_multipart(env)
end
end
end
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/request.rb
in
POST
def POST
if @env["rack.input"].nil?
raise "Missing rack.input"
elsif @env["rack.request.form_input"].eql? @env["rack.input"]
@env["rack.request.form_hash"]
elsif form_data? || parseable_data?
@env["rack.request.form_input"] = @env["rack.input"]
unless @env["rack.request.form_hash"] = parse_multipart(env)
form_vars = @env["rack.input"].read
# Fix for Safari Ajax postings that always append \0
# form_vars.sub!(/\0\z/, '') # performance replacement:
form_vars.slice!(-1) if form_vars[-1] == ?\0
@env["rack.request.form_vars"] = form_vars
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/methodoverride.rb
in
call
def initialize(app)
@app = app
end
def call(env)
if env["REQUEST_METHOD"] == "POST"
req = Request.new(env)
method = req.POST[METHOD_OVERRIDE_PARAM_KEY] ||
env[HTTP_METHOD_OVERRIDE_HEADER]
method = method.to_s.upcase
if HTTP_METHODS.include?(method)
env["rack.methodoverride.original_method"] = env["REQUEST_METHOD"]
env["REQUEST_METHOD"] = method
end
end
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.1/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/lib/ruby/gems/1.8/gems/sinatra-1.3.1/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 ShowExceptions if show_exceptions?
builder.use Rack::MethodOverride if method_override?
builder.use Rack::Head
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.1/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/lib/ruby/gems/1.8/gems/sinatra-1.3.1/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 ShowExceptions if show_exceptions?
builder.use Rack::MethodOverride if method_override?
builder.use Rack::Head
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb
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
handle_error
terminate_request
nil # Signal to post_process that the request could not be processed
end
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/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
handle_error
terminate_request
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/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
handle_error
terminate_request
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
call
end
def self.spawn_threadpool # :nodoc:
until @threadpool.size == @threadpool_size.to_i
thread = Thread.new do
while true
op, cback = *@threadqueue.pop
result = op.call
@resultqueue << [result, cback]
EventMachine.signal_loopbreak
end
end
@threadpool << thread
end
end
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
spawn_threadpool
end
def self.spawn_threadpool # :nodoc:
until @threadpool.size == @threadpool_size.to_i
thread = Thread.new do
while true
op, cback = *@threadqueue.pop
result = op.call
@resultqueue << [result, cback]
EventMachine.signal_loopbreak
end
end
@threadpool << thread
end
end
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
initialize
end
@threadqueue << [op||blk,callback]
end
def self.spawn_threadpool # :nodoc:
until @threadpool.size == @threadpool_size.to_i
thread = Thread.new do
while true
op, cback = *@threadqueue.pop
result = op.call
@resultqueue << [result, cback]
EventMachine.signal_loopbreak
end
end
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
new
end
@threadqueue << [op||blk,callback]
end
def self.spawn_threadpool # :nodoc:
until @threadpool.size == @threadpool_size.to_i
thread = Thread.new do
while true
op, cback = *@threadqueue.pop
result = op.call
@resultqueue << [result, cback]
EventMachine.signal_loopbreak
end
end
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
spawn_threadpool
end
@threadqueue << [op||blk,callback]
end
def self.spawn_threadpool # :nodoc:
until @threadpool.size == @threadpool_size.to_i
thread = Thread.new do
while true
op, cback = *@threadqueue.pop
result = op.call
@resultqueue << [result, cback]
EventMachine.signal_loopbreak
end
end
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
defer
#
def self.defer op = nil, callback = nil, &blk
unless @threadpool
require 'thread'
@threadpool = []
@threadqueue = ::Queue.new
@resultqueue = ::Queue.new
spawn_threadpool
end
@threadqueue << [op||blk,callback]
end
def self.spawn_threadpool # :nodoc:
until @threadpool.size == @threadpool_size.to_i
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb
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(method(:pre_process), method(:post_process))
else
@request.threaded = false
post_process(pre_process)
end
end
def pre_process
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb
in
receive_data
@request = Request.new
@response = Response.new
end
# Called when data is received from the client.
def receive_data(data)
trace { data }
process if @request.parse(data)
rescue InvalidRequest => e
log "!! Invalid request"
log_error e
close_connection
end
# Called when all data was received and the request
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
run_machine
@reactor_running = true
initialize_event_machine
(b = blk || block) and add_timer(0, b)
if @next_tick_queue && !@next_tick_queue.empty?
add_timer(0) { signal_loopbreak }
end
@reactor_thread = Thread.current
run_machine
ensure
until @tails.empty?
@tails.pop.call
end
begin
release_machine
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb
in
run
@reactor_running = true
initialize_event_machine
(b = blk || block) and add_timer(0, b)
if @next_tick_queue && !@next_tick_queue.empty?
add_timer(0) { signal_loopbreak }
end
@reactor_thread = Thread.current
run_machine
ensure
until @tails.empty?
@tails.pop.call
end
begin
release_machine
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/backends/base.rb
in
start
@running = true
end
# Allow for early run up of eventmachine.
if EventMachine.reactor_running?
starter.call
else
EventMachine.run(&starter)
end
end
# Stop of the backend from accepting new connections.
def stop
@running = false
@stopping = true
/usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/server.rb
in
start
log ">> Thin web server (v#{VERSION::STRING} codename #{VERSION::CODENAME})"
debug ">> Debugging ON"
trace ">> Tracing ON"
log ">> Maximum connections set to #{@backend.maximum_connections}"
log ">> Listening on #{@backend}, CTRL+C to stop"
@backend.start
end
alias :start! :start
# == Gracefull shutdown
# Stops the server after processing all current connections.
# As soon as this method is called, the server stops accepting
# new requests and wait for all current connections to finish.
/usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/handler/thin.rb
in
run
module Handler
class Thin
def self.run(app, options={})
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
options[:Port] || 8080,
app)
yield server if block_given?
server.start
end
def self.valid_options
{
"Host=HOST" => "Hostname to listen on (default: localhost)",
"Port=PORT" => "Port to listen on (default: 8080)",
}
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb
in
run!
# Run the Sinatra app as a self-hosted server using
# Thin, Mongrel or WEBrick (in that order). If given a block, will call
# with the constructed handler once we have taken the stage.
def run!(options={})
set options
handler = detect_rack_handler
handler_name = handler.name.gsub(/.*::/, '')
handler.run self, :Host => bind, :Port => port do |server|
unless handler_name =~ /cgi/i
$stderr.puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
"on #{port} for #{environment} with backup from #{handler_name}"
end
[:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
server.threaded = settings.threaded if server.respond_to? :threaded=
set :running, true
/usr/lib/ruby/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/main.rb
in
nil
op.on('-s server') { |val| set :server, val }
op.on('-p port') { |val| set :port, Integer(val) }
op.on('-o addr') { |val| set :bind, val }
}.parse!(ARGV.dup)
end
end
at_exit { Application.run! if $!.nil? && Application.run? }
end
include Sinatra::Delegator
/var/lib/one/lib/ruby/cloud/econe/econe-server.rb
in
nil
do_http_request(params)
end
get '/' do
do_http_request(params)
end
def do_http_request(params)
case params['Action']
when 'UploadImage'
result,rc = @econe_server.upload_image(params)
when 'RegisterImage'
result,rc = @econe_server.register_image(params)
when 'DescribeImages'
result,rc = @econe_server.describe_images(params)
No GET data.
No POST data.
Variable | Value |
---|---|
CONTENT_LENGTH | 2147484701 |
CONTENT_TYPE | multipart/form-data; boundary=----------------------------cea05b80a792 |
GATEWAY_INTERFACE | CGI/1.2 |
HTTP_ACCEPT | */* |
HTTP_EXPECT | 100-continue |
HTTP_HOST | localhost:4567 |
HTTP_VERSION | HTTP/1.1 |
PATH_INFO | / |
QUERY_STRING | |
REMOTE_ADDR | 127.0.0.1 |
REQUEST_METHOD | POST |
REQUEST_PATH | / |
REQUEST_URI | / |
SCRIPT_NAME | |
SERVER_NAME | localhost |
SERVER_PORT | 4567 |
SERVER_PROTOCOL | HTTP/1.1 |
SERVER_SOFTWARE | thin 1.2.11 codename Bat-Shit Crazy |
async.callback | #<Method: Thin::Connection#post_process> |
async.close | #<EventMachine::DefaultDeferrable:0x7f14b0c4ae98> |
rack.errors | #<Object:0x7f14b38e2960> |
rack.input | #<File:/tmp/thin-body20111028-15523-bxnmj0-0> |
rack.multiprocess | false |
rack.multithread | true |
rack.request.cookie_hash | {} |
rack.request.form_input | #<File:/tmp/thin-body20111028-15523-bxnmj0-0> |
rack.request.query_hash | {} |
rack.request.query_string | |
rack.run_once | false |
rack.url_scheme | http |
rack.version | [1, 0] |
You're seeing this error because you have
enabled the show_exceptions
setting.