mirror of
https://github.com/nodemailer/wildduck.git
synced 2026-01-21 08:51:42 +08:00
* fix(pop3): ensure pipelined RETR commands complete before processing next command When POP3 clients use PIPELINING to send multiple RETR commands, the server must ensure each message is fully transmitted (including the terminating dot) before processing the next command. Previously, the server would call next() when the source stream ended, but the DataStream transform (which adds the terminating dot) might not have finished flushing to the socket yet. This caused race conditions where the +OK response for the next RETR command could be sent before the previous message's terminating dot, violating the POP3 protocol and causing clients like mpop to report "invalid reply" errors. The fix listens for the 'end' event on the DataStream (after it has written the terminating dot) rather than the source stream, ensuring proper sequencing of pipelined responses. * test(pop3): add pipelining tests for RETR command race condition fix Add comprehensive tests to verify that pipelined RETR commands are handled correctly without interleaving responses. These tests simulate aggressive POP3 client behavior (like mpop) that sends multiple RETR commands without waiting for individual responses. The tests verify: - Multiple pipelined RETR commands complete in order - Message terminating dot is sent before next +OK response - The fix code exists in connection.js - Rapid pipelining with 10 messages works correctly * chore(test): add POP3 tests to grunt proto task Update Gruntfile to include POP3 tests in the proto task, allowing protocol- level tests (IMAP unit + POP3) to run without requiring MongoDB/Redis. Changes: - Add mochaTest:pop3 configuration for POP3 tests - Add mochaTest:imap-unit for IMAP tests that don't require MongoDB - Update proto task to run both imap-unit and pop3 tests * fix(pop3): add defensive checks for stream.options.ttlcounter Add defensive checks in RETR and TOP commands to handle streams that don't have the options.ttlcounter property set. This fixes a TypeError crash in Forward Email and other implementations that don't set stream.options when returning from onFetchMessage. The fix checks if stream?.options?.ttlcounter is a function before calling it, and skips the ttlcounter call if not available. Also adds: - mpop pipelining tests for real-world client compatibility - Tests for streams without options property - Tests for streams with options but missing ttlcounter - CI configuration to install mpop for testing |
||
|---|---|---|
| .. | ||
| api | ||
| fixtures | ||
| _globals-test.js | ||
| api-test.js | ||
| create-decipher-test.js | ||
| filtering-test.js | ||
| filtering-tools-test.js | ||
| pop3-mpop-pipelining-test.js | ||
| pop3-onconnect-test.js | ||
| pop3-pipelining-test.js | ||
| pop3-timeout-test.js | ||