Re: [OpenSIPStack] SipUri Parse Error
Brought to you by:
joegenbaclor
From: Joegen E. B. <joe...@gm...> - 2007-07-04 06:57:23
|
I have committed a patch for this bug. Thanks for reporting it. Gustavo Curetti wrote: > Joegen: > > When an uri like: > > <sip:782706@192.168.0.1:5060;transport=udp;user=phone> > > is parsed by SIPURI & SIPURI::operator=(const MimeHeader & header) > > the '>' is kept in the param user (user=phone>). > > Then the result uri is: > > sip:782706@192.168.0.1:5060;transport=udp;user=phone> > > When this uri is parsed again by SIPURI & SIPURI::operator=(const > MimeHeader & header), > > the uri is detected like it has enclosure, but the uri is not extracted. > > I made a few changes to correct the second error: > > PINDEX begin = value.Find( '<' ) + 1; --> PINDEX begin = value.Find( > '<' ); (to be compared with P_MAX_INDEX) > PINDEX end = value.Find( '>' ); > BOOL hasEnclosure = begin != P_MAX_INDEX && end != P_MAX_INDEX; > PString uri; > > if( hasEnclosure ) > { > PINDEX rightOffSet = value.GetLength() - end; > PINDEX length = value.GetLength() - begin - rightOffSet; --> PINDEX > length = value.GetLength() - begin - 1 - rightOffSet; > uri = value.Mid( begin, length ).Trim(); --> uri = value.Mid( begin + > 1, length ).Trim(); > } > > And to correct the first error: > > PStringArray t1, t2; > PString tBuff = value; > PINDEX atIndex = value.FindLast( '@' ); > > if( atIndex != P_MAX_INDEX ) > tBuff = value.Mid( atIndex + 1 ); > | > V > PStringArray t1, t2; > PString tBuff = value; > PINDEX atIndex = value.FindLast( '@' ); > > if( atIndex != P_MAX_INDEX ) > { > if( !hasEnclosure ) > { > tBuff = value.Mid( atIndex + 1 ); > } else { > atIndex = uri.FindLast( '@' ); > tBuff = uri.Mid( atIndex + 1 ); > } > } > > Please check if these changes are ok. > > Regards, > Gustavo > > ------------------------------------------------------------------------ > Comunícate al instante con Windows Live Messenger Windows Live > Messenger > <http://imagine-msn.com/messenger/launch80/default.aspx?locale=es-ar&source=joinmsncom/messenger> |