* [PATCH] middleware/proxy: favor __send__ for method dispatch
@ 2012-06-07 21:55 Eric Wong
2012-06-08 18:11 ` Ben Somers
0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2012-06-07 21:55 UTC (permalink / raw)
To: raindrops
"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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] middleware/proxy: favor __send__ for method dispatch
2012-06-07 21:55 [PATCH] middleware/proxy: favor __send__ for method dispatch Eric Wong
@ 2012-06-08 18:11 ` Ben Somers
0 siblings, 0 replies; 2+ messages in thread
From: Ben Somers @ 2012-06-08 18:11 UTC (permalink / raw)
To: raindrops
> "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.
This seems eminently sensible and IIRC is the same way Rack does it.
Not sure why I changed it when making the original commit, I would
suspect my own foolishness.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, back to index
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 21:55 [PATCH] middleware/proxy: favor __send__ for method dispatch Eric Wong
2012-06-08 18:11 ` Ben Somers
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