home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1800s / rfc1854.txt < prev    next >
Text File  |  1995-10-02  |  14KB  |  396 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                           N. Freed
  8. Request For Comments: 1854                  Innosoft International, Inc.
  9. Category: Standards Track                          A. Cargille, WG Chair
  10.                                                             October 1995
  11.  
  12.  
  13.                          SMTP Service Extension
  14.                          for Command Pipelining
  15.  
  16. Status of this Memo
  17.  
  18.    This document specifies an Internet standards track protocol for the
  19.    Internet community, and requests discussion and suggestions for
  20.    improvements.  Please refer to the current edition of the "Internet
  21.    Official Protocol Standards" (STD 1) for the standardization state
  22.    and status of this protocol.  Distribution of this memo is unlimited.
  23.  
  24. Abstract
  25.  
  26.    This memo defines an extension to the SMTP service whereby a server
  27.    can indicate the extent of its ability to accept multiple commands in
  28.    a single TCP send operation. Using a single TCP send operation for
  29.    multiple commands can improve SMTP performance significantly.
  30.  
  31. Introduction
  32.  
  33.    Although SMTP is widely and robustly deployed, certain extensions may
  34.    nevertheless prove useful. In particular, many parts of the Internet
  35.    make use of high latency network links.
  36.  
  37.    SMTP's intrinsic one command-one response structure is significantly
  38.    penalized by high latency links, often to the point where the factors
  39.    contributing to overall connection time are dominated by the time
  40.    spent waiting for responses to individual commands (turnaround time).
  41.  
  42.    In the best of all worlds it would be possible to simply deploy SMTP
  43.    client software that makes use of command pipelining: batching up
  44.    multiple commands into single TCP send operations. Unfortunately, the
  45.    original SMTP specification [1] did not explicitly state that SMTP
  46.    servers must support this.  As a result a non-trivial number of
  47.    Internet SMTP servers cannot adequately handle command pipelining.
  48.    Flaws known to exist in deployed servers include:
  49.  
  50.  (1)   Connection handoff and buffer flushes in the middle of
  51.        the SMTP dialogue.  Creation of server processes for
  52.        incoming SMTP connections is a useful, obvious, and
  53.        harmless implementation technique. However, some SMTP
  54.        servers defer process forking and connection handoff
  55.  
  56.  
  57.  
  58. Freed & Cargille            Standards Track                     [Page 1]
  59.  
  60. RFC 1854                    SMTP Pipelining                 October 1995
  61.  
  62.  
  63.        until some intermediate point in the SMTP dialogue.
  64.        When this is done material read from the TCP connection
  65.        and kept in process buffers can be lost.
  66.  
  67.  (2)   Flushing the TCP input buffer when an SMTP command
  68.        fails. SMTP commands often fail but there is no reason
  69.        to flush the TCP input buffer when this happens.
  70.        Nevertheless, some SMTP servers do this.
  71.  
  72.  (3)   Improper processing and promulgation of SMTP command
  73.        failures. For example, some SMTP servers will refuse to
  74.        accept a DATA command if the last RCPT TO command
  75.        fails, paying no attention to the success or failure of
  76.        prior RCPT TO command results. Other servers will
  77.        accept a DATA command even when all previous RCPT TO
  78.        commands have failed. Although it is possible to
  79.        accommodate this sort of behavior in a client that
  80.        employs command pipelining, it does complicate the
  81.        construction of the client unnecessarily.
  82.  
  83.    This memo uses the mechanism described in [2] to define an extension
  84.    to the SMTP service whereby an SMTP server can declare that it is
  85.    capable of handling pipelined commands. The SMTP client can then
  86.    check for this declaration and use pipelining only when the server
  87.    declares itself capable of handling it.
  88.  
  89. 1.  Framework for the Command Pipelining Extension
  90.  
  91.    The Command Pipelining extension is defined as follows:
  92.  
  93.     (1)   the name of the SMTP service extension is Pipelining;
  94.  
  95.     (2)   the EHLO keyword value associated with the extension is
  96.           PIPELINING;
  97.  
  98.     (3)   no parameter is used with the PIPELINING EHLO keyword;
  99.  
  100.     (4)   no additional parameters are added to either the MAIL
  101.           FROM or RCPT TO commands.
  102.  
  103.     (5)   no additional SMTP verbs are defined by this extension;
  104.           and,
  105.  
  106.     (6)   the next section specifies how support for the
  107.           extension affects the behavior of a server and client
  108.           SMTP.
  109.  
  110.  
  111.  
  112.  
  113.  
  114. Freed & Cargille            Standards Track                     [Page 2]
  115.  
  116. RFC 1854                    SMTP Pipelining                 October 1995
  117.  
  118.  
  119. 2.  The Pipelining Service Extension
  120.  
  121.    When a client SMTP wishes to employ command pipelining, it first
  122.    issues the EHLO command to the server SMTP. If the server SMTP
  123.    responds with code 250 to the EHLO command, and the response includes
  124.    the EHLO keyword value PIPELINING, then the server SMTP has indicated
  125.    that it can accommodate SMTP command pipelining.
  126.  
  127. 2.1.  Client use of pipelining
  128.  
  129.    Once the client SMTP has confirmed that support exists for the
  130.    pipelining extension, the client SMTP may then elect to transmit
  131.    groups of SMTP commands in batches without waiting for a response to
  132.    each individual command. In particular, the commands RSET, MAIL FROM,
  133.    SEND FROM, SOML FROM, SAML FROM, and RCPT TO can all appear anywhere
  134.    in a pipelined command group.  The EHLO, DATA, VRFY, EXPN, TURN,
  135.    QUIT, and NOOP commands can only appear as the last command in a
  136.    group since their success or failure produces a change of state which
  137.    the client SMTP must accommodate. (NOOP is included in this group so
  138.    it can be used as a synchronization point.)
  139.  
  140.    Additional commands added by other SMTP extensions may only appear as
  141.    the last command in a group unless otherwise specified by the
  142.    extensions that define the commands.
  143.  
  144.    The actual transfer of message content is explicitly allowed to be
  145.    the first "command" in a group. That is, the RSET/MAIL FROM sequence
  146.    necessary to initiate a new message transaction can be placed in the
  147.    same group as the final transfer of the headers and body of the
  148.    previous message.
  149.  
  150.    Client SMTP implementations that employ pipelining MUST check ALL
  151.    statuses associated with each command in a group. For example, if
  152.    none of the RCPT TO recipient addresses were accepted the client must
  153.    then check the response to the DATA command -- the client cannot
  154.    assume that the DATA command will be rejected just because none of
  155.    the RCPT TO commands worked.  If the DATA command was properly
  156.    rejected the client SMTP can just issue RSET, but if the DATA command
  157.    was accepted the client SMTP should send a single dot.
  158.  
  159.    Command statuses MUST be coordinated with responses by counting each
  160.    separate response and correlating that count with the number of
  161.    commands known to have been issued.  Multiline responses MUST be
  162.    supported. Matching on the basis of either the error code value or
  163.    associated text is expressly forbidden.
  164.  
  165.    Client SMTP implementations MAY elect to operate in a nonblocking
  166.    fashion, processing server responses immediately upon receipt, even
  167.  
  168.  
  169.  
  170. Freed & Cargille            Standards Track                     [Page 3]
  171.  
  172. RFC 1854                    SMTP Pipelining                 October 1995
  173.  
  174.  
  175.    if there is still data pending transmission from the client's
  176.    previous TCP send operation. If nonblocking operation is not
  177.    supported, however, client SMTP implementations MUST also check the
  178.    TCP window size and make sure that each group of commands fits
  179.    entirely within the window. The window size is usually, but not
  180.    always, 4K octets.  Failure to perform this check can lead to
  181.    deadlock conditions.
  182.  
  183.    Clients MUST NOT confuse responses to multiple commands with
  184.    multiline responses. Each command requires one or more lines of
  185.    response, the last line not containing a dash between the response
  186.    code and the response string.
  187.  
  188. 2.2.  Server support of pipelining
  189.  
  190.    A server SMTP implementation that offers the pipelining extension:
  191.  
  192.     (1)   MUST NOT flush or otherwise lose the contents of the
  193.           TCP input buffer under any circumstances whatsoever.
  194.  
  195.     (2)   SHOULD issue a positive response to the DATA command if
  196.           and only if one or more valid RCPT TO addresses have
  197.           been previously received.
  198.  
  199.     (3)   MUST NOT, after issuing a positive response to a DATA
  200.           command with no valid recipients and subsequently
  201.           receiving an empty message, send any message whatsoever
  202.           to anybody.
  203.  
  204.     (4)   SHOULD elect to store responses to grouped RSET, MAIL
  205.           FROM, SEND FROM, SOML FROM, SAML FROM, and RCPT TO
  206.           commands in an internal buffer so they can sent as a
  207.           unit.
  208.  
  209.     (5)   MUST NOT buffer responses to EHLO, DATA, VRFY, EXPN,
  210.           TURN, QUIT, and NOOP.
  211.  
  212.     (6)   MUST NOT buffer responses to unrecognized commands.
  213.  
  214.     (7)   MUST send all pending responses immediately whenever
  215.           the local TCP input buffer is emptied.
  216.  
  217.     (8)   MUST NOT make assumptions about commands that are yet
  218.           to be received.
  219.  
  220.     (9)   SHOULD issue response text that indicates, either
  221.           implicitly or explicitly, what command the response
  222.           matches.
  223.  
  224.  
  225.  
  226. Freed & Cargille            Standards Track                     [Page 4]
  227.  
  228. RFC 1854                    SMTP Pipelining                 October 1995
  229.  
  230.  
  231.    The overriding intent of these server requirements is to make it as
  232.    easy as possible for servers to conform to these pipelining
  233.    extensions.
  234.  
  235. 3.  Examples
  236.  
  237.    Consider the following SMTP dialogue that does not use pipelining:
  238.  
  239.    S: <wait for open connection>
  240.    C: <open connection to server>
  241.    S: 220 innosoft.com SMTP service ready
  242.    C: HELO dbc.mtview.ca.us
  243.    S: 250 innosoft.com
  244.    C: MAIL FROM:<mrose@dbc.mtview.ca.us>
  245.    S: 250 sender <mrose@dbc.mtview.ca.us> OK
  246.    C: RCPT TO:<ned@innosoft.com>
  247.    S: 250 recipient <ned@innosoft.com> OK
  248.    C: RCPT TO:<dan@innosoft.com>
  249.    S: 250 recipient <dan@innosoft.com> OK
  250.    C: RCPT TO:<kvc@innosoft.com>
  251.    S: 250 recipient <kvc@innosoft.com> OK
  252.    C: DATA
  253.    S: 354 enter mail, end with line containing only "."
  254.     ...
  255.    C: .
  256.    S: 250 message sent
  257.    C: QUIT
  258.    S: 221 goodbye
  259.  
  260.    The client waits for a server response a total of 9 times in this
  261.    simple example. But if pipelining is employed the following dialogue
  262.    is possible:
  263.  
  264.    S: <wait for open connection>
  265.    C: <open connection to server>
  266.    S: 220 innosoft.com SMTP service ready
  267.    C: EHLO dbc.mtview.ca.us
  268.    S: 250-innosoft.com
  269.    S: 250 PIPELINING
  270.    C: MAIL FROM:<mrose@dbc.mtview.ca.us>
  271.    C: RCPT TO:<ned@innosoft.com>
  272.    C: RCPT TO:<dan@innosoft.com>
  273.    C: RCPT TO:<kvc@innosoft.com>
  274.    C: DATA
  275.    S: 250 sender <mrose@dbc.mtview.ca.us> OK
  276.    S: 250 recipient <ned@innosoft.com> OK
  277.    S: 250 recipient <dan@innosoft.com> OK
  278.    S: 250 recipient <kvc@innosoft.com> OK
  279.  
  280.  
  281.  
  282. Freed & Cargille            Standards Track                     [Page 5]
  283.  
  284. RFC 1854                    SMTP Pipelining                 October 1995
  285.  
  286.  
  287.    S: 354 enter mail, end with line containing only "."
  288.     ...
  289.    C: .
  290.    C: QUIT
  291.    S: 250 message sent
  292.    S: 221 goodbye
  293.  
  294.    The total number of turnarounds has been reduced from 9 to 4.
  295.  
  296.    The next example illustrates one possible form of behavior when
  297.    pipelining is used and all recipients are rejected:
  298.  
  299.    S: <wait for open connection>
  300.    C: <open connection to server>
  301.    S: 220 innosoft.com SMTP service ready
  302.    C: EHLO dbc.mtview.ca.us
  303.    S: 250-innosoft.com
  304.    S: 250 PIPELINING
  305.    C: MAIL FROM:<mrose@dbc.mtview.ca.us>
  306.    C: RCPT TO:<nsb@thumper.bellcore.com>
  307.    C: RCPT TO:<galvin@tis.com>
  308.    C: DATA
  309.    S: 250 sender <mrose@dbc.mtview.ca.us> OK
  310.    S: 550 remote mail to <nsb@thumper.bellore.com> not allowed
  311.    S: 550 remote mail to <galvin@tis.com> not allowed
  312.    S: 554 no valid recipients given
  313.    C: QUIT
  314.    S: 221 goodbye
  315.  
  316.    The client SMTP waits for the server 4 times here as well. If the
  317.    server SMTP does not check for at least one valid recipient prior to
  318.    accepting the DATA command, the following dialogue would result:
  319.  
  320.    S: <wait for open connection>
  321.    C: <open connection to server>
  322.    S: 220 innosoft.com SMTP service ready
  323.    C: EHLO dbc.mtview.ca.us
  324.    S: 250-innosoft.com
  325.    S: 250 PIPELINING
  326.    C: MAIL FROM:<mrose@dbc.mtview.ca.us>
  327.    C: RCPT TO:<nsb@thumper.bellcore.com>
  328.    C: RCPT TO:<galvin@tis.com>
  329.    C: DATA
  330.    S: 250 sender <mrose@dbc.mtview.ca.us> OK
  331.    S: 550 remote mail to <nsb@thumper.bellore.com> not allowed
  332.    S: 550 remote mail to <galvin@tis.com> not allowed
  333.    S: 354 enter mail, end with line containing only "."
  334.    C: .
  335.  
  336.  
  337.  
  338. Freed & Cargille            Standards Track                     [Page 6]
  339.  
  340. RFC 1854                    SMTP Pipelining                 October 1995
  341.  
  342.  
  343.    C: QUIT
  344.    S: 554 no valid recipients
  345.    S: 221 goodbye
  346.  
  347. 4.  Security Considerations
  348.  
  349.    This RFC does not discuss security issues and is not believed to
  350.    raise any security issues not endemic in electronic mail and present
  351.    in fully conforming implementations of [1].
  352.  
  353. 5.  Acknowledgements
  354.  
  355.    This document is based on the SMTP service extension model presented
  356.    in RFC 1425. Marshall Rose's description of SMTP command pipelining
  357.    in his book "The Internet Message" also served as a source of
  358.    inspiration for this extension.
  359.  
  360. 6.  References
  361.  
  362.    [1]  Postel, J., "Simple Mail Transfer Protocol", STD 10
  363.         RFC 821, USC/Information Sciences Institute, August
  364.         1982.
  365.  
  366.    [2]  Klensin, J., Freed, N., Rose, M., Stefferud, E.,
  367.         and D. Crocker, "SMTP Service Extensions", RFC 1651,
  368.         MCI, Innosoft, Dover Beach Consulting, Inc.,
  369.         Network Management Associates, Inc., Silicon Graphics,
  370.         Inc., July 1994.
  371.  
  372. 7.  Author's Address
  373.  
  374.    Ned Freed
  375.    Innosoft International, Inc.
  376.    1050 East Garvey Avenue South
  377.    West Covina, CA 91790
  378.    USA
  379.  
  380.    Phone: +1 818 919 3600
  381.    Fax: +1 818 919 3614
  382.    EMail: ned@innosoft.com
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Freed & Cargille            Standards Track                     [Page 7]
  395.  
  396.