feat: Implement Deno-native STARTTLS handler and connection wrapper
- Refactored STARTTLS implementation to use Deno's native TLS via Deno.startTls(). - Introduced ConnectionWrapper to provide a Node.js net.Socket-compatible interface for Deno.Conn and Deno.TlsConn. - Updated TlsHandler to utilize the new STARTTLS implementation. - Added comprehensive SMTP authentication tests for PLAIN and LOGIN mechanisms. - Implemented rate limiting tests for SMTP server connections and commands. - Enhanced error handling and logging throughout the STARTTLS and connection upgrade processes.
This commit is contained in:
@@ -157,14 +157,11 @@ Deno.test({
|
||||
await sendSmtpCommand(conn, 'MAIL FROM:<sender@example.com>', '250');
|
||||
|
||||
// Try DATA after MAIL FROM but before RCPT TO
|
||||
// NOTE: Current server implementation accepts DATA without RCPT TO (returns 354)
|
||||
// RFC 5321 suggests this should be rejected with 503, but some servers allow it
|
||||
// RFC 5321: DATA must only be accepted after RCPT TO
|
||||
const response = await sendSmtpCommand(conn, 'DATA');
|
||||
assertMatch(response, /^(354|503)/, 'Server responds to DATA (354=accept, 503=reject)');
|
||||
assertMatch(response, /^503/, 'Should reject DATA before RCPT TO with 503');
|
||||
|
||||
if (response.startsWith('354')) {
|
||||
console.log('⚠️ Server accepts DATA without RCPT TO (non-standard but allowed)');
|
||||
}
|
||||
console.log('✓ DATA before RCPT TO correctly rejected with 503');
|
||||
} finally {
|
||||
try {
|
||||
await closeSmtpConnection(conn);
|
||||
|
||||
Reference in New Issue
Block a user