jruby/jruby-rack — Issue #92: Multipart upload corrupting file under trinidad
Author: davemitchell
Created: 2012-02-02 17:22:58+00:00
State: open

Multipart file upload seams to be broken. When posting a binary file (in my case, an jpg image) the file is transfered correctly when the server is running under MRI or jruby + webrick (eg, $ jruby -S bundle exec rails s), but not when run under trinidad. Under trinidad, the binary temp file created does not match the original--about ~10% has changed, including (always) the first few bytes which cause it to not be recognized as an image.

I'll attach a simple test app that can be used to repro--basically, I just generated a new rails app and slapped in a #create method on the default controller to examine the posted binary. Steps to repro:
* start the server: $ jruby -S rails s
* post the image: $ curl -i -s -S -F "foo=bar" -F "photo=@image.jpg" -X POST http://localhost:3000
* the above should be successful; it should puts success in the console and return a 200
* now stop the server and restart with trinidad, taking the defaults: $ trinidad
* post the image again: $ curl -i -s -S -F "foo=bar" -F "photo=@image.jpg" -X POST http://localhost:3000
* the second time fails, per the file comparison between the rack-created tempfile and the original image.

As mentioned above, the behavior is the same under both osx and windows. Everything should be latest versions, but I also tried regressing back one version for most things, with similar results (although I think a few combinations yielded a SEVERE ERROR on the trinidad console rather than corrupting the image).

Environment(s):
- Rails 3.2 (also under 3.1.x)
- JRuby 1.6.6 (also under 1.6.5.1)
- Ruby 1.9
- OSX & Win64
- Trinidad 1.3.2 (also tried earlier)
- jruby-rack 1.1.3