Начальный комит
This commit is contained in:
1 parent
7de6ed476a
commit
568d49d644
4 files changed
+67
-31
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,29 @@
|
||||
from socketserver import StreamRequestHandler
|
||||
|
||||
ERR_CODE = {
|
||||
220 : ''
|
||||
500 : 'Syntax error, command unrecognized',
|
||||
}
|
||||
|
||||
class SmtpProcessor(object):
|
||||
def __init__(self, src_addr, rfile,wfile):
|
||||
self.src_addr = src_addr
|
||||
self.rfile = rfile
|
||||
self.wfile = wfile
|
||||
self.unrec_commands_count = 0
|
||||
|
||||
class SmtpHandler(StreamRequestHandler):
|
||||
|
||||
def handle(self):
|
||||
# self.rfile is a file-like object created by the handler;
|
||||
# we can now use e.g. readline() instead of raw recv() calls
|
||||
self.data = self.rfile.readline().strip()
|
||||
print("{} wrote:".format(self.client_address[0]))
|
||||
print(self.data)
|
||||
# Likewise, self.wfile is a file-like object used to write back
|
||||
# to the client
|
||||
self.wfile.write(self.data.upper())
|
||||
|
||||
#######################################################
|
||||
processor = SmtpProcessor(self.client_address, self.rfile, self.wfile)
|
||||
|
||||
Reference in new issue
Block a user