[Top] [All Lists]

Re: Abort data transfer?

2009-10-19 15:18:27

On 19 Oct 2009, at 16:03, David MacQuigg wrote:

Thanks to all who answered this question.

Hector Santos wrote:
SM wrote:
Hi David,
At 14:29 17-10-2009, David MacQuigg wrote:
Is it permissible to abort data transfer before the end of data, say after you have received all headers, and you know the DKIM sig is bad?

RFC-5321 section 3.3 says:

If the verb is initially accepted and the 354 reply issued, the DATA command should fail only if the mail transaction was incomplete (for example, no recipients), if resources were unavailable (including, of
 course, the server unexpectedly becoming unavailable), or if the
server determines that the message should be rejected for policy or
 other reasons.

That paragraph is about the DATA command. You haven't received any headers yet. You don't know whether the DKIM signature is bad. This is more of a SMTP question though. You can do anything you wish for policy reasons. As long as you adhere to the RFC 5321, you won't cause interoperability or hard to debug problems. I suggest not aborting the data transfer to avoid such problems.

+1. Aborted Data transfers can cause retransmissions. Unfortunately, it is better to receive the entire payload and then issue a negative response.

Forget about DKIM. What if there is some other reason to abort, like the payload is too large? We cannot just continue receiving data forever. Is there a "permissible" way within SMTP to abort during data, or should I just ignore these ambiguous requirements, and either: 1) Send a TCP reset, or 2) Let the transmitter hang.

My implementations note the reason for rejection, then switch the event handler for the connection to one that just reads each buffer and then throws it away. There is nothing more that can be done. Even trying to inform the sender by writing the error to it while it is sending won't necessarily work, because it might not choose to look at its inbuffers until it's quite finished spewing. And in any case that's standards violation territory you're wandering into.

So you'll just have to do what you can to keep the connection alive for the data to come in, then reject it and hopefully at that point you can resume the dialogue to finish up and ensure the sender will leave you alone. Anything else is basically suboptimal.


<Prev in Thread] Current Thread [Next in Thread>