From: Hugh Sasse Date: 2005-05-25T18:33:19+09:00 Subject: FTP, mostly questions, but a patch, too. I was looking at RFC959 -- the FTP spec, because I wondereed if it had any compression built in. It seems it has a basic Run Length Encoding if the MODE is Compress. (I'm a little surprised it doesn't seem to have caught up with HTTP's use of Deflate, but no matter.) So, the other thing it says about modes is that RETRy won't work in Stream mode, and Stream mode is the default mode. You need Block or Compress for RETR to work. That is if I have understood it correctly. So, I look it the Ruby ftp file. I see no support for MODE, but I see support for RETR. Is this actually correct if Stream is the default? I do see a reference to MDTM, which I can't see in RFC959, so I'm not sure what that is, and if it has something to do with MoDe of TransMission. I also see an EPRT command which I don't recognise either. Anyway, here is a vanishingly small patch to fix a DRY error, a minor English grammar point, and to flag up some missing WRITEME comments, possibly. Thank you, Hugh --- ruby-1.8.3/lib/net/ftp.rb 2004-06-22 08:47:35.000000000 +0100 +++ ruby-1.8.3/lib/net/ftp_new.rb 2005-05-25 09:58:02.781250000 +0100 @@ -142,15 +142,21 @@ # Obsolete def return_code - $stderr.puts("warning: Net::FTP#return_code is obsolete and do nothing") + obsolete("return_code") return "\n" end # Obsolete def return_code=(s) - $stderr.puts("warning: Net::FTP#return_code= is obsolete and do nothing") + obsolete("return_code=") end + # DRY principle: + def obsolete(method_name) + $stderr.puts("warning: Net::FTP##{method_name} is obsolete and does nothing") + end + private :obsolete + def open_socket(host, port) if defined? SOCKSsocket and ENV["SOCKS_SERVER"] @passive = true @@ -920,4 +926,5 @@ # Documentation comments: # - sourced from pickaxe and nutshell, with improvements (hopefully) # - three methods should be private (search WRITEME) +# There is only one that matches WRITEME. # - two methods need more information (search TODO)