Page MenuHomePhabricator

Drop empty inbound mail at the beginning of the receive workflow, not inside object handlers

Authored by epriestley on Jan 3 2019, 2:28 PM.



Ref T920. Ref T7477. We currently drop empty mail only once it reaches the ReplyHandler layer.

I think no plausible receiver can ever do anything useful with this kind of mail, so we can safely drop it earlier and simplify some of the logic. After T7477, we'd end up throwing multiple exceptions if you sent empty mail to several valid receivers.

(I also want to move away from APIs oriented around raw addresses in more specialized layers, and this is one of the few callsites for raw mail address information.)

This requires updating some unit tests to actually have message bodies, since they failed with this error before hitting the other errors otherwise.

Test Plan

Used bin/mail receive-test to send empty mail, got appropriate "err:empty" out of it.

Diff Detail

rP Phabricator
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Jan 3 2019, 2:28 PM
Harbormaster returned this revision to the author for changes because remote builds failed.Jan 3 2019, 2:29 PM
Harbormaster failed remote builds in B21471: Diff 47618!
epriestley updated this revision to Diff 47619.Jan 3 2019, 3:49 PM
  • Fix more unit tests, including a "TODO" from May 2013!
epriestley requested review of this revision.Jan 3 2019, 3:50 PM
amckinley accepted this revision.Jan 3 2019, 8:35 PM
This revision is now accepted and ready to land.Jan 3 2019, 8:35 PM
This revision was automatically updated to reflect the committed changes.