RE: [Common-dev] RE: [Nokia-private-dev] CR: TKON-7FF9XE Fix for corruption of escaped URLs in sdp file
"Eric Hyche" <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Organization | RealNetworks, Inc. |
| Message-ID | <00d101c90859$89339360$9b9aba20$@com> |
Ok - this looks good for HEAD. ======================================= Eric Hyche ([email protected]) Senior Technical Lead RealNetworks, Inc. >-----Original Message----- >From: [email protected] [mailto:[email protected]] On Behalf >Of Eric Hyche >Sent: Tuesday, August 26, 2008 5:28 PM >To: [email protected]; [email protected] >Cc: [email protected]; [email protected]; nokia-private- >[email protected] >Subject: RE: [Common-dev] RE: [Nokia-private-dev] CR: TKON-7FF9XE Fix for corruption of escaped URLs >in sdp file > >I'll take a quick look at this tomorrow morning (Wednesday) >and get back to you on it. Please hold off on checking >into the HEAD until then. > >Thanks! > >Eric > >======================================= >Eric Hyche ([email protected]) >Senior Technical Lead >RealNetworks, Inc. > > >>-----Original Message----- >>From: [email protected] [mailto:[email protected]] On Behalf >>Of [email protected] >>Sent: Tuesday, August 26, 2008 4:42 PM >>To: [email protected] >>Cc: [email protected]; [email protected]; nokia-private- >>[email protected] >>Subject: [Common-dev] RE: [Nokia-private-dev] CR: TKON-7FF9XE Fix for corruption of escaped URLs in >>sdp file >> >>Hi, >>I have made the HXBOOL changes and checked in on Cays221 and Cays210. >>Please let me know if someone is still reviewing. If there are no more >>comments, I will also go ahead and check it into head. >> >>Updated diff: >>Index: hxflsrc.cpp >>=================================================================== >>RCS file: /cvsroot/client/core/hxflsrc.cpp,v >>retrieving revision 1.96.2.7.2.2 >>diff -u -w -r1.96.2.7.2.2 hxflsrc.cpp >>--- hxflsrc.cpp 6 May 2008 22:55:51 -0000 1.96.2.7.2.2 >>+++ hxflsrc.cpp 26 Aug 2008 20:04:40 -0000 >>@@ -3575,7 +3575,11 @@ >> memset(pszSDPBuffer, 0, ulSDPBufferSize); >> strncpy(pszSDPBuffer, (const char*)pFile->GetBuffer(), >>pFile->GetSize()); >> >>- escapedSDP = HXEscapeUtil::EscapeGeneric(pszSDPBuffer); >>+ // Allowing double-escape of characters in sdp file so it can be >>restored >>+ // to its original form when it's unescaped in >>HXNetSource::FinishSetup(). >>+ // If this is not done, any URL in the sdp file that contains >>escaped >>+ // characters will be corrupted >>+ escapedSDP = HXEscapeUtil::EscapeGeneric(pszSDPBuffer, TRUE); >> >> url = HELIX_SDP_SCHEME; >> url += ":"; >> >> >>Index: hxescapeutil.cpp >>=================================================================== >>RCS file: /cvsroot/common/util/hxescapeutil.cpp,v >>retrieving revision 1.2.42.1 >>diff -u -w -r1.2.42.1 hxescapeutil.cpp >>--- hxescapeutil.cpp 2 May 2006 19:47:31 -0000 1.2.42.1 >>+++ hxescapeutil.cpp 26 Aug 2008 20:08:36 -0000 >>@@ -171,7 +171,7 @@ >> return newStr.Finish(); >> } >> >>-static CHXString Escape(const CHXString& unescapedStr, const char* >>pExtra = 0) >>+static CHXString Escape(const CHXString& unescapedStr, const char* >>pExtra = 0, const HXBOOL doubleEscape = FALSE) >> { >> int len = unescapedStr.GetLength(); >> const char* pCur = unescapedStr; >>@@ -181,7 +181,7 @@ >> while (len) >> { >> if (IsSpecialChar(*pCur, pExtra) && >>- !IsEscaped(pCur,len)) >>+ (!IsEscaped(pCur,len) || doubleEscape)) >> { >> // Escape this character >> *newPath = '%'; >>@@ -320,9 +320,9 @@ >> } >> >> // escape everything but unreserved characters >>-CHXString HXEscapeUtil::EscapeGeneric(const CHXString& unescapedQuery) >>+CHXString HXEscapeUtil::EscapeGeneric(const CHXString& unescapedQuery, >>const HXBOOL doubleEscape) >> { >>- return Escape(unescapedQuery); >>+ return Escape(unescapedQuery, NULL, doubleEscape); >> } >> >> // escape symbol by doubling, e.g., '%' -> '%%' >> >> >>Index: hxescapeutil.h >>=================================================================== >>RCS file: /cvsroot/common/util/pub/hxescapeutil.h,v >>retrieving revision 1.2 >>diff -u -w -r1.2 hxescapeutil.h >>--- hxescapeutil.h 15 Dec 2004 21:26:28 -0000 1.2 >>+++ hxescapeutil.h 26 Aug 2008 20:10:15 -0000 >>@@ -27,7 +27,7 @@ >> static CHXString UnEscape(const CHXString& escapedStr); >> >> // encode (used when assembling url components into a full URL) >>-static CHXString EscapeGeneric(const CHXString& unescapedStr); >>+static CHXString EscapeGeneric(const CHXString& unescapedStr, const >>HXBOOL doubleEscape = FALSE); >> static CHXString EscapePath(const CHXString& unescapedPath, bool >>bForcePlusEscape = false); >> static CHXString EscapeQuery(const CHXString& unescapedQuery); >> >> >>Regards, >>Gaby >> >>-----Original Message----- >>From: ext Gregory Wright [mailto:[email protected]] >>Sent: Sunday, August 24, 2008 3:15 PM >>To: Valverde Gabriela (EXT-Infovision-MSW/Dallas) >>Cc: [email protected]; [email protected]; >>[email protected] >>Subject: Re: [Nokia-private-dev] CR: TKON-7FF9XE Fix for corruption of >>escaped URLs in sdp file >> >> >>I would like others, who have done more SDP/escape stuff to chime in, >>but if this is time critical, it is OK for CayS branches, but please >>wait on HEAD until others can verify allowing double escaping won't have >>any ill effects on SDP playback. >> >>Some bool-->HXBOOL changes needed below for both branches. >> >>--greg. >> >> >> >>On Aug 22, 2008, at 1:09 PM, [email protected] wrote: >> >>> "Nokia submits this code under the terms of a commercial contribution >>> agreement with RealNetworks, and I am authorized to contribute this >>> code under said agreement." >>> >>> >>> Modified by: [email protected] >>> >>> Reviewed by: >>> TSW Id: TKON-7FF9XE >>> Synergy change Id: ou1cimx1#18877 >>> Date: 08/21/2008 >>> >>> Project: SymbianMmf_rel >>> >>> Synopsis: Fix for corruption of escaped URLs in sdp file >>> >>> Overview: >>> Control URLs with escaped characters are being corrupted in the case >>> of streaming from an sdp file. >>> >>> The sdp file contains the following URL: >>> >>rtsp://195.92.254.27:554/owtv007?fg=2&ud=msisdn%3D447973261756%2Csubscri >>ptionId%3D77657%2CmmServiceId%3D64436&dt=20080723T183555.000Z&ds=9a4cde8 >>ea60e54d5f9adc7cb23fcf7bccaa1899a >>> >>> But what helix sends out in the SETUP request is this: >>> >>rtsp://195.92.254.27:554/owtv007?fg=2&ud=msisdn=447973261756,subscriptio >>nId=77657,mmServiceId=64436&dt=20080723T183555.000Z&ds=9a4cde8ea60e54d5f >>9adc7cb23fcf7bccaa1899a >>> >>> The difference between the two is that reserved characters are un- >>> escaped by helix in the value of this "key=value" pair: >>> >>> In SDP file: >>> ud=msisdn%3D447973261756%2CsubscriptionId%3D77657%2CmmServiceId >>> %3D64436 >>> After Helix un-escapes: >>> ud=msisdn=447973261756,subscriptionId=77657,mmServiceId=64436 >>> >>> This happens because: >>> 1. We first escape the entire SDP file in HXFileSource::GetFileDone() >>> 2. Then we un-escape it in HXNetSource::FinishSetup() -> This is >>> when the "=" and "," characters >>> in question are un-escaped. >>> 3. Then we escape the URL again in >>> RTSPClientProtocol::InitExtInitSDP() by calling >>> HXEscapeUtil::EnsureEscapedURL(), but this doesn't return the URL to >>> its original form. The reason why the "=" and "," characters are not >>> escaped here is because the entire query (the part after ?) is >>> treated as one string where reserved characters (';', '/', '?', ':', >>> '@', '&', '=', '+', '$', ',', '\0') do not need to be escaped. Given >>> a query string with no escaped characters, helix would not be able >>> to reconstruct the original percent-encoded query in all cases. >>> >>> Fix: >>> Make sure that characters are double-escaped when the sdp file is >>> initially escaped. >>> >>> 1. After escaping the sdp file, the URL would become: >>> >>rtsp://195.92.254.27:554/owtv007?fg=2&ud=msisdn%253D447973261756%252Csub >>> scriptionId%253D77657%252CmmServiceId >>> %253D64436&dt=20080723T183555.000Z& >>> ds=9a4cde8ea60e54d5f9adc7cb23fcf7bccaa1899a >>> >>> 2. After unescaping the sdp file, the URL would go back to its >>> original form: >>> >>rtsp://195.92.254.27:554/owtv007?fg=2&ud=msisdn%3D447973261756%2Csubscri >>> ptionId%3D77657%2CmmServiceId >>> %3D64436&dt=20080723T183555.000Z&ds=9a4cde8 >>> ea60e54d5f9adc7cb23fcf7bccaa1899a >>> >>> 3. Finally, after escaping the URL (with the idempotent version of >>> the escape function, as we usually do, not escaping already escaped >>> characters), we still get back the original URL: >>> >>> >>rtsp://195.92.254.27:554/owtv007?fg=2&ud=msisdn%3D447973261756%2Csubscri >>> ptionId%3D77657%2CmmServiceId >>> %3D64436&dt=20080723T183555.000Z&ds=9a4cde8 >>> ea60e54d5f9adc7cb23fcf7bccaa1899a >>> >>> >>> Files modified & changes: >>> /client/core/hxflsrc.cpp >>> /common/util/hxescapeutil.cpp >>> /common/util/pub/hxescapeutil.h >>> >>> >>> Image Size and Heap Use impact: None >>> >>> Module Release testing (STIF) : Passed (Streaming) >>> >>> Test case(s) Added : No. >>> >>> Memory leak check performed : Passed, No leaks found >>> >>> Platforms and Profiles Build Verified: helix-client-s60-32-mmf-mdf-arm >>> >>> Platforms and Profiles Functionality verified: armv5 >>> >>> Branch: Head, 210CayS, 221Cays >>> >>> >>> Index: hxflsrc.cpp >>> =================================================================== >>> RCS file: /cvsroot/client/core/hxflsrc.cpp,v >>> retrieving revision 1.96.2.7.2.2 >>> diff -u -w -r1.96.2.7.2.2 hxflsrc.cpp >>> --- hxflsrc.cpp 6 May 2008 22:55:51 -0000 1.96.2.7.2.2 >>> +++ hxflsrc.cpp 21 Aug 2008 20:00:05 -0000 >>> @@ -3575,7 +3575,11 @@ >>> memset(pszSDPBuffer, 0, ulSDPBufferSize); >>> strncpy(pszSDPBuffer, (const char*)pFile->GetBuffer(), pFile- >>> >GetSize()); >>> >>> - escapedSDP = HXEscapeUtil::EscapeGeneric(pszSDPBuffer); >>> + // Allowing double-escape of characters in sdp file so it can >>> be restored >>> + // to its original form when it's unescaped in >>> HXNetSource::FinishSetup(). >>> + // If this is not done, any URL in the sdp file that contains >>> escaped >>> + // characters will be corrupted >>> + escapedSDP = HXEscapeUtil::EscapeGeneric(pszSDPBuffer, true); >>> >> >>> url = HELIX_SDP_SCHEME; >>> url += ":"; >>> >>> >>> Index: hxescapeutil.cpp >>> =================================================================== >>> RCS file: /cvsroot/common/util/hxescapeutil.cpp,v >>> retrieving revision 1.2.42.1 >>> diff -u -w -r1.2.42.1 hxescapeutil.cpp >>> --- hxescapeutil.cpp 2 May 2006 19:47:31 -0000 1.2.42.1 >>> +++ hxescapeutil.cpp 21 Aug 2008 20:00:54 -0000 >>> @@ -171,7 +171,7 @@ >>> return newStr.Finish(); >>> } >>> >>> -static CHXString Escape(const CHXString& unescapedStr, const char* >>> pExtra = 0) >>> +static CHXString Escape(const CHXString& unescapedStr, const char* >>> pExtra = 0, const bool doubleEscape = false) >>> >> >> >>We should not be using 'bool' but 'HXBOOL' in common Helix code.... >> >>> >>> { >>> int len = unescapedStr.GetLength(); >>> const char* pCur = unescapedStr; >>> @@ -181,7 +181,7 @@ >>> while (len) >>> { >>> if (IsSpecialChar(*pCur, pExtra) && >>> - !IsEscaped(pCur,len)) >>> + (!IsEscaped(pCur,len) || doubleEscape)) >>> { >>> // Escape this character >>> *newPath = '%'; >>> @@ -320,9 +320,9 @@ >>> } >>> >>> // escape everything but unreserved characters >>> -CHXString HXEscapeUtil::EscapeGeneric(const CHXString& >>> unescapedQuery) >>> +CHXString HXEscapeUtil::EscapeGeneric(const CHXString& >>> unescapedQuery, const bool doubleEscape) >>> >> >>bool -> HXBOOL.... >> >>> >>> { >>> - return Escape(unescapedQuery); >>> + return Escape(unescapedQuery, NULL, doubleEscape); >>> } >>> >>> // escape symbol by doubling, e.g., '%' -> '%%' >>> >>> >>> Index: hxescapeutil.h >>> =================================================================== >>> RCS file: /cvsroot/common/util/pub/hxescapeutil.h,v >>> retrieving revision 1.2 >>> diff -u -w -r1.2 hxescapeutil.h >>> --- hxescapeutil.h 15 Dec 2004 21:26:28 -0000 1.2 >>> +++ hxescapeutil.h 21 Aug 2008 20:02:12 -0000 >>> @@ -27,7 +27,7 @@ >>> static CHXString UnEscape(const CHXString& escapedStr); >>> >>> // encode (used when assembling url components into a full URL) >>> -static CHXString EscapeGeneric(const CHXString& unescapedStr); >>> +static CHXString EscapeGeneric(const CHXString& unescapedStr, const >>> bool doubleEscape = false); >>> >> >>bool --> HXBOOL..... >> >>> >>> static CHXString EscapePath(const CHXString& unescapedPath, bool >>> bForcePlusEscape = false); >>> static CHXString EscapeQuery(const CHXString& unescapedQuery); >>> >>> >>> Regards, >>> Gaby >>> >>> >>> >>> _______________________________________________ >>> Nokia-private-dev mailing list >>> [email protected] >>> http://lists.helixcommunity.org/mailman/listinfo/nokia-private-dev >> >> >>_______________________________________________ >>Common-dev mailing list >>[email protected] >>http://lists.helixcommunity.org/mailman/listinfo/common-dev > > >_______________________________________________ >Common-dev mailing list >[email protected] >http://lists.helixcommunity.org/mailman/listinfo/common-dev _______________________________________________ Helix-client-dev mailing list [email protected] http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev