[asterisk-dev] [Code Review] SIP: decode uri after parsing

Kevin P. Fleming kpfleming at digium.com
Mon Dec 21 09:49:30 CST 2009


Olle E. Johansson wrote:
> 21 dec 2009 kl. 16.35 skrev David Vossel:
> 
>> n chan_sip.c ast_uri_decode is called on the entire URI instead of it's individual parts after it is parsed.  This is not good as ast_uri_decode can introduce special characters back into the URI which can mess up parsing.  This patch resolves this by not decoding a URI until parsing is completely done.  There are many instances where we check to see if pedantic checking is enabled before we decode a URI.  In these cases a new macro, SIP_PEDANTIC_DECODE, is used on the individual parsed segments of the URI rather than constantly putting if (pedantic) { decode() } checks everywhere in the code.  In the areas where ast_uri_decode is not dependent upon pedantic checking this macro is not used, but decoding is still moved to each individual part of the URI.  The only behavior that should change from this patch is the time at which decoding occurs.
> 
> My suggestion is to decouple PEDANTIC from URI parsing. It seems only foolish to me to keep that. Let pedantic only be related to tag handling in the future.

Agreed. Once I get a chance to finish the via-branch-id code I started
at SIPit, we can remove pedantic mode completely, as there won't be any
performance loss when using it.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list