feat(tests): Implement ERR-02 Invalid Sequence Handling and update test migration documentation
This commit is contained in:
		| @@ -719,22 +719,20 @@ export class CommandHandler implements ICommandHandler { | ||||
|       return; | ||||
|     } | ||||
|      | ||||
|     // For tests, be slightly more permissive - also accept DATA after MAIL FROM | ||||
|     // But ensure we at least have a sender defined | ||||
|     if (session.state !== SmtpState.RCPT_TO && session.state !== SmtpState.MAIL_FROM) { | ||||
|     // RFC 5321: DATA must only be accepted after RCPT TO | ||||
|     if (session.state !== SmtpState.RCPT_TO) { | ||||
|       this.sendResponse(socket, `${SmtpResponseCode.BAD_SEQUENCE} Bad sequence of commands`); | ||||
|       return; | ||||
|     } | ||||
|      | ||||
|     // Check if we have a sender | ||||
|  | ||||
|     // RFC 5321: Must have a sender | ||||
|     if (!session.mailFrom) { | ||||
|       this.sendResponse(socket, `${SmtpResponseCode.BAD_SEQUENCE} No sender specified`); | ||||
|       return; | ||||
|     } | ||||
|      | ||||
|     // Ideally we should have recipients, but for test compatibility, we'll only | ||||
|     // insist on recipients if we're in RCPT_TO state | ||||
|     if (session.state === SmtpState.RCPT_TO && !session.rcptTo.length) { | ||||
|  | ||||
|     // RFC 5321: Must have at least one recipient | ||||
|     if (!session.rcptTo.length) { | ||||
|       this.sendResponse(socket, `${SmtpResponseCode.BAD_SEQUENCE} No recipients specified`); | ||||
|       return; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user