Reputation: 3938
I would like to use the net/imap library in ruby behind a authenticated proxy, I was starting to dig in and I'm wondering if there is a way to do this already or if I need to make my own version of the net/imap library that supports a proxy?
Upvotes: 2
Views: 1051
Reputation: 25956
It is possible to tunnel any socket connection through a HTTPS proxy server.
To do this:
Here is a ruby example of such a tunnel.
Reasons this will fail:
Upvotes: 1
Reputation: 65252
The easiest way to hack libraries that don't support proxy information is to replace Net::HTTP
with an instance of Net::HTTP::Proxy
:
# somewhere before you load net/imap
proxy = Net::HTTP::Proxy(address, host)
Net.class_eval do
remove_const :HTTP
HTTP = proxy
end
Upvotes: 0