Subject: Re: [SIP] whitespace in SIP & SDP

From: [email-masked]
Date: Thu, 17 Aug 2000 15:05:06 +0530

SIP is lenient with LWSs.
So typically one or more LWSes between/before/after tokens should be
accepted.
So the white spaces acceptance of SIP is implicit .

From = {LWS}("From" | "f") ":" {LWS}(name-addr | addr-spec)
but that is typically assumed .

Hence you should be lenient in accepting this.

SDP however, afaik, is very strict on spaces, and does not follow the
leniency
attribute on SIP. Hence, any white space anywhere is explicitly stated and
deviations
are not encompassed.

Regds
Arjun

--
Arjun Roychowdhury @ Hughes Software Systems

[email-masked] on 08/17/2000 02:24:26 PM

To:   [email-masked]
cc:

Subject:  [SIP] whitespace in SIP & SDP

I have a query on the use of whitespace in SIP & SDP grammars.

There are these rules in SDP (rfc 2327):
--------------------------------------------------------------
   origin-field =        "o=" username SPACE
                         sess-id SPACE sess-version SPACE
                         nettype SPACE addrtype SPACE
                         addr CRLF

   email-address =       email "(" email-safe ")" | ...
--------------------------------------------------------------
which leads one to believe that space is allowed _only_ if
explicitly specified in the grammar.

But then there is this example in the rfc:
        e=[email-masked] (Mark Handley)
where there's a space between email & "(".

Similarly, in the SIP grammar (2543bis), there are these rules:
--------------------------------------------------------------
    Request-Line = Method SP Request-URI SP SIP-Version CRLF
    From = ("From" | "f") ":" (name-addr | addr-spec)
--------------------------------------------------------------
And yet, the torture tests have
    From   : "J Rosenberg \\\"" <sip:[email-masked]> ;

So, what is the right way to interpret the use of whitespace in the
grammar?
Should a parser be lenient with whitespace or should it stick to the
grammar?

Thanks.

_______________________________________________
SIP mailing list
[email-masked]
http://lists.bell-labs.com/mailman/listinfo/sip

_______________________________________________
SIP mailing list
[email-masked]
http://lists.bell-labs.com/mailman/listinfo/sip

---

From: [email-masked] (Richard Verhoeven)
Date: Thu, 17 Aug 2000 11:49:02 +0200 (MET DST)

> but that is typically assumed .

I assume you mean:

From = ("From" | "f") {LWS} ":" {LWS}(name-addr | addr-spec)

The possible LWS at the beginning of a line will be interpreted
as a continuation newline for the previous line in the message.

Richard Verhoeven.

---

From: Laurent Steffan <[email-masked]>
Date: Thu, 17 Aug 2000 12:28:04 +0200

I agree with Arjun's answer, and I'll even go a bit further: I think SIP's
leniency is expressed in the following statement -

"Except where noted otherwise, linear white space (LWS) can be included
between any two adjacent words (token or quoted-string), and between
adjacent tokens and separators, without changing the interpretation of a
field." (Appendix C),

and that means that as concerns SIP you can - and must - be lenient with the
whitespace *and* stick to the grammar :-)

As for SDP, part of the answer lies in the fact that rfc2327 claims that
"email" syntax is "defined in RFC822", and if you look up rfc 822 you'll see
that they have roughly the same statement as SIP regarding white space:

"To aid in the creation and reading of structured  fields,  the free
insertion of linear-white-space (which permits folding by inclusion of
CRLFs) is  allowed  between  lexical  tokens". In particular, '(' is an
RFC822 token (for comments) so you can consider, without stretching too much
the texts of the various RFCs, that the examples are indeed compliant with
the grammars of the respective fields.

Best regards,
Laurent Steffan

======== le 17/08/00 11:35, [email-masked] à [email-masked] a
écrit : ========

> attribute on SIP. Hence, any white space anywhere is explicitly stated and

=======================================================================
Laurent M. STEFFAN                          Tel : + 33 (0)1 55 91 28 49
ATOS Consulting Technologies                Fax : + 33 (0)1 55 91 26 53
Les Miroirs, Tour C
18, av. d'Alsace                     Internet : [email-masked]
92926 Paris La Defense Cedex - France
=======================================================================