Ricardo Amorim wrote:
> Actually, it seems that Net:::FTP
> only creates a SOCKSSocket but doesn't use SOCKS_SERVER at all.

Odd. Maybe it's worth experimenting with SOCKSSocket directly. 
Documentation is thin on the ground though.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/320460

> Anyways, i'm just testing Net::FTP as it seems as the only one that
> supports SOCKSSocket. I actually need to use SOCKS to do HTTP
> requests. Would Net::SSH::Proxy::SOCKS help me with that?

Possibly.

(1) If your HTTP library lets you pass in an already-opened socket, it 
will work fine. (For example, Net::Telnet lets you do that, using the 
"Proxy" option)

(2) If your HTTP library lets you pass in an object K, and it open the 
socket by calling K.open(host,port), then it will work. (With some 
frigging you might even be able to use a mocking library like Mocha to 
intercept TCPSocket)

Looking at the source of Net::HTTP, it appears to be hardcoded to 
TCPSocket.open, unless you want to monkeypatch the 'connect' method.

But there are other client libraries out there. For example:

    gem install httpclient

A quick look suggests you might be able to override the (short) 
create_socket method to do what you want.

But if it all just works with tsocks, maybe that's the easiest way to 
go.
-- 
Posted via http://www.ruby-forum.com/.