MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / found_terminator

Method found_terminator

tools/python-3.11.9-amd64/Lib/smtpd.py:335–394  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

333
334 # Implementation of base class abstract method
335 def found_terminator(self):
336 line = self._emptystring.join(self.received_lines)
337 print('Data:', repr(line), file=DEBUGSTREAM)
338 self.received_lines = []
339 if self.smtp_state == self.COMMAND:
340 sz, self.num_bytes = self.num_bytes, 0
341 if not line:
342 self.push('500 Error: bad syntax')
343 return
344 if not self._decode_data:
345 line = str(line, 'utf-8')
346 i = line.find(' ')
347 if i < 0:
348 command = line.upper()
349 arg = None
350 else:
351 command = line[:i].upper()
352 arg = line[i+1:].strip()
353 max_sz = (self.command_size_limits[command]
354 if self.extended_smtp else self.command_size_limit)
355 if sz > max_sz:
356 self.push('500 Error: line too long')
357 return
358 method = getattr(self, 'smtp_' + command, None)
359 if not method:
360 self.push('500 Error: command "%s" not recognized' % command)
361 return
362 method(arg)
363 return
364 else:
365 if self.smtp_state != self.DATA:
366 self.push('451 Internal confusion')
367 self.num_bytes = 0
368 return
369 if self.data_size_limit and self.num_bytes > self.data_size_limit:
370 self.push('552 Error: Too much mail data')
371 self.num_bytes = 0
372 return
373 # Remove extraneous carriage returns and de-transparency according
374 # to RFC 5321, Section 4.5.2.
375 data = []
376 for text in line.split(self._linesep):
377 if text and text[0] == self._dotsep:
378 data.append(text[1:])
379 else:
380 data.append(text)
381 self.received_data = self._newline.join(data)
382 args = (self.peer, self.mailfrom, self.rcpttos, self.received_data)
383 kwargs = {}
384 if not self._decode_data:
385 kwargs = {
386 'mail_options': self.mail_options,
387 'rcpt_options': self.rcpt_options,
388 }
389 status = self.smtp_server.process_message(*args, **kwargs)
390 self._set_post_data_state()
391 if not status:
392 self.push('250 OK')

Callers

nothing calls this directly

Calls 12

pushMethod · 0.95
_set_post_data_stateMethod · 0.95
strFunction · 0.85
methodFunction · 0.85
upperMethod · 0.80
stripMethod · 0.80
printFunction · 0.50
joinMethod · 0.45
findMethod · 0.45
splitMethod · 0.45
appendMethod · 0.45
process_messageMethod · 0.45

Tested by

no test coverage detected