From: Eric Wong Date: Thu, 7 Jun 2012 21:36:35 +0000 (-0700) Subject: middleware/proxy: favor __send__ for method dispatch X-Git-Tag: v0.10.0~5 X-Git-Url: https://repo.or.cz/w/raindrops.git/commitdiff_plain/506df98df1dae59281fbb3b3c2c6bea7549a2288 middleware/proxy: favor __send__ for method dispatch "send" is more likely to be overridden in subclasses whereas the Ruby runtime (at least 1.9.3) will warn loudly if any user code (re)defines the "__send__" method. For example, BasicSocket#send and UDPSocket#send in the Ruby stdlib are wrappers for the send(2)/sendto(2) system calls, and it's entirely possible an application could return a Socket-subclass as a Rack response body. --- diff --git a/lib/raindrops/middleware/proxy.rb b/lib/raindrops/middleware/proxy.rb index ce634bb..1cf437c 100644 --- a/lib/raindrops/middleware/proxy.rb +++ b/lib/raindrops/middleware/proxy.rb @@ -35,6 +35,6 @@ class Raindrops::Middleware::Proxy # Avoid breaking users of non-standard extensions (e.g. #body) # Rack::BodyProxy does the same. def method_missing(*args, &block) - @body.send(*args, &block) + @body.__send__(*args, &block) end end