]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
* Lib/rfc822.py: fix two bugs: error in readheaders interpreting
authorGuido van Rossum <guido@python.org>
Fri, 12 Aug 1994 13:16:50 +0000 (13:16 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 12 Aug 1994 13:16:50 +0000 (13:16 +0000)
regex.match() result, and wrong logic in getfirstmatchingheader()
when the same header occurs twice consecutively

Lib/rfc822.py
Lib/urllib.py

index 580102c93be338e9976966bfa888c61189830ca3..886098ccf407c685d6d9944a02a6b56538e5d14b 100644 (file)
@@ -96,7 +96,7 @@ class Message:
                        elif headerseen and line[0] in ' \t':
                                # It's a continuation line.
                                list.append(line)
-                       elif regex.match('^[!-9;-~]+:', line):
+                       elif regex.match('^[!-9;-~]+:', line) >= 0:
                                # It's a header line.
                                list.append(line)
                                headerseen = 1
@@ -157,11 +157,11 @@ class Message:
                list = []
                hit = 0
                for line in self.headers:
-                       if string.lower(line[:n]) == name:
-                               hit = 1
-                       elif line[:1] not in string.whitespace:
-                               if hit:
+                       if hit:
+                               if line[:1] not in string.whitespace:
                                        break
+                       elif string.lower(line[:n]) == name:
+                               hit = 1
                        if hit:
                                list.append(line)
                return list
index 14fcefa4fbc7d7519e4c7b26ca28fc2bd2bcbea6..e8f56a72486ef1402cedbe2f4445ae597abd9374 100644 (file)
@@ -191,7 +191,7 @@ class URLopener:
                dirs, file = dirs[:-1], dirs[-1]
                if dirs and not dirs[0]: dirs = dirs[1:]
                key = (user, host, port, string.joinfields(dirs, '/'))
-               print 'key =', key
+##             print 'key =', key
                try:
                        if not self.ftpcache.has_key(key):
                                self.ftpcache[key] = \