I am using the Net::FTP ruby library to connect to an FTP server and download files. It all works well, but now I need to use an outbound proxy since their firewall whitelists IP addresses, and I am using Heroku to host the site. I'm trying out the new Proximo add-on which looks promising, but I can't get Net::FTP to use it.
I see the following in the Net::FTP docs:
connect(host, port = FTP_PORT)
Establishes an FTP connection to host, optionally overriding the default port. If the environment variable SOCKS_SERVER is set, sets up the connection through a SOCKS proxy. Raises an exception (typically Errno::ECONNREFUSED) if the connection cannot be established.
But trying to set this environment variable, or setting ENV['SOCKS_SERVER'] = proximo_url
doesn't work either. Does anyone know how to properly do this? It doesn't have to be a SOCKS proxy, an HTTP proxy will do, but I'm not sure that the Net::FTP library supports this.
... after some research ...
I found that Net::FTP looks for a class called SOCKSSocket
, for which I found these docs. But I can't include it. include 'socket'
returns false which I'm pretty sure means it's already loaded.