On Mon, 2008-12-22 at 19:56 +0000, Scott Lawrence wrote:
> This is a constant source of bugs... it's too late to do this for 4.0,
> but as soon as we've forked the release I propose that we eliminate both
> toString and getUri and replace them with new methods toNameAddr and
> toAddrSpec. I bet we find at least 6 more bugs when we audit the code
> to figure out all the places these are used.
Good idea.
> I think that a better fix is something like:
>
> 0 != gruu->compareTo(SPECIAL_IMDB_NULL_VALUE))
> {
> content.append(" <gr:pub-gruu uri=\"");
> Url grUrl(*gruu);
> grUrl.setScheme(Url::SipUrlScheme); // needed?
> grUrl.setGRUU( UtlString("") );
> UtlString addrSpecForm;
> grUrl.getUri(addrSpecForm);
> XmlEscape(content, addrSpecForm);
> content.append("\"/>\r\n");
> }
In some ways it's better, but it's also worse. The underlying problem
is that the UtlString *gruu isn't a URI, it's an "identity", that is,
"u...@hostport". So parsing it into a Url is bogus -- that only works
because we default to guessing that it's a SIP URI. So we can either
(1) parse the string (bogusly) into a URI, patch the URI to
"sip:" (which is what the parse already assumed), then un-parse it into
a string, or (2) prepend "sip:" to the string and use it (which is what
the parse is pretty much doing anyway). So I chose the simpler and
faster operation, given that neither operation is really correct. --
The *right* thing to do is revise *gruu (that is, the registration DB
column) to be a string that is a proper URI, at which point parsing it
into a Url object is clean, and is the proper way to prepare it for any
needed manipulations. But that's going to have to wait till after 4.0.
Dale
_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev