From: James Edward Gray II Date: 2010-09-19T03:19:12+09:00 Subject: [ruby-core:32470] Re: [Ruby-Feature#3848][Open] Using http basic authentication for FTP with Open URI On Sep 17, 2010, at 2:02 PM, J�r�my Lecour wrote: > I needed to download a file from a FTP server, with OpenURI and I've found that it is not possible to do it with authentication. > > There is an option in the OpenURI open method to use a username/password but it is not used in FTP connection, the username/password for FTP is always set to anonymous/_nil_. OpenURI is just a wrapper around some clever URI parsing and URI seems to support it just fine: >> require "uri" => true >> u = URI.parse("http://user:pass@server.com/") => # >> u.userinfo => "user:pass" >> u.host => "server.com" >> u = URI.parse("ftp://user:pass@server.com/") => # >> u.userinfo => "user:pass" >> u.host => "server.com" Just add it to the server URL and I think you are all set. James Edward Gray II