ietf-822
[Top] [All Lists]

Re: quoted strings within quoted strings

2002-03-04 05:12:35

In <01KEUMXC96WE005KUQ(_at_)mauve(_dot_)mrochek(_dot_)com> 
ned+ietf-822(_at_)mrochek(_dot_)com writes:

So I think I have to write something like

sender-parameter = [CFWS] "sender" [CFWS] "=" [CFWS]
                      <a quoted-string containing an escaped mailbox> [CFWS]

where I have to define "escaped" in the proper (recursive) way, and
probably also an "unescaping" operation.

The MIME specification used to have per-parameter ABNF like this. The problem
is that this ABNF is inevitably at odds with the more general ABNF and ends up
being hugely confusing.

OK, the underlying problem is that you want to say that some
mumble-parameter is both a case of a general 'parameter' (as defined by
some syntax), and also has to satisfy some particular syntax of its own.

ABNF does not allow you to say that sort of thing directly, although you
CAN get the effect by saying 
        <a quoted-string containing an escaped mailbox> 
as I did above. I can see some benefit in both approaches, but note your
preference for not doing it that way.

And there is ample data to support this point. I received numerous queries and
complaints about the overlapping ABNF in the original MIME specification. Your
query is the first I've seen about this sort of thing since all this gratuitous
junk was removed from the MIME documents.

But I think to describe it as "gratuitous junk" is overdoing it :-) .


Anyway, now we are here, let me check whether I am putting the CFWS in the
right places, since in the post-2822 world all that stuff has to be put
explicitly in the syntax, and Usefor has to live in that world.

According to RFC 2822, we have

quoted-string = [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS]

so we are stuck with that.

Thus, following that style, we would have

token = [CFWS] 1*<any (US-ASCII) CHAR except SP, CTLs or tspecials> [CFWS]

(ignoring, for the moment, slight complications arising from x-token,
iana-token, etc.)

And then

value = token / quoted-string
attribute = token
parameter = attribute "=" value
Foo-header = "Foo" ":" <Foo specific stuff> [CFWS] *(";" parameter) [CFWS]

All of which boils down to saying 'you can put CFWS on either side of a
";" or on either side of an "="'.

Is that correct? AFAICS that is exactly what you get by reading RFC 2045,
and interpreting it according to the RFC 822 folding rules. Certainly,
that is the assumptions I am building into Usefor.


An alternative way would that I am toying with would be to say:

token = 1*<any (US-ASCII) CHAR except SP, CTLs or tspecials>
value = [CFWS] token [CFWS] / quoted-string
attribute = [CFWS] token [CFWS]

which says the same thing, but makes is easier to say, when introducing
some new parameter, 'the attribute token is "foobar"', or 'the value token
is "yes" or "no" (possibly quoted)', or to say 'IANA should register the
token "foobar"'. It also makes it easier to introduce x-token, iana-token,
etc. in the proper manner.

-- 
Charles H. Lindsey ---------At Home, doing my own thing------------------------
Tel: +44 161 436 6131 Fax: +44 161 436 6133   Web: http://www.cs.man.ac.uk/~chl
Email: chl(_at_)clw(_dot_)cs(_dot_)man(_dot_)ac(_dot_)uk      Snail: 5 
Clerewood Ave, CHEADLE, SK8 3JU, U.K.
PGP: 2C15F1A9      Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5