[OpenSIPStack] SipUri Parse Error
Brought to you by:
joegenbaclor
From: Gustavo C. <cur...@ho...> - 2007-07-03 14:02:57
|
Joegen:When an uri like:<sip:782706@192.168.0.1:5060;transport=3Dudp;user= =3Dphone>is parsed by SIPURI & SIPURI::operator=3D(const MimeHeader & heade= r)the '>' is kept in the param user (user=3Dphone>). Then the result uri is= :sip:782706@192.168.0.1:5060;transport=3Dudp;user=3Dphone>When this uri is = parsed again by SIPURI & SIPURI::operator=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_M= AX_INDEX && end !=3D P_MAX_INDEX; PString uri;if( hasEnclosure )=20 {=20 PINDEX rightOffSet =3D value.GetLength() - end;=20 PINDEX length =3D value.GetLength() - begin - rightOffSet; --> PINDEX leng= th =3D value.GetLength() - begin - 1 - rightOffSet;=20 uri =3D value.Mid( begin, length ).Trim(); --> uri =3D value.Mid( begin + = 1, length ).Trim();=20 } And to correct the first error: PStringArray t1, t2;=20 PString tBuff =3D value;PINDEX atIndex =3D value.FindLast( '@' ); if( atInd= ex !=3D P_MAX_INDEX ) tBuff =3D value.Mid( atIndex + 1 );|VPStringArray t1,= t2;=20 PString tBuff =3D value;PINDEX atIndex =3D value.FindLast( '@' );if( atInde= x !=3D P_MAX_INDEX )=20 { if( !hasEnclosure )=20 {=20 tBuff =3D value.Mid( atIndex + 1 );=20 } else {=20 atIndex =3D uri.FindLast( '@' );=20 tBuff =3D uri.Mid( atIndex + 1 );=20 }=20 } Please check if these changes are ok. Regards, Gustavo _________________________________________________________________ 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= |