mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
#8739: upgrade smtpd to RFC 5321 and 1870.
smtpd now handles EHLO and has infrastructure for extended smtp command mode. The SIZE extension is also implemented. In order to support parameters on MAIL FROM, the RFC 5322 parser from the email package is used to parse the address "token". Logging subclasses things and overrides __init__, so it was necessary to update those __init__ functions in the logging tests to make the logging tests pass. The original suggestion and patch were by Alberto Trevino. Juhana Jauhiainen added the --size argument and SIZE parameter support. Michele Orrù improved the patch and added more tests. Dan Boswell conditionalized various bits of code on whether or not we are in HELO or EHLO mode, as well as some other improvements and tests. I finalized the patch and added the address parsing.
This commit is contained in:
parent
032eed3c4a
commit
d1a30c939c
7 changed files with 483 additions and 92 deletions
|
@ -663,6 +663,7 @@ if threading:
|
|||
self.smtp_server = server
|
||||
self.conn = conn
|
||||
self.addr = addr
|
||||
self.data_size_limit = None
|
||||
self.received_lines = []
|
||||
self.smtp_state = self.COMMAND
|
||||
self.seen_greeting = ''
|
||||
|
@ -682,6 +683,7 @@ if threading:
|
|||
return
|
||||
self.push('220 %s %s' % (self.fqdn, smtpd.__version__))
|
||||
self.set_terminator(b'\r\n')
|
||||
self.extended_smtp = False
|
||||
|
||||
|
||||
class TestSMTPServer(smtpd.SMTPServer):
|
||||
|
@ -709,6 +711,7 @@ if threading:
|
|||
def __init__(self, addr, handler, poll_interval, sockmap):
|
||||
self._localaddr = addr
|
||||
self._remoteaddr = None
|
||||
self.data_size_limit = None
|
||||
self.sockmap = sockmap
|
||||
asyncore.dispatcher.__init__(self, map=sockmap)
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue