update
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
import { createSmtpClient } from '../../../ts/mail/delivery/smtpclient/index.js';
|
||||
import type { SmtpClient } from '../../../ts/mail/delivery/smtpclient/smtp-client.js';
|
||||
import { Email } from '../../../ts/mail/core/classes.email.js';
|
||||
import * as net from 'net';
|
||||
|
||||
@ -179,25 +178,34 @@ tap.test('CEDGE-03: Server sends malformed multi-line responses', async () => {
|
||||
host: '127.0.0.1',
|
||||
port: malformedPort,
|
||||
secure: false,
|
||||
connectionTimeout: 5000,
|
||||
connectionTimeout: 3000, // Shorter timeout for faster test
|
||||
debug: true
|
||||
});
|
||||
|
||||
try {
|
||||
// Should timeout or fail due to incomplete EHLO response
|
||||
// Should timeout due to incomplete EHLO response
|
||||
const verified = await smtpClient.verify();
|
||||
console.log('Verification result:', verified);
|
||||
|
||||
// Either fails verification or times out
|
||||
if (!verified) {
|
||||
// If we get here, the client accepted the malformed response
|
||||
// This is acceptable if the client can work around it
|
||||
if (verified === false) {
|
||||
console.log('✅ Client rejected malformed multi-line response');
|
||||
} else {
|
||||
console.log('⚠️ Client accepted malformed multi-line response');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('✅ Client handled malformed response with error:', error.message);
|
||||
expect(error.message).toMatch(/timeout|response|parse|format/i);
|
||||
// Should timeout or error on malformed response
|
||||
expect(error.message).toMatch(/timeout|Command timeout|Greeting timeout|response|parse/i);
|
||||
}
|
||||
|
||||
await smtpClient.close();
|
||||
// Force close since the connection might still be waiting
|
||||
try {
|
||||
await smtpClient.close();
|
||||
} catch (closeError) {
|
||||
// Ignore close errors
|
||||
}
|
||||
|
||||
malformedServer.close();
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user