I''ve googled around a little bit and havent found anything useful. :-( Has anybody written a rails controller that accepts HTTP PUT (DAV) requests? If so, do you have any pointers? Thanks, Tyler --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rails can accept pretty much any HTTP request -- just check the request.method accessor. Rails provides a special test for put that makes things really succinct. def action if request.put? body = request.raw_post # do something with body else redirect_to :action => "error" end end On Mar 10, 12:34 pm, Tyler MacDonald <google....-oTuY4Vk9bUDG8MNy1oJpyw@public.gmane.org> wrote:> I''ve googled around a little bit and havent found anything useful. :-( > Has anybody written a rails controller that accepts HTTP PUT (DAV) requests? > If so, do you have any pointers? > > Thanks, > Tyler--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
eden li <eden.li-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Rails can accept pretty much any HTTP request -- just check the > request.method accessor. Rails provides a special test for put that > makes things really succinct. > > def action > if request.put? > body = request.raw_post > # do something with body > else > redirect_to :action => "error" > end > endGreat, so this code works with some uploaders (like curl), but other uploaders (like the one from upload.thinfile.com), which work with PHP, give me this error in ruby... (or just fail silently if I use CGI instead of FastCGI)... any ideas? 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? /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb:49:in `parse_request_parameters'' /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb:47:in `each'' /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb:47:in `parse_request_parameters'' /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_process.rb:71:in `request_parameters'' /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/request.rb:13:in `parameters'' /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:122:in `set_session_options_without_components'' /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/components.rb:178:in `set_session_options'' /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:116:in `process'' /var/www/public/../config/../vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'' /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:150:in `process_request'' /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:54:in `process!'' /usr/lib/ruby/1.8/fcgi.rb:612:in `each_cgi'' /usr/lib/ruby/1.8/fcgi.rb:609:in `each'' /usr/lib/ruby/1.8/fcgi.rb:609:in `each_cgi'' /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:53:in /`process!'' /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:23:in /`process!'' /var/www/public/dispatch.fcgi:26 Thanks, Tyler --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I remember running into this same exception when I sent raw XML with ampersands to my rails 1.1.6 controllers. You''ll need to hand patch that line by placing "next if key.nil? || key.empty?" before line 48 of vendor/rails/actionpack/lib/action_controller/cgi_ext/ cgi_methods.rb. OR you could just upgrade to 1.2.2 -- I think this has been fixed by now. On Mar 12, 5:27 am, Tyler MacDonald <google....-oTuY4Vk9bUDG8MNy1oJpyw@public.gmane.org> wrote:> eden li <eden...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Rails can accept pretty much any HTTP request -- just check the > > request.method accessor. Rails provides a special test for put that > > makes things really succinct. > > > def action > > if request.put? > > body = request.raw_post > > # do something with body > > else > > redirect_to :action => "error" > > end > > end > > Great, so this code works with some uploaders (like curl), but other > uploaders (like the one from upload.thinfile.com), which work with PHP, give > me this error in ruby... (or just fail silently if I use CGI instead of > FastCGI)... any ideas? > > 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? > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb:49:in > `parse_request_parameters'' > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb:47:in > `each'' > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb:47:in > `parse_request_parameters'' > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/cgi_process.rb:71:in > `request_parameters'' > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/request.rb:13:in > `parameters'' > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:122:in > `set_session_options_without_components'' > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/components.rb:178:in > `set_session_options'' > /var/www/public/../config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:116:in > `process'' > /var/www/public/../config/../vendor/rails/railties/lib/dispatcher.rb:38:in > `dispatch'' > /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:150:in > `process_request'' > /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:54:in > `process!'' > /usr/lib/ruby/1.8/fcgi.rb:612:in `each_cgi'' > /usr/lib/ruby/1.8/fcgi.rb:609:in `each'' > /usr/lib/ruby/1.8/fcgi.rb:609:in `each_cgi'' > /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:53:in > /`process!'' > /var/www/public/../config/../vendor/rails/railties/lib/fcgi_handler.rb:23:in > /`process!'' > /var/www/public/dispatch.fcgi:26 > > Thanks, > Tyler--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
eden li <eden.li-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I remember running into this same exception when I sent raw XML with > ampersands to my rails 1.1.6 controllers. You''ll need to hand patch > that line by placing "next if key.nil? || key.empty?" before line 48 > of vendor/rails/actionpack/lib/action_controller/cgi_ext/ > cgi_methods.rb. > > OR you could just upgrade to 1.2.2 -- I think this has been fixed by > now.Upgrading to 1.2.2 did indeed fix the problem! Thanks, eden! Cheers, Tyler --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---