[Imap-protocol] literal usage

Mark Crispin MRC at CAC.Washington.EDU
Tue Mar 20 12:48:13 PDT 2007


On Tue, 20 Mar 2007, Bill Janssen wrote:
>> As a general rule, one (and only one) space separates tokens in IMAP.
> In my server implementation, I tried to follow the old rule of "be
> liberal in what you accept, and strict in what you provide."  So
> though arguments to IMAP commands are strictly speaking separated by
> exactly one space, I accept any run of whitespace in place of that
> single space.  I'm speaking only of top-level arguments to a command,
> of course.

Although the practice you describe is relatively common, there are cases 
(SASL comes to mind) in which spaces are highly significant.

I generally agree with what Lyndon said; however to avoid a "pot, kettle, 
black" (or is it, "do what I say, not what I do"?) I assert that there is 
a difference, in cases where one and only one space is called for, 
between:
  . accepting a run of spaces because it was easier to code that way (e.g.,
    something quick & dirty like strtok()).
  . going to extra effort to accept a run of spaces.
In the former case, you aren't actively enforcing every possible aspect of 
syntax; in the latter case, you're deliberately allowing a violation.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


More information about the Imap-protocol mailing list