]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
In open_ftp(), check that retrlen is not None before using it in a %d format!
authorGuido van Rossum <guido@python.org>
Tue, 16 Feb 1999 15:10:12 +0000 (15:10 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 16 Feb 1999 15:10:12 +0000 (15:10 +0000)
Lib/urllib.py

index d175eef91bd5aa916a19216a3bb2e65fbe6eb726..d37906c0b2ddbd0f387e208ae6cfd03d0c6fdee3 100644 (file)
@@ -387,7 +387,7 @@ class URLopener:
                                   value in ('a', 'A', 'i', 'I', 'd', 'D'):
                                        type = string.upper(value)
                         (fp, retrlen) = self.ftpcache[key].retrfile(file, type)
-                        if retrlen >= 0:
+                        if retrlen is not None and retrlen >= 0:
                             import mimetools, StringIO
                             headers = mimetools.Message(StringIO.StringIO(
                                 'Content-Length: %d\n' % retrlen))