Re: [ietf-smtp] CHUNKING and PIPELINING

Viktor Dukhovni <ietf-dane@dukhovni.org> Mon, 08 March 2021 05:58 UTC

Return-Path: <ietf-dane@dukhovni.org>
X-Original-To: ietf-smtp@ietfa.amsl.com
Delivered-To: ietf-smtp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 74CC93A258B for <ietf-smtp@ietfa.amsl.com>; Sun, 7 Mar 2021 21:58:02 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zg0QJHt94lOq for <ietf-smtp@ietfa.amsl.com>; Sun, 7 Mar 2021 21:58:00 -0800 (PST)
Received: from straasha.imrryr.org (straasha.imrryr.org [100.2.39.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A79313A258D for <ietf-smtp@ietf.org>; Sun, 7 Mar 2021 21:58:00 -0800 (PST)
Received: from [192.168.1.177] (unknown [192.168.1.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by straasha.imrryr.org (Postfix) with ESMTPSA id 1758BC8E4D for <ietf-smtp@ietf.org>; Mon, 8 Mar 2021 00:57:59 -0500 (EST)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\))
From: Viktor Dukhovni <ietf-dane@dukhovni.org>
In-Reply-To: <01RWEGEP5NI8005PTU@mauve.mrochek.com>
Date: Mon, 08 Mar 2021 03:57:58 -0200
Content-Transfer-Encoding: quoted-printable
Reply-To: ietf-smtp@ietf.org
Message-Id: <290B287C-B5BB-442D-8B30-9EF42C34E33F@dukhovni.org>
References: <b1202e49-26b2-35d8-0db7-bb94acd0d52f@wizmail.org> <01RWCSPP4820005PTU@mauve.mrochek.com> <1AFA5DBF-325F-4943-BBE3-45311CC485CA@dukhovni.org> <01RWEGEP5NI8005PTU@mauve.mrochek.com>
To: ietf-smtp@ietf.org
X-Mailer: Apple Mail (2.3654.60.0.2.21)
Archived-At: <https://mailarchive.ietf.org/arch/msg/ietf-smtp/DxOAA2YnN9EwXETSwZ541Ppgjj8>
Subject: Re: [ietf-smtp] CHUNKING and PIPELINING
X-BeenThere: ietf-smtp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Discussion of issues related to Simple Mail Transfer Protocol \(SMTP\) \[RFC 821, RFC 2821, RFC 5321\]" <ietf-smtp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf-smtp>, <mailto:ietf-smtp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ietf-smtp/>
List-Post: <mailto:ietf-smtp@ietf.org>
List-Help: <mailto:ietf-smtp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf-smtp>, <mailto:ietf-smtp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 08 Mar 2021 05:58:02 -0000


> On Mar 8, 2021, at 2:31 AM, Ned Freed <ned.freed@mrochek.com> wrote:
> 
>> What Jeremy did not mention is that he's seeing interoperability
>> issues (reportedly with Google and IIRC Yahoo) when pipelining
>> "BDAT nnnn LAST<CRLF>QUIT<CRLF>".

Oops (I guess that was clear from context), I meant:

	BDAT nnnn LAST<CRLF>
	...<nnnn> bytes of data...
	QUIT<CRLF>

>> Did Google, et. al. not implement PIPELINING for BDAT correctly?
>> It is not (to me) entirely obvious from the spec.  The PIPELING
>> semantics should have been spelled out more clearly in 3030.
> 
> And the handling of invalid BDAT (especially the second example I gave) as
> well. But I think common sense is all you need to see that this should be OK
> and there's something wrong in Google-Yahoo-land.

That's certainly what I'd like to be the case, but I am not sure the
specification succeeds in making it clear.  The only example shows
QUIT sent separately:

   https://tools.ietf.org/html/rfc3030#section-4.2

   R: <wait for connection on TCP port
   S: <open connection to server>
   R: 220 cnri.reston.va.us SMTP service ready
   S: EHLO ymir.claremont.edu
   R: 250-cnri.reston.va.us says hello
   R: 250-PIPELINING
   R: 250-BINARYMIME
   R: 250 CHUNKING
   S: MAIL FROM:<ned@ymir.claremont.edu> BODY=BINARYMIME
   S: RCPT TO:<gvaudre@cnri.reston.va.us>
   S: RCPT TO:<jstewart@cnri.reston.va.us>
   R: 250 <ned@ymir.claremont.edu>... Sender and BINARYMIME ok
   R: 250 <gvaudre@cnri.reston.va.us>... Recipient ok
   R: 250 <jstewart@cnri.reston.va.us>... Recipient ok
   S: BDAT 100000
   S: (First 10000 octets of canonical MIME message data)
   S: BDAT 324
   S: (Remaining 324 octets of canonical MIME message data)
   S: BDAT 0 LAST
   R: 250 100000 octets received
   R: 250 324 octets received
   R: 250 Message OK, 100324 octets received
   S: QUIT
   R: 221 Goodbye

> Has anyone tried pipelining RSET after BDAT LAST, or QUIT after the trailing
> dot on a regular DATA on these servers? (Our client doesn't attempt any of this
> because we can't tell right away whether or not there's another message we want
> to send on this connection, so we don't know what command we're going to send
> next and we don't want to wait to find out.)

With plain old "DATA" (Postfix support CHUNKING only in the server role), Postfix
acting as a client always pipelines ".<CRLF>QUIT<CRLF>" and has no trouble with
Google or Yahoo.

[ Postfix only caches connections when there's a sufficient backlog
  for the same destination, so under "normal" conditions we know to
  close the connection right away. ]

So it seems it is specifically "BDAT LAST" + (ultimately) QUIT that
these providers are allergic to.

I take it there's at least agreement on this list that pipelining of
these is not definitely proscribed.  And perhaps even expected?  If
so, perhaps (unless they're already here) time to reach out to Google
et. al., though in the meantime a conservative implementation might
need to not enable pipelining after BDAT by default.

-- 
	Viktor.