[OpenSIPStack] SipUri Parse Error
Brought to you by:
joegenbaclor
From: Gustavo C. <cur...@ho...> - 2007-07-03 13:55:00
|
Joegen: =20 When an uri like: =20 <sip:782706@192.168.0.1:5060;transport=3Dudp;user=3Dphone> =20 is parsed by SIPURI & SIPURI::operator=3D(const MimeHeader & header) =20 the '>' is kept in the param user (user=3Dphone>).=20 =20 Then the result uri is: =20 sip:782706@192.168.0.1:5060;transport=3Dudp;user=3Dphone> =20 When this uri is parsed again by SIPURI & SIPURI::operator=3D(const MimeHea= der & header), =20 the uri is detected like it has enclosure, but the uri is not extracted. =20 I made a few changes to correct the second error: =20 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; PStr= ing uri; =20 if( hasEnclosure ) { PINDEX rightOffSet =3D value.GetLength() - end; P= INDEX length =3D value.GetLength() - begin - rightOffSet; --> PINDEX length= =3D value.GetLength() - begin - 1 - rightOffSet; uri =3D value.Mid( begi= n, length ).Trim(); --> uri =3D value.Mid( begin + 1, length ).Trim(); } =20 And to correct the first error: =20 PStringArray t1, t2; PString tBuff =3D value; PINDEX atIndex =3D value.FindLast( '@' ); =20 if( atIndex !=3D P_MAX_INDEX ) tBuff =3D value.Mid( atIndex + 1 ); =20 | V PStringArray t1, t2; PString tBuff =3D value; PINDEX atIndex =3D value.FindLast( '@' ); =20 if( atIndex !=3D P_MAX_INDEX ) { if( !hasEnclosure ) { tBuff =3D value= .Mid( atIndex + 1 ); } else { atIndex =3D uri.FindLast( '@' ); tBuff = =3D uri.Mid( atIndex + 1 ); } } Please check if these changes are ok. =20 Regards,Gustavo _________________________________________________________________ Descubre Live.com - tu mundo en l=EDnea reunido: noticias, deportes, el tie= mpo, y mucho m=E1s. http://www.live.com/getstarted= |