mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
* 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
This commit is contained in:
parent
dc1cdca10b
commit
3f9a6ec9e6
2 changed files with 6 additions and 6 deletions
|
@ -96,7 +96,7 @@ class Message:
|
||||||
elif headerseen and line[0] in ' \t':
|
elif headerseen and line[0] in ' \t':
|
||||||
# It's a continuation line.
|
# It's a continuation line.
|
||||||
list.append(line)
|
list.append(line)
|
||||||
elif regex.match('^[!-9;-~]+:', line):
|
elif regex.match('^[!-9;-~]+:', line) >= 0:
|
||||||
# It's a header line.
|
# It's a header line.
|
||||||
list.append(line)
|
list.append(line)
|
||||||
headerseen = 1
|
headerseen = 1
|
||||||
|
@ -157,11 +157,11 @@ class Message:
|
||||||
list = []
|
list = []
|
||||||
hit = 0
|
hit = 0
|
||||||
for line in self.headers:
|
for line in self.headers:
|
||||||
if string.lower(line[:n]) == name:
|
if hit:
|
||||||
hit = 1
|
if line[:1] not in string.whitespace:
|
||||||
elif line[:1] not in string.whitespace:
|
|
||||||
if hit:
|
|
||||||
break
|
break
|
||||||
|
elif string.lower(line[:n]) == name:
|
||||||
|
hit = 1
|
||||||
if hit:
|
if hit:
|
||||||
list.append(line)
|
list.append(line)
|
||||||
return list
|
return list
|
||||||
|
|
|
@ -191,7 +191,7 @@ class URLopener:
|
||||||
dirs, file = dirs[:-1], dirs[-1]
|
dirs, file = dirs[:-1], dirs[-1]
|
||||||
if dirs and not dirs[0]: dirs = dirs[1:]
|
if dirs and not dirs[0]: dirs = dirs[1:]
|
||||||
key = (user, host, port, string.joinfields(dirs, '/'))
|
key = (user, host, port, string.joinfields(dirs, '/'))
|
||||||
print 'key =', key
|
## print 'key =', key
|
||||||
try:
|
try:
|
||||||
if not self.ftpcache.has_key(key):
|
if not self.ftpcache.has_key(key):
|
||||||
self.ftpcache[key] = \
|
self.ftpcache[key] = \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue