From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6939 64.71.128.0/18 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.raindrops.general Subject: [PATCH] middleware/proxy: favor __send__ for method dispatch Date: Thu, 7 Jun 2012 14:55:34 -0700 Message-ID: <20120607215534.GA30776@dcvr.yhbt.net> References: <20120607215534.GA30776@dcvr.yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1339106157 32422 80.91.229.3 (7 Jun 2012 21:55:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 7 Jun 2012 21:55:57 +0000 (UTC) To: raindrops@librelist.org Original-X-From: raindrops@librelist.org Thu Jun 07 23:55:55 2012 Return-path: Envelope-to: gclrrg-raindrops@m.gmane.org In-Reply-To: <20120607215534.GA30776@dcvr.yhbt.net> List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: raindrops@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.raindrops.general:85 Archived-At: Received: from zedshaw.xen.prgmr.com ([64.71.167.205]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SckgJ-0001C6-IF for gclrrg-raindrops@m.gmane.org; Thu, 07 Jun 2012 23:55:51 +0200 Received: from zedshaw.xen.prgmr.com (localhost [IPv6:::1]) by zedshaw.xen.prgmr.com (Postfix) with ESMTP id 3004B21DDF1 for ; Thu, 7 Jun 2012 22:03:56 +0000 (UTC) "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. --- Pushed to "master" of git://bogomips.org/raindrops lib/raindrops/middleware/proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 1.7.11.rc0.55.gb2478aa