mirror of https://github.com/python/cpython.git
added code to canonicalise line endings in data sent via "append" - fix for bug report 723962
This commit is contained in:
parent
75ab1462d5
commit
47404fffff
|
@ -83,6 +83,7 @@
|
||||||
r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'
|
r' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'
|
||||||
r'"')
|
r'"')
|
||||||
Literal = re.compile(r'.*{(?P<size>\d+)}$')
|
Literal = re.compile(r'.*{(?P<size>\d+)}$')
|
||||||
|
MapCRLF = re.compile(r'(?:\r\n|\n|\r(?!\n))')
|
||||||
Response_code = re.compile(r'\[(?P<type>[A-Z-]+)( (?P<data>[^\]]*))?\]')
|
Response_code = re.compile(r'\[(?P<type>[A-Z-]+)( (?P<data>[^\]]*))?\]')
|
||||||
Untagged_response = re.compile(r'\* (?P<type>[A-Z-]+)( (?P<data>.*))?')
|
Untagged_response = re.compile(r'\* (?P<type>[A-Z-]+)( (?P<data>.*))?')
|
||||||
Untagged_status = re.compile(r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?')
|
Untagged_status = re.compile(r'\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?')
|
||||||
|
@ -308,7 +309,7 @@ def append(self, mailbox, flags, date_time, message):
|
||||||
date_time = Time2Internaldate(date_time)
|
date_time = Time2Internaldate(date_time)
|
||||||
else:
|
else:
|
||||||
date_time = None
|
date_time = None
|
||||||
self.literal = message
|
self.literal = MapCRLF.sub(CRLF, message)
|
||||||
return self._simple_command(name, mailbox, flags, date_time)
|
return self._simple_command(name, mailbox, flags, date_time)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1360,7 +1361,7 @@ def Time2Internaldate(date_time):
|
||||||
USER = getpass.getuser()
|
USER = getpass.getuser()
|
||||||
PASSWD = getpass.getpass("IMAP password for %s on %s: " % (USER, host or "localhost"))
|
PASSWD = getpass.getpass("IMAP password for %s on %s: " % (USER, host or "localhost"))
|
||||||
|
|
||||||
test_mesg = 'From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s' % {'user':USER, 'lf':CRLF}
|
test_mesg = 'From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s' % {'user':USER, 'lf':'\n'}
|
||||||
test_seq1 = (
|
test_seq1 = (
|
||||||
('login', (USER, PASSWD)),
|
('login', (USER, PASSWD)),
|
||||||
('create', ('/tmp/xxx 1',)),
|
('create', ('/tmp/xxx 1',)),
|
||||||
|
|
Loading…
Reference in New Issue