[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sip] ABNF issue



inline

On Mon, 2002-12-09 at 01:16, Christer Holmberg wrote:
> 
> Hi,
> 
> > >The body does not start with LWS. The body starts with WSP (RFC3261 doesn't
> > >define what WSP is, but if I remember correct it is SP or TAB). So, in that
> > >case you will have:
> > >
> > >CRLF CRLF WSP
> > >
> > >...which, according to the ABNF is:
> > >
> > >CRLF LWS
> >
> > You are taking this out of context. It is not the case that you would
> > parse through the message replaceing all instances of CRLF WSP with LWS.
> 
> So, where in the rules is it said when I should do that, and when I should not?
> To my understanding the LWS rule is defined as a "general rule".

You need to be very careful here.

Just because there is a production rule that says A -> BC
does not mean all occurrences of BC in the language resulted
from the expansion of A. 

Blindly doing a reverse token substitution will produce an incorrect
parse. You can only apply it when you have proven the left side of
the rule fits in a valid parse of the message.

So from your original example. LWS is not defined inside a body - the
body is just a sequence of octets from the perspective of the SIP
grammar. Your SIP parser _cannot_ apply a match against LWS inside it -
there is no valid expansion of the SIP grammar that has LWS appearing
after CRLF CRLF
> 
> > The BNF specifies that message-header ends with a CRLF.
> 
> Yes.
> 
> > What follows that is one of two things - either another CRLF, marking the end
> > of the
> > headers, or another message header, which never begins with LWS.
> 
> >From a SIP grammar point of view that is correct. However, I don't see it said
> anywhere that the definition of LWS isn't valid at the beginning of a new line.

It _is_ valid after CRLF (which is what I think you mean by a new line)
if (and only if) you are still in the expansion of message-header.

> 
> Also, just for the record, where is it said that a sip-header can't start with
> LWS? Where is it said that line folding can't be used at the beginning of a line?
> The text only says that the sip-header field values can be folded onto multiple
> lines.
I don't know what you mean by beginning of a line here. I assume you are
asking why we cant have a header that looks like (\b for blank):
\b\bNewHeader: foo
which is a "\b\bNewheader"?

The grammar answers that. 
extension-header starts with a token.
> 
> > Thus, if a CRLF is followed by something OTHER than WSP, the next construction
> 
> > cannot be LWS.
> 
> Maybe I missunderstand you, but the case I try to describe is when the CRLF IS
> followed by WSP.
If its in a valid expansion of message-header (which will not happen
across a CRLFCRLF string), then you are looking at LWS. The _only_
place that second CRLF matches in the grammar is the literal in
the Request and Response rules. So for your example, any whitespace
following that second CRLF matches message-body = *OCTET, NOT LWS.

> 
> Regards,
> 
> Christer Holmberg
> Ericsson Finland
> 
> 
> _______________________________________________
> Sip mailing list  https://www1.ietf.org/mailman/listinfo/sip
> This list is for NEW development of the core SIP Protocol
> Use sip-implementors@cs.columbia.edu for questions on current sip
> Use sipping@ietf.org for new developments on the application of sip


_______________________________________________
Sip mailing list  https://www1.ietf.org/mailman/listinfo/sip
This list is for NEW development of the core SIP Protocol
Use sip-implementors@cs.columbia.edu for questions on current sip
Use sipping@ietf.org for new developments on the application of sip