Network Working Group N. Freed Request for Comments: 2920 Innosoft STD: 60 September 2000 Obsoletes: 2197 Category: Standards Track SMTP Service Extension for Command Pipelining Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited. Copyright Notice Copyright (C) The Internet Society (2000). All Rights Reserved.
AbstractThis memo defines an extension to the Simple Mail Transfer Protocol (SMTP) service whereby a server can indicate the extent of its ability to accept multiple commands in a single Transmission Control Protocol (TCP) send operation. Using a single TCP send operation for multiple commands can improve SMTP performance significantly. RFC-821] did not explicitly state that SMTP servers must support this. As a result a non-trivial number of Internet SMTP servers cannot adequately handle command pipelining. Flaws known to exist in deployed servers include:
(1) Connection handoff and buffer flushes in the middle of the SMTP dialogue. Creation of server processes for incoming SMTP connections is a useful, obvious, and harmless implementation technique. However, some SMTP servers defer process forking and connection handoff until some intermediate point in the SMTP dialogue. When this is done material read from the TCP connection and kept in process buffers can be lost. (2) Flushing the TCP input buffer when an SMTP command fails. SMTP commands often fail but there is no reason to flush the TCP input buffer when this happens. Nevertheless, some SMTP servers do this. (3) Improper processing and promulgation of SMTP command failures. For example, some SMTP servers will refuse to accept a DATA command if the last RCPT TO command fails, paying no attention to the success or failure of prior RCPT TO command results. Other servers will accept a DATA command even when all previous RCPT TO commands have failed. Although it is possible to accommodate this sort of behavior in a client that employs command pipelining, it does complicate the construction of the client unnecessarily. This memo uses the mechanism described in [RFC-1869] to define an extension to the SMTP service whereby an SMTP server can declare that it is capable of handling pipelined commands. The SMTP client can then check for this declaration and use pipelining only when the server declares itself capable of handling it. RFC-1123]; the terms "MUST NOT" and "SHOULD NOT" are logical extensions of this usage.
(3) no parameter is used with the PIPELINING EHLO keyword; (4) no additional parameters are added to either the MAIL FROM or RCPT TO commands. (5) no additional SMTP verbs are defined by this extension; and, (6) the next section specifies how support for the extension affects the behavior of a server and client SMTP.
was accepted the client SMTP should send a single dot. Command statuses MUST be coordinated with responses by counting each separate response and correlating that count with the number of commands known to have been issued. Multiline responses MUST be supported. Matching on the basis of either the error code value or associated text is expressly forbidden. Client SMTP implementations MAY elect to operate in a nonblocking fashion, processing server responses immediately upon receipt, even if there is still data pending transmission from the client's previous TCP send operation. If nonblocking operation is not supported, however, client SMTP implementations MUST also check the TCP window size and make sure that each group of commands fits entirely within the window. The window size is usually, but not always, 4K octets. Failure to perform this check can lead to deadlock conditions. Clients MUST NOT confuse responses to multiple commands with multiline responses. Each command requires one or more lines of response, the last line not containing a dash between the response code and the response string.
(7) MUST send all pending responses immediately whenever the local TCP input buffer is emptied. (8) MUST NOT make assumptions about commands that are yet to be received. (9) MUST NOT flush or otherwise lose the contents of the TCP input buffer under any circumstances whatsoever. (10) SHOULD issue response text that indicates, either implicitly or explicitly, what command the response matches. The overriding intent of these server requirements is to make it as easy as possible for servers to conform to these pipelining extensions.
C: EHLO dbc.mtview.ca.us S: 250-innosoft.com S: 250 PIPELINING C: MAIL FROM:<firstname.lastname@example.org> C: RCPT TO:<email@example.com> C: RCPT TO:<firstname.lastname@example.org> C: RCPT TO:<email@example.com> C: DATA S: 250 sender <firstname.lastname@example.org> OK S: 250 recipient <email@example.com> OK S: 250 recipient <firstname.lastname@example.org> OK S: 250 recipient <email@example.com> OK S: 354 enter mail, end with line containing only "." ... C: . C: QUIT S: 250 message sent S: 221 goodbye The total number of turnarounds has been reduced from 9 to 4. The next example illustrates one possible form of behavior when pipelining is used and all recipients are rejected: S: <wait for open connection> C: <open connection to server> S: 220 innosoft.com SMTP service ready C: EHLO dbc.mtview.ca.us S: 250-innosoft.com S: 250 PIPELINING C: MAIL FROM:<firstname.lastname@example.org> C: RCPT TO:<email@example.com> C: RCPT TO:<firstname.lastname@example.org> C: DATA S: 250 sender <email@example.com> OK S: 550 remote mail to <firstname.lastname@example.org> not allowed S: 550 remote mail to <email@example.com> not allowed S: 554 no valid recipients given C: QUIT S: 221 goodbye The client SMTP waits for the server 4 times here as well. If the server SMTP does not check for at least one valid recipient prior to accepting the DATA command, the following dialogue would result: S: <wait for open connection> C: <open connection to server> S: 220 innosoft.com SMTP service ready
C: EHLO dbc.mtview.ca.us S: 250-innosoft.com S: 250 PIPELINING C: MAIL FROM:<firstname.lastname@example.org> C: RCPT TO:<email@example.com> C: RCPT TO:<firstname.lastname@example.org> C: DATA S: 250 sender <email@example.com> OK S: 550 remote mail to <firstname.lastname@example.org> not allowed S: 550 remote mail to <email@example.com> not allowed S: 354 enter mail, end with line containing only "." C: . C: QUIT S: 554 no valid recipients S: 221 goodbye RFC-821]. RFC 1425. Marshall Rose's description of SMTP command pipelining in his book "The Internet Message" also served as a source of inspiration for this extension. [RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC 821, August 1982. [RFC-1123] Braden, R., "Requirements for Internet Hosts -- Application and Support", STD 3, RFC 1123, October, 1989. [RFC-1854] Freed, N., "SMTP Service Extension for Command Pipelining", RFC 1854, October 1995. [RFC-1869] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker, "SMTP Service Extensions", STD 10, RFC 1869, November 1995. [RFC-2197] Freed, N., "SMTP Service Extension for Command Pipelining", RFC 2197, September 1997.
Acknowledgement Funding for the RFC Editor function is currently provided by the Internet Society.