阿兹尔s6后期强吗:RFC:2920 - SMTP Service Extension for Command Pipelining

来源:百度文库 编辑:九乡新闻网 时间:2024/10/06 00:39:26

Network Working Group N. FreedRequest for Comments: 2920 InnosoftSTD: 60 September 2000Obsoletes: 2197Category: Standards TrackSMTP Service Extension for Command PipeliningStatus of this MemoThis document specifies an Internet standards track protocol for theInternet community, and requests discussion and suggestions forimprovements. Please refer to the current edition of the "InternetOfficial Protocol Standards" (STD 1) for the standardization stateand status of this protocol. Distribution of this memo is unlimited.Copyright NoticeCopyright (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 itsability to accept multiple commands in a single Transmission ControlProtocol (TCP) send operation. Using a single TCP send operation formultiple commands can improve SMTP performance significantly.1. IntroductionAlthough SMTP is widely and robustly deployed, certain extensions maynevertheless prove useful. In particular, many parts of the Internetmake use of high latency network links. SMTP's intrinsic onecommand-one response structure is significantly penalized by highlatency links, often to the point where the factors contributing tooverall connection time are dominated by the time spent waiting forresponses to individual commands (turnaround time).In the best of all worlds it would be possible to simply deploy SMTPclient software that makes use of command pipelining: batching upmultiple commands into single TCP send operations. Unfortunately, theoriginal SMTP specification [RFC-821] did not explicitly state thatSMTP servers must support this. As a result a non-trivial number ofInternet SMTP servers cannot adequately handle command pipelining.Flaws known to exist in deployed servers include:Freed Standards Track [Page 1]RFC 2920 SMTP for Command Pipelining September 2000(1) Connection handoff and buffer flushes in the middle of theSMTP dialogue. Creation of server processes for incoming SMTPconnections is a useful, obvious, and harmless implementationtechnique. However, some SMTP servers defer process forkingand connection handoff until some intermediate point in theSMTP dialogue. When this is done material read from the TCPconnection and kept in process buffers can be lost.(2) Flushing the TCP input buffer when an SMTP command fails. SMTPcommands often fail but there is no reason to flush the TCPinput buffer when this happens. Nevertheless, some SMTPservers do this.(3) Improper processing and promulgation of SMTP command failures.For example, some SMTP servers will refuse to accept a DATAcommand if the last RCPT TO command fails, paying no attentionto the success or failure of prior RCPT TO command results.Other servers will accept a DATA command even when allprevious RCPT TO commands have failed. Although it is possibleto accommodate this sort of behavior in a client that employscommand pipelining, it does complicate the construction of theclient unnecessarily.This memo uses the mechanism described in [RFC-1869] to define anextension to the SMTP service whereby an SMTP server can declare thatit is capable of handling pipelined commands. The SMTP client canthen check for this declaration and use pipelining only when theserver declares itself capable of handling it.1.1. Requirements NotationThis document occasionally uses terms that appear in capital letters.When the terms "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"appear capitalized, they are being used to indicate particularrequirements of this specification. A discussion of the meanings ofthe terms "MUST", "SHOULD", and "MAY" appears in [RFC-1123]; theterms "MUST NOT" and "SHOULD NOT" are logical extensions of thisusage.2. Framework for the Command Pipelining ExtensionThe Command Pipelining extension is defined as follows:(1) the name of the SMTP service extension is Pipelining;(2) the EHLO keyword value associated with the extension isPIPELINING;Freed Standards Track [Page 2]RFC 2920 SMTP for Command Pipelining September 2000(3) no parameter is used with the PIPELINING EHLO keyword;(4) no additional parameters are added to either the MAIL FROM orRCPT TO commands.(5) no additional SMTP verbs are defined by this extension; and,(6) the next section specifies how support for the extensionaffects the behavior of a server and client SMTP.3. The Pipelining Service ExtensionWhen a client SMTP wishes to employ command pipelining, it firstissues the EHLO command to the server SMTP. If the server SMTPresponds with code 250 to the EHLO command, and the response includesthe EHLO keyword value PIPELINING, then the server SMTP has indicatedthat it can accommodate SMTP command pipelining.3.1. Client use of pipeliningOnce the client SMTP has confirmed that support exists for thepipelining extension, the client SMTP may then elect to transmitgroups of SMTP commands in batches without waiting for a response toeach individual command. In particular, the commands RSET, MAIL FROM,SEND FROM, SOML FROM, SAML FROM, and RCPT TO can all appear anywherein a pipelined command group. The EHLO, DATA, VRFY, EXPN, TURN,QUIT, and NOOP commands can only appear as the last command in agroup since their success or failure produces a change of state whichthe client SMTP must accommodate. (NOOP is included in this group soit can be used as a synchronization point.)Additional commands added by other SMTP extensions may only appear asthe last command in a group unless otherwise specified by theextensions that define the commands.The actual transfer of message content is explicitly allowed to bethe first "command" in a group. That is, a RSET/MAIL FROM sequenceused to initiate a new message transaction can be placed in the samegroup as the final transfer of the headers and body of the previousmessage.Client SMTP implementations that employ pipelining MUST check ALLstatuses associated with each command in a group. For example, ifnone of the RCPT TO recipient addresses were accepted the client mustthen check the response to the DATA command -- the client cannotassume that the DATA command will be rejected just because none ofthe RCPT TO commands worked. If the DATA command was properlyrejected the client SMTP can just issue RSET, but if the DATA commandFreed Standards Track [Page 3]RFC 2920 SMTP for Command Pipelining September 2000was accepted the client SMTP should send a single dot.Command statuses MUST be coordinated with responses by counting eachseparate response and correlating that count with the number ofcommands known to have been issued. Multiline responses MUST besupported. Matching on the basis of either the error code value orassociated text is expressly forbidden.Client SMTP implementations MAY elect to operate in a nonblockingfashion, processing server responses immediately upon receipt, evenif there is still data pending transmission from the client'sprevious TCP send operation. If nonblocking operation is notsupported, however, client SMTP implementations MUST also check theTCP window size and make sure that each group of commands fitsentirely within the window. The window size is usually, but notalways, 4K octets. Failure to perform this check can lead todeadlock conditions.Clients MUST NOT confuse responses to multiple commands withmultiline responses. Each command requires one or more lines ofresponse, the last line not containing a dash between the responsecode and the response string.3.2. Server support of pipeliningA server SMTP implementation that offers the pipelining extension:(1) MUST respond to commands in the order they are received fromthe client.(2) SHOULD elect to store responses to grouped RSET, MAIL FROM,SEND FROM, SOML FROM, SAML FROM, and RCPT TO commands in aninternal buffer so they can sent as a unit.(3) SHOULD issue a positive response to the DATA command if andonly if one or more valid RCPT TO addresses have beenpreviously received.(4) MUST NOT, after issuing a positive response to a DATA commandwith no valid recipients and subsequently receiving an emptymessage, send any message whatsoever to anybody.(5) MUST NOT buffer responses to EHLO, DATA, VRFY, EXPN, TURN,QUIT, and NOOP.(6) MUST NOT buffer responses to unrecognized commands.Freed Standards Track [Page 4]RFC 2920 SMTP for Command Pipelining September 2000(7) MUST send all pending responses immediately whenever the localTCP input buffer is emptied.(8) MUST NOT make assumptions about commands that are yet to bereceived.(9) MUST NOT flush or otherwise lose the contents of the TCP inputbuffer under any circumstances whatsoever.(10) SHOULD issue response text that indicates, either implicitlyor explicitly, what command the response matches.The overriding intent of these server requirements is to make it aseasy as possible for servers to conform to these pipeliningextensions.4. ExamplesConsider the following SMTP dialogue that does not use pipelining:S: C: S: 220 Innosoft.com SMTP service readyC: HELO dbc.mtview.ca.usS: 250 Innosoft.comC: MAIL FROM:S: 250 sender OKC: RCPT TO:S: 250 recipient OKC: RCPT TO:S: 250 recipient OKC: RCPT TO:S: 250 recipient OKC: DATAS: 354 enter mail, end with line containing only "."...C: .S: 250 message sentC: QUITS: 221 goodbyeThe client waits for a server response a total of 9 times in thissimple example. But if pipelining is employed the following dialogueis possible:S: C: S: 220 innosoft.com SMTP service readyFreed Standards Track [Page 5]RFC 2920 SMTP for Command Pipelining September 2000C: EHLO dbc.mtview.ca.usS: 250-innosoft.comS: 250 PIPELININGC: MAIL FROM:C: RCPT TO:C: RCPT TO:C: RCPT TO:C: DATAS: 250 sender OKS: 250 recipient OKS: 250 recipient OKS: 250 recipient OKS: 354 enter mail, end with line containing only "."...C: .C: QUITS: 250 message sentS: 221 goodbyeThe total number of turnarounds has been reduced from 9 to 4.The next example illustrates one possible form of behavior whenpipelining is used and all recipients are rejected:S: C: S: 220 innosoft.com SMTP service readyC: EHLO dbc.mtview.ca.usS: 250-innosoft.comS: 250 PIPELININGC: MAIL FROM:C: RCPT TO:C: RCPT TO:C: DATAS: 250 sender OKS: 550 remote mail to not allowedS: 550 remote mail to not allowedS: 554 no valid recipients givenC: QUITS: 221 goodbyeThe client SMTP waits for the server 4 times here as well. If theserver SMTP does not check for at least one valid recipient prior toaccepting the DATA command, the following dialogue would result:S: C: S: 220 innosoft.com SMTP service readyFreed Standards Track [Page 6]RFC 2920 SMTP for Command Pipelining September 2000C: EHLO dbc.mtview.ca.usS: 250-innosoft.comS: 250 PIPELININGC: MAIL FROM:C: RCPT TO:C: RCPT TO:C: DATAS: 250 sender OKS: 550 remote mail to not allowedS: 550 remote mail to not allowedS: 354 enter mail, end with line containing only "."C: .C: QUITS: 554 no valid recipientsS: 221 goodbye5. Security ConsiderationsThis RFC does not discuss security issues and is not believedto raise any security issues not endemic in electronic mailand present in fully conforming implementations of [RFC-821].6. AcknowledgementsThis document is based on the SMTP service extension modelpresented in RFC 1425. Marshall Rose's description of SMTPcommand pipelining in his book "The Internet Message" alsoserved as a source of inspiration for this extension.7. References[RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC821, 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 CommandPipelining", 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 CommandPipelining", RFC 2197, September 1997.Freed Standards Track [Page 7]RFC 2920 SMTP for Command Pipelining September 20008. Author's AddressNed FreedInnosoft International, Inc.1050 Lakes DriveWest Covina, CA 91790USAPhone: +1 626 919 3600Fax: +1 626 919 361EMail: ned.freed@innosoft.comThis document is a product of work done by the Internet EngineeringTask Force Working Group on Messaging Extensions, Alan Cargille,chair.Freed Standards Track [Page 8]RFC 2920 SMTP for Command Pipelining September 20009. Full Copyright StatementCopyright (C) The Internet Society (2000). All Rights Reserved.This document and translations of it may be copied and furnished toothers, and derivative works that comment on or otherwise explain itor assist in its implementation may be prepared, copied, publishedand distributed, in whole or in part, without restriction of anykind, provided that the above copyright notice and this paragraph areincluded on all such copies and derivative works. However, thisdocument itself may not be modified in any way, such as by removingthe copyright notice or references to the Internet Society or otherInternet organizations, except as needed for the purpose ofdeveloping Internet standards in which case the procedures forcopyrights defined in the Internet Standards process must befollowed, or as required to translate it into languages other thanEnglish.The limited permissions granted above are perpetual and will not berevoked by the Internet Society or its successors or assigns.This document and the information contained herein is provided on an"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERINGTASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDINGBUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATIONHEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OFMERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.AcknowledgementFunding for the RFC Editor function is currently provided by theInternet Society.Freed Standards Track [Page 9]