[reSIProcate] Uri escaping

Jeremy Geras jgeras at counterpath.com
Thu Apr 8 16:40:59 CDT 2010


Hmmm... Won't Uri::shouldEscapeUserChar return false with non-US ASCII characters?  (That's what I'm seeing... c == -60) when the URI contains a character like Ă.

From: slgodin at gmail.com [mailto:slgodin at gmail.com] On Behalf Of Scott Godin
Sent: April-08-10 2:31 PM
To: Jeremy Geras
Cc: resiprocate-devel at resiprocate.org
Subject: Re: [reSIProcate] Uri escaping

I agree that RFC3261 specifies the user part should be escaped (ie. % HEXDIG HEXDIG):



user             =  1*( unreserved / escaped / user-unreserved )
However looking at the Data::escapeToStream method - it should be escaping using (% HEXDIG HEXDIG) - it's not really clear to me how you are ending up with non-escaped characters in the encoding.  We should figure out why escapeToStream is not working for you.

Scott

On Thu, Apr 8, 2010 at 4:59 PM, Jeremy Geras <jgeras at counterpath.com<mailto:jgeras at counterpath.com>> wrote:
Hi,

General question:  How should URIs be escaped?

See the attached trace for an example of what we're seeing with resip -- note the Contact header in the NOTIFY, and the subsequent Request-URI in the re-SUBSCRIBE.  Should the URI in the request line be URL-encoded?  (Pouring through the BNF in 3261 leads me to think that it should...)

Note that this is a trace from a deployment where the re-SUBSCRIBE actually fails because of the lack of proper escaping.  I tried making the following change in Uri.cxx, and with that in place the re-SUBSCRIBE works.  However I'm not sure if this is correct, or if this is the right spot.  Thoughts?

Thanks,
Jeremy

// should not encode user parameters unless its a tel?
EncodeStream&
Uri::encodeParsed(EncodeStream& str) const
{
   str << mScheme << Symbols::COLON;
   if (!mUser.empty())
   {
#ifdef HANDLE_CHARACTER_ESCAPING
      //mUser.escapeToStream(str, shouldEscapeUserChar); <== ORIGINAL CODE
      mUser.urlEncode(str);
#else
      str << mUser;
#endif

 ... snip ...



_______________________________________________
resiprocate-devel mailing list
resiprocate-devel at resiprocate.org<mailto:resiprocate-devel at resiprocate.org>
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20100408/bd3ef6bc/attachment.htm>


More information about the resiprocate-devel mailing list