Re: [OpenSIPStack] SipUri Parse Error
Brought to you by:
joegenbaclor
From: Gustavo C. <cur...@ho...> - 2007-07-04 18:13:16
|
Hi Joegen: I have checked the patch, but the comparation: BOOL hasEnclosure= =3D begin !=3D P_MAX_INDEX && end !=3D P_MAX_INDEX; is still wrong if the = "begin" value is set like:PINDEX begin =3D value.Find( '<' ) + 1; I suggest= : PINDEX begin =3D value.Find( '<' );PINDEX end =3D value.Find( '>' );BOOL = hasEnclosure =3D begin !=3D P_MAX_INDEX && end !=3D P_MAX_INDEX; PString ur= i;if( hasEnclosure ){ PINDEX rightOffSet =3D value.GetLength() - end; PINDE= X length =3D value.GetLength() - begin - 1 - rightOffSet; uri =3D value.Mid= ( begin + 1, length ).Trim();} And in the code: PString tBuff =3D uri; PIND= EX atIndex =3D value.FindLast( '@' ); if( atIndex !=3D P_MAX_INDEX ) tBu= ff =3D uri.Mid( atIndex + 1 );The value of atIndex is obtained from value i= nstead of from uri.I suggest: PINDEX atIndex =3D uri.FindLast( '@' ); Or: P= String tBuff =3D value;PINDEX atIndex =3D value.FindLast( '@' ); if( atInde= x !=3D P_MAX_INDEX ){ if( !hasEnclosure ) { tBuff =3D value.Mi= d( atIndex + 1 ); } else { atIndex =3D uri.FindLast( '@' ); = tBuff =3D uri.Mid( atIndex + 1 ); }} Regards,Gustavo > Date: Wed, 4 Jul 2007 14:57:16 +0800> To: cur...@gm...> From= : joe...@gm...> CC: ope...@li...> Su= bject: Re: [OpenSIPStack] SipUri Parse Error> > I have committed a patch fo= r this bug. Thanks for reporting it.> > > Gustavo Curetti wrote:> > Joegen:= > >> > When an uri like:> >> > <sip:782706@192.168.0.1:5060;transport=3Dudp= ;user=3Dphone>> >> > is parsed by SIPURI & SIPURI::operator=3D(const MimeHe= ader & header)> >> > the '>' is kept in the param user (user=3Dphone>). > >= > > Then the result uri is:> >> > sip:782706@192.168.0.1:5060;transport=3Du= dp;user=3Dphone>> >> > When this uri is parsed again by SIPURI & SIPURI::op= erator=3D(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 =3D value.Find( '<' ) + 1; --= > PINDEX begin =3D value.Find( > > '<' ); (to be compared with P_MAX_INDEX)= > > PINDEX end =3D value.Find( '>' );> > BOOL hasEnclosure =3D begin !=3D P= _MAX_INDEX && end !=3D P_MAX_INDEX; > > PString uri;> >> > if( hasEnclosure= )> > {> > PINDEX rightOffSet =3D value.GetLength() - end;> > PINDEX length= =3D value.GetLength() - begin - rightOffSet; --> PINDEX > > length =3D val= ue.GetLength() - begin - 1 - rightOffSet;> > uri =3D value.Mid( begin, leng= th ).Trim(); --> uri =3D value.Mid( begin + > > 1, length ).Trim();> > }> >= > > And to correct the first error:> > > > PStringArray t1, t2;> > PString= tBuff =3D value;> > PINDEX atIndex =3D value.FindLast( '@' );> > > > if( a= tIndex !=3D P_MAX_INDEX )> > tBuff =3D value.Mid( atIndex + 1 );> > |> > V>= > PStringArray t1, t2;> > PString tBuff =3D value;> > PINDEX atIndex =3D v= alue.FindLast( '@' );> >> > if( atIndex !=3D P_MAX_INDEX )> > {> > if( !has= Enclosure )> > {> > tBuff =3D value.Mid( atIndex + 1 );> > } else {> > atIn= dex =3D uri.FindLast( '@' );> > tBuff =3D uri.Mid( atIndex + 1 );> > }> > }= > >> > Please check if these changes are ok.> > > > Regards,> > Gustavo> >>= > ------------------------------------------------------------------------= > > Comun=EDcate al instante con Windows Live Messenger Windows Live > > Me= ssenger > > <http://imagine-msn.com/messenger/launch80/default.aspx?locale= =3Des-ar&source=3Djoinmsncom/messenger>> > > ------------------------------= -------------------------------------------> This SF.net email is sponsored= by DB2 Express> Download DB2 Express C - the FREE version of DB2 express a= nd take> control of your XML. No limits. Just data. Click to get it now.> h= ttp://sourceforge.net/powerbar/db2/> ______________________________________= _________> opensipstack-devel mailing list> ope...@li...urce= forge.net> https://lists.sourceforge.net/lists/listinfo/opensipstack-devel Se uno de los primeros en probar Windows Live Mail. Windows Live Mail.=20 _________________________________________________________________ Descubre Live.com - tu propia p=E1gina de inicio, personalizada para ver r= =E1pidamente todo lo que te interesa en un mismo sitio. http://www.live.com/getstarted= |