raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: raindrops@librelist.org
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> (raw)
In-Reply-To: <20120607215534.GA30776@dcvr.yhbt.net>

"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


       reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 21:55 Eric Wong [this message]
2012-06-08 18:11 ` Ben Somers

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://bogomips.org/raindrops/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120607215534.GA30776@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=raindrops@librelist.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

raindrops RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/raindrops-public
	git clone --mirror http://ou63pmih66umazou.onion/raindrops-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox