summaryrefslogtreecommitdiffstats
path: root/Lib/rfc822.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-08-12 13:16:50 (GMT)
committerGuido van Rossum <guido@python.org>1994-08-12 13:16:50 (GMT)
commit3f9a6ec9e672acb733db1633d5544120e1bd6841 (patch)
tree0b9d740696b94ef7a871012052d2ad1926a82b67 /Lib/rfc822.py
parentdc1cdca10b6e4c85406b3650ced4b3fbefd71b67 (diff)
downloadcpython-3f9a6ec9e672acb733db1633d5544120e1bd6841.zip
cpython-3f9a6ec9e672acb733db1633d5544120e1bd6841.tar.gz
cpython-3f9a6ec9e672acb733db1633d5544120e1bd6841.tar.bz2
* Lib/rfc822.py: fix two bugs: error in readheaders interpreting
regex.match() result, and wrong logic in getfirstmatchingheader() when the same header occurs twice consecutively
Diffstat (limited to 'Lib/rfc822.py')
-rw-r--r--Lib/rfc822.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/rfc822.py b/Lib/rfc822.py
index 580102c..886098c 100644
--- a/Lib/rfc822.py
+++ b/Lib/rfc822.py
@@ -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