-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I get this error when doing multipart posts against a sinatra app running with rack-jetty:
2011-09-25 17:51:05.932::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2011-09-25 17:51:05.973::INFO: jetty-6.1.14
2011-09-25 17:51:06.01::INFO: Started SocketConnector@localhost:4567
2011-09-25 17:51:22.015::WARN: EXCEPTION
org.jruby.exceptions.RaiseException: (EOFError) bad content body
at Rack::Multipart::Parser.get_current_head_and_filename_and_content_type_and_name_and_body(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-1.3.3/lib/rack/multipart/parser.rb:108)
at Rack::Multipart::Parser.parse(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-1.3.3/lib/rack/multipart/parser.rb:18)
at org.jruby.RubyKernel.loop(org/jruby/RubyKernel.java:1419)
at Rack::Multipart::Parser.parse(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-1.3.3/lib/rack/multipart/parser.rb:17)
at #<Class:0x13bf0d7f5>.parse_multipart(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-1.3.3/lib/rack/multipart.rb:25)
at Rack::Request.parse_multipart(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-1.3.3/lib/rack/request.rb:306)
at Rack::Request.POST(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-1.3.3/lib/rack/request.rb:182)
at Rack::MethodOverride.call(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-1.3.3/lib/rack/methodoverride.rb:15)
at #<Class:0x1390b755d>.call(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/sinatra-1.2.6/lib/sinatra/base.rb:1272)
at #<Class:0x104f9d4f7>.synchronize(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/sinatra-1.2.6/lib/sinatra/base.rb:1303)
at #<Class:0x104f9d4f7>.call(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/sinatra-1.2.6/lib/sinatra/base.rb:1272)
at RackJetty::ServletHandler.handle(/Users/tomdz/.rvm/gems/jruby-1.6.4/gems/rack-jetty-0.2.0/lib/rack_jetty/servlet_handler.rb:55)
This is against this simple test app:
require 'rubygems'
require 'bundler/setup'
require 'sinatra'
require 'digest/sha1'
require 'fileutils'
require 'rack/handler/jetty'
post '/' do
"Hello World"
end
set :environment, :production
set :run, false
server = Rack::Handler::Jetty.new(Sinatra::Application, {
:Host => 'localhost',
:Port => 4567
})
server.runusing this ruby script to perform the POST:
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http/post/multipart'
url = URI.parse("http://localhost:4567/")
res = Net::HTTP.start(url.host, url.port) do |http|
req = Net::HTTP::Post::Multipart.new url.path,
"file" => UploadIO.new("spec/images/image.jpg", "image/jpg")
http.request(req)
end(This uses the multipart-post gem).
Metadata
Metadata
Assignees
Labels
No labels