[Yum-devel] [UG] urlgrabber & unsupported REST FTP command

Francois Petillon fantec at proxad.net
Wed Jul 2 14:33:33 UTC 2008


Hello,

In file byterange.py class ftpwrapper, urlgrabber use REST command and 
check return code to find out if the command is supported :
----
except ftplib.error_perm, reason:
     if str(reason)[:3] == '501':
         # workaround for REST not supported error
         fp, retrlen = self.retrfile(file, type)
         fp = RangeableFileObject(fp, (rest,''))
         return (fp, retrlen)
     elif str(reason)[:3] != '550':
         raise IOError, ('ftp error', reason), sys.exc_info()[2]
----

But the RFC 640 (http://www.faqs.org/rfcs/rfc640.html) gives 500, 501, 
502, 421, 530 & 350 as possible return code. In these, the first three 
50x may apply for an unsupported/disabled REST command :
- 500  Syntax error, command unrecognized
        [This may include errors such as command line too
        long.]
- 501  Syntax error in parameters or arguments
- 502  Command not implemented

As far as I am concerned, I would accept any 50x result to use REST-less 
download :
----
        5yz   Permanent Negative Completion reply

           The command was not accepted and the requested action did
           not take place.  The User-process is discouraged from
           repeating the exact request (in the same sequence).  Even
           some "permanent" error conditions can be corrected, so the
           human user may want to direct his User-process to
           reinitiate the command sequence by direct action at some
           point in the future (e.g. after the spelling has been
           changed, or the user has altered his directory status.)
----
        x0z   Syntax - These replies refer to syntax errors,
           syntactically correct  commands that don't fit any
           functional category, unimplemented or superfluous
           commands.
----

François



More information about the Yum-devel mailing list