[asterisk-dev] URI parsing

Matthew Jordan mjordan at digium.com
Tue May 20 16:17:59 CDT 2014


On Tue, May 20, 2014 at 3:39 PM, George Joseph
<george.joseph at fairview5.com> wrote:
> On Tue, May 20, 2014 at 2:33 PM, Kevin Harwell <kharwell at digium.com> wrote:
>>
>> Greetings,
>>
>> For a task I have been working on in Asterisk I have found myself
>> needing to parse URIs.  Luckily, Asterisk is already using such a
>> library [1], albeit limitedly.  As the library also may not be installed
>> on every system Asterisk uses #ifdef to work around this.
>>
>> So instead of having a bunch of #ifdefs sprinkled throughout the code I
>> was thinking of locating the parsing code in a central place.  Perhaps
>> http.c?  A new file?
>>
>>
> ...
>>
>> If the third party library is installed it will use that to parse and
>> place the data in the structure, otherwise it will fall back and use
>> some basic parsing code to do it.
>>
>> Thoughts?
>>
>> [1] http://uriparser.sourceforge.net/doc/html/index.html
>>
>>
> Might want to always use the code rather than as a fallback.  That way
> there's no chance of the behavior changing based on whether the library is
> installed or not at compile time.  Maybe its own file under main?
>

Agreed on not putting this into http.c. URIs != HTTP.

This should have its own header/implementation file.

Matt

-- 
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list