1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
|
<pre>Network Working Group N. Freed
Request for Comments: 2920 Innosoft
STD: 60 September 2000
Obsoletes: <a href="./rfc2197">2197</a>
Category: Standards Track
<span class="h1">SMTP Service Extension for Command Pipelining</span>
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.
Abstract
This 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.
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
Although SMTP is widely and robustly deployed, certain extensions may
nevertheless prove useful. In particular, many parts of the Internet
make use of high latency network links. SMTP's intrinsic one
command-one response structure is significantly penalized by high
latency links, often to the point where the factors contributing to
overall connection time are dominated by the time spent waiting for
responses to individual commands (turnaround time).
In the best of all worlds it would be possible to simply deploy SMTP
client software that makes use of command pipelining: batching up
multiple commands into single TCP send operations. Unfortunately, the
original SMTP specification [<a href="./rfc821" title=""Simple Mail Transfer Protocol"">RFC-821</a>] 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:
<span class="grey">Freed Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
(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 [<a href="./rfc1869" title=""SMTP Service Extensions"">RFC-1869</a>] 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.
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Requirements Notation</span>
This 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 particular
requirements of this specification. A discussion of the meanings of
the terms "MUST", "SHOULD", and "MAY" appears in [<a href="./rfc1123" title=""Requirements for Internet Hosts -- Application and Support"">RFC-1123</a>]; the
terms "MUST NOT" and "SHOULD NOT" are logical extensions of this
usage.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Framework for the Command Pipelining Extension</span>
The 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 is
PIPELINING;
<span class="grey">Freed Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
(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.
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. The Pipelining Service Extension</span>
When a client SMTP wishes to employ command pipelining, it first
issues the EHLO command to the server SMTP. If the server SMTP
responds with code 250 to the EHLO command, and the response includes
the EHLO keyword value PIPELINING, then the server SMTP has indicated
that it can accommodate SMTP command pipelining.
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Client use of pipelining</span>
Once the client SMTP has confirmed that support exists for the
pipelining extension, the client SMTP may then elect to transmit
groups of SMTP commands in batches without waiting for a response to
each individual command. In particular, the commands RSET, MAIL FROM,
SEND FROM, SOML FROM, SAML FROM, and RCPT TO can all appear anywhere
in a pipelined command group. The EHLO, DATA, VRFY, EXPN, TURN,
QUIT, and NOOP commands can only appear as the last command in a
group since their success or failure produces a change of state which
the client SMTP must accommodate. (NOOP is included in this group so
it can be used as a synchronization point.)
Additional commands added by other SMTP extensions may only appear as
the last command in a group unless otherwise specified by the
extensions that define the commands.
The actual transfer of message content is explicitly allowed to be
the first "command" in a group. That is, a RSET/MAIL FROM sequence
used to initiate a new message transaction can be placed in the same
group as the final transfer of the headers and body of the previous
message.
Client SMTP implementations that employ pipelining MUST check ALL
statuses associated with each command in a group. For example, if
none of the RCPT TO recipient addresses were accepted the client must
then check the response to the DATA command -- the client cannot
assume that the DATA command will be rejected just because none of
the RCPT TO commands worked. If the DATA command was properly
rejected the client SMTP can just issue RSET, but if the DATA command
<span class="grey">Freed Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
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.
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Server support of pipelining</span>
A server SMTP implementation that offers the pipelining extension:
(1) MUST respond to commands in the order they are received from
the client.
(2) SHOULD elect to store responses to grouped RSET, MAIL FROM,
SEND FROM, SOML FROM, SAML FROM, and RCPT TO commands in an
internal buffer so they can sent as a unit.
(3) SHOULD issue a positive response to the DATA command if and
only if one or more valid RCPT TO addresses have been
previously received.
(4) MUST NOT, after issuing a positive response to a DATA command
with no valid recipients and subsequently receiving an empty
message, 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.
<span class="grey">Freed Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
(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.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Examples</span>
Consider the following SMTP dialogue that does not use pipelining:
S: <wait for open connection>
C: <open connection to server>
S: 220 Innosoft.com SMTP service ready
C: HELO dbc.mtview.ca.us
S: 250 Innosoft.com
C: MAIL FROM:<mrose@dbc.mtview.ca.us>
S: 250 sender <mrose@dbc.mtview.ca.us> OK
C: RCPT TO:<ned@innosoft.com>
S: 250 recipient <ned@innosoft.com> OK
C: RCPT TO:<dan@innosoft.com>
S: 250 recipient <dan@innosoft.com> OK
C: RCPT TO:<kvc@innosoft.com>
S: 250 recipient <kvc@innosoft.com> OK
C: DATA
S: 354 enter mail, end with line containing only "."
...
C: .
S: 250 message sent
C: QUIT
S: 221 goodbye
The client waits for a server response a total of 9 times in this
simple example. But if pipelining is employed the following dialogue
is possible:
S: <wait for open connection>
C: <open connection to server>
S: 220 innosoft.com SMTP service ready
<span class="grey">Freed Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
C: EHLO dbc.mtview.ca.us
S: 250-innosoft.com
S: 250 PIPELINING
C: MAIL FROM:<mrose@dbc.mtview.ca.us>
C: RCPT TO:<ned@innosoft.com>
C: RCPT TO:<dan@innosoft.com>
C: RCPT TO:<kvc@innosoft.com>
C: DATA
S: 250 sender <mrose@dbc.mtview.ca.us> OK
S: 250 recipient <ned@innosoft.com> OK
S: 250 recipient <dan@innosoft.com> OK
S: 250 recipient <kvc@innosoft.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:<mrose@dbc.mtview.ca.us>
C: RCPT TO:<nsb@thumper.bellcore.com>
C: RCPT TO:<galvin@tis.com>
C: DATA
S: 250 sender <mrose@dbc.mtview.ca.us> OK
S: 550 remote mail to <nsb@thumper.bellore.com> not allowed
S: 550 remote mail to <galvin@tis.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
<span class="grey">Freed Standards Track [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
C: EHLO dbc.mtview.ca.us
S: 250-innosoft.com
S: 250 PIPELINING
C: MAIL FROM:<mrose@dbc.mtview.ca.us>
C: RCPT TO:<nsb@thumper.bellcore.com>
C: RCPT TO:<galvin@tis.com>
C: DATA
S: 250 sender <mrose@dbc.mtview.ca.us> OK
S: 550 remote mail to <nsb@thumper.bellore.com> not allowed
S: 550 remote mail to <galvin@tis.com> not allowed
S: 354 enter mail, end with line containing only "."
C: .
C: QUIT
S: 554 no valid recipients
S: 221 goodbye
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Security Considerations</span>
This RFC does not discuss security issues and is not believed
to raise any security issues not endemic in electronic mail
and present in fully conforming implementations of [<a href="./rfc821" title=""Simple Mail Transfer Protocol"">RFC-821</a>].
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Acknowledgements</span>
This document is based on the SMTP service extension model
presented in <a href="./rfc1425">RFC 1425</a>. Marshall Rose's description of SMTP
command pipelining in his book "The Internet Message" also
served as a source of inspiration for this extension.
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. References</span>
[<a id="ref-RFC-821">RFC-821</a>] Postel, J., "Simple Mail Transfer Protocol", STD 10, <a href="./rfc821">RFC</a>
<a href="./rfc821">821</a>, August 1982.
[<a id="ref-RFC-1123">RFC-1123</a>] Braden, R., "Requirements for Internet Hosts --
Application and Support", STD 3, <a href="./rfc1123">RFC 1123</a>, October, 1989.
[<a id="ref-RFC-1854">RFC-1854</a>] Freed, N., "SMTP Service Extension for Command
Pipelining", <a href="./rfc1854">RFC 1854</a>, October 1995.
[<a id="ref-RFC-1869">RFC-1869</a>] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D.
Crocker, "SMTP Service Extensions", STD 10, <a href="./rfc1869">RFC 1869</a>,
November 1995.
[<a id="ref-RFC-2197">RFC-2197</a>] Freed, N., "SMTP Service Extension for Command
Pipelining", <a href="./rfc2197">RFC 2197</a>, September 1997.
<span class="grey">Freed Standards Track [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Author's Address</span>
Ned Freed
Innosoft International, Inc.
1050 Lakes Drive
West Covina, CA 91790
USA
Phone: +1 626 919 3600
Fax: +1 626 919 361
EMail: ned.freed@innosoft.com
This document is a product of work done by the Internet Engineering
Task Force Working Group on Messaging Extensions, Alan Cargille,
chair.
<span class="grey">Freed Standards Track [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc2920">RFC 2920</a> SMTP for Command Pipelining September 2000</span>
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Full Copyright Statement</span>
Copyright (C) The Internet Society (2000). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked 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 ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
Freed Standards Track [Page 9]
</pre>
|