>
> We have found a specific situation with binary multi-part uploads
> causing Rack to throw a fatal error.
>
> The specific files we have tested shows that >= 112kb works, <= 110k
> fails. The error thrown up from Rack is:
>
> /!\ FAILSAFE /!\ 2009-04-14 17:23:32 -0400
> Status: 500 Internal Server Error
> invalid byte sequence in US-ASCII
[snip]
That looks like an exception from Ruby 1.9, which version do you use?
--
^ manveru
>
> We have found a specific situation with binary multi-part uploads
> causing Rack to throw a fatal error.
>
> The specific files we have tested shows that >= 112kb works, <= 110k
> fails. The error thrown up from Rack is:
>
> /!\ FAILSAFE /!\ 2009-04-14 17:23:32 -0400
> Status: 500 Internal Server Error
> invalid byte sequence in US-ASCII
I've narrowed the cause down. It seems like we need to add some additional
handling for Ruby 1.9.
I assume that your current locale is set to C, which would cause Ruby to expect
input from outside to be in US-ASCII.
I tried following simple experiment:
sigma ~ % LC_ALL=C irb19
Encoding.default_external
# #<Encoding:US-ASCII>
file = open('MediumFile.jpg').read; file.encoding
# #<Encoding:US-ASCII>
file =~ /foo/
ArgumentError: invalid byte sequence in US-ASCII
from (irb):3
from /usr/bin/irb19:12:in `<main>'
file.force_encoding('ASCII-8BIT'); file.encoding
# #<Encoding:ASCII-8BIT>
file =~ /foo/
# nil
This means we have to change the encoding of the body to ASCII-8BIT for binary
data.
Where this change of encoding should take place isn't easy to say, I think that
it should happen in the Handler if possible...
--
^ manveru