From: "Kristian Sørensen" Date: 2003-11-17T10:24:38+09:00 Subject: Re: Access ftp-server through proxy Clifford Heath wrote: > Kristian S�rensen wrote: > >> - Internet browsers is able to use e.g. regular squid proxy to make >> ftp connections. That was what I was after. It isn't too many places a >> socks server is available (not that I know of anyway ;) > > > You make an HTTP proxy request, using an FTP URL. > > An HTTP proxy request differs from a normal HTTP request > in that the GET line contains "http://host.domain" at the > start of the URL string. Just replace the http with ftp, > add whatever username/password you need, and Squid will > do the FTP for you. The request line looks like: > > GET ftp://user:password@host.domain/pub/some_file HTTP/1.0 Okay, that's sounds easy, but I can't get it to work. Can you complete a ftp-download example? I have tried with the following (including variants of it), but can't get it to work: ----- #!/usr/bin/env ruby require 'net/http' Net::HTTP.start('ftp://anonymous:anonymous@ftp.sunsite.dk', 21) { |http| response, data = http.get('/pub/gnu/mc/mc-4.5.55.tar.gz', nil) File.open("mc.tgz", "wb") { |f| f.write(data) } } ----- I get the error trace: ----- /pack/ruby-1.8.0/lib/ruby/1.8/net/protocol.rb:84:in `initialize': getaddrinfo: Name or service not known (SocketError) from /pack/ruby-1.8.0/lib/ruby/1.8/net/protocol.rb:84:in `new' from /pack/ruby-1.8.0/lib/ruby/1.8/net/protocol.rb:84:in `connect' from /pack/ruby-1.8.0/lib/ruby/1.8/net/protocol.rb:83:in `timeout' from /pack/ruby-1.8.0/lib/ruby/1.8/timeout.rb:55:in `timeout' from /pack/ruby-1.8.0/lib/ruby/1.8/net/protocol.rb:83:in `connect' from /pack/ruby-1.8.0/lib/ruby/1.8/net/protocol.rb:65:in `initialize' from /pack/ruby-1.8.0/lib/ruby/1.8/net/http.rb:422:in `open' from /pack/ruby-1.8.0/lib/ruby/1.8/net/http.rb:422:in `do_start' from /pack/ruby-1.8.0/lib/ruby/1.8/net/http.rb:409:in `start' from /pack/ruby-1.8.0/lib/ruby/1.8/net/http.rb:324:in `start' from ./ftpget.rb:4 ----- /KS