File uploads don't work...
Reported by Bryan | April 11th, 2008 @ 11:49 PM | in 0.3.0 Sammy
This is my app:
When uploading a file bigger than a few Kb:
"Safari can't open the page "http://localhost:4567/upload" because the
server unexpectedly dropped the connection, which sometimes occurs
when the server is busy. You might be able to open the page later."
I actually had this problem a few months ago, then it disappeared when i upgraded to the version on the old git repo.
Seems to have returned though.
(dam lighthouse, I pressed enter too quickly on accident)
Comments and changes to this ticket
-

Bryan April 11th, 2008 @ 11:51 PM
This is my app:
When uploading a file bigger than a few Kb:
"Safari can't open the page "http://localhost:4567/upload" because the
server unexpectedly dropped the connection, which sometimes occurs
when the server is busy. You might be able to open the page later."
I actually had this problem a few months ago, then it disappeared when i upgraded to the version on the old git repo.
Seems to have returned though.
-
Ryan Tomayko April 15th, 2008 @ 12:23 PM
The quickest way to workaround this is to add the following somewhere in your app:
class Tempfile def ==(other) ; eql?(other) || super ; end endMore info and patch coming soon ...
-
Ryan Tomayko April 15th, 2008 @ 12:41 PM
Okay. There are actually a couple of issues here. First, EOFError's are being swallowed somewhere, which is what makes things appear to die. I will open a separate ticket for this.
The actual problem is caused by a bug in Ruby 1.8 Tempfile, which is causing Rack to try to parse large request bodies multiple times. The second time Rack::Request#params is called, it raises an EOFError because the request body's file pointer is at the end of the file.
The next version of Rack corrects the problem. See the following Rack commit for more information:
http://github.com/chneukirchen/r...
We can fix the issue in Sinatra by patching ruby's Tempfile#== method to work properly. I've created a branch with a proposed fix here:
-
Blake Mizerany April 15th, 2008 @ 01:07 PM
I think we could just freeze Rack into our distribution of Sinatra. No reason to wait on gems. At my rate of `rake release` you can tell I'm not much of a fan on waiting for them.
I'll think about this for a bit then push a change.
-
Ryan Tomayko April 15th, 2008 @ 01:10 PM
Yea. The more I think about it, the more I think patching Tempfile is kind of silly. We're just going to pull it out when the fix lands in a Rack gem and it's trivial for people who are experiencing the problem now to workaround it manually by adding a few lines.
-
Blake Mizerany April 15th, 2008 @ 06:30 PM
- → State changed from new to resolved
this is done and a gem with the fix has been released.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
