Does anyone know why binary PUTs are causing a 500 error in Rails? Non
binary PUTs are working fine. I’m trying to make a WebDAV server. I’ve
tried using both mongrel and webrick.
Alex MacCaw wrote:
Does anyone know why binary PUTs are causing a 500 error in Rails? Non
binary PUTs are working fine. I’m trying to make a WebDAV server. I’ve
tried using both mongrel and webrick.
Look in your logs to find what is causing your 500 error.
Alex W. wrote:
Alex MacCaw wrote:
Does anyone know why binary PUTs are causing a 500 error in Rails? Non
binary PUTs are working fine. I’m trying to make a WebDAV server. I’ve
tried using both mongrel and webrick.Look in your logs to find what is causing your 500 error.
Yes, it looks like a cgi error, with windows at least:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/cgi_ext/cgi_methods.rb:49:in
`parse_request_parameters’
Does anyone know why binary PUTs are causing a 500 error in Rails? Non
binary PUTs are working fine. I’m trying to make a WebDAV server. I’ve
tried using both mongrel and webrick.
Well, I’ve solved it by (by fluke). You need to a put a ‘puts’ in:
C:\ruby\lib\ruby\gems\1.8\gems\actionpack-1.12.5\lib\action_controller\cgi_ext\raw_post_data_fix.rb
At the end of ‘read_params_from_post’. This makes the method return nil
so @params defaults to an empty string:
@params = CGI::parse(read_query_params(method) || “”)
I’m not sure whether this is an bug in rails or just faulty webDAV
requests.
Anyway, can someone suggest an easy way to ‘patch’ rails without
manually editing it.
On Nov 29, 2006, at 2:35 AM, Alex MacCaw wrote:
At the end of ‘read_params_from_post’. This makes the method return
nil
so @params defaults to an empty string:
@params = CGI::parse(read_query_params(method) || “”)I’m not sure whether this is an bug in rails or just faulty webDAV
requests.
Anyway, can someone suggest an easy way to ‘patch’ rails without
manually editing it.
Alex,
what did your code look like that was failing? I’ve done binary PUTs
using curl and haven’t seen the problem you are describing.
$ curl -T localhost:3000/mycontroller/id
The data being “put” ends up as a StringIO object in params. I can
get it out by calling #strings on it.
def update
mydata = params.strings
etc.
end
Can you share the code that is blowing up? BTW, I am using Rails 1.2RC1
cr