# Best way to connect to ftp server through proxy?

**URL:** <https://www.ruby-forum.com/t/best-way-to-connect-to-ftp-server-through-proxy/146422>\
**Category:** Ruby\
**Created:** [August 20, 2008, 10:20pm UTC](https://www.ruby-forum.com/t/best-way-to-connect-to-ftp-server-through-proxy/146422 "2008-08-20T22:20:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shane\_Witbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@Shane\_Witbeck](https://www.ruby-forum.com/u/Shane_Witbeck)\
**Post date:** [August 20, 2008, 10:20pm UTC](https://www.ruby-forum.com/t/best-way-to-connect-to-ftp-server-through-proxy/146422/1 "2008-08-20T22:20:00Z")

</div>

The only docs I found on this is using a SOCKS proxy. What’s the best  
way to  
connect to an FTP server through a non-SOCKS proxy?

-Shane

---

<div class="post-metadata">

**Author:** ![Shane\_Witbeck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@Shane\_Witbeck](https://www.ruby-forum.com/u/Shane_Witbeck)\
**Post date:** [August 21, 2008, 4:59pm UTC](https://www.ruby-forum.com/t/best-way-to-connect-to-ftp-server-through-proxy/146422/2 "2008-08-21T16:59:25Z")

</div>

Replying to my own post in case anyone else needs the code (all of one  
line)…

open(“somefile.zip”,“wb”).write(open(“ftp://username:password@host:port/remotefile.zip”,  
:proxy=\>“[http://proxyhost](http://proxyhost):proxyport”).read)

-Shane
