<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.4.4">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#ffffff">
Thanks,<BR>
<BR>
I've fixed that.&nbsp; Also put it in a couple of other places where I should have before - it looks like it's only been luck that this hasn't caused some problems in the past!<BR>
<BR>
Regards,<BR>
<BR>
Peter<BR>
<BR>
On Thu, 2012-10-25 at 21:09 +0200, Daniel-Constantin Mierla wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    Hello,<BR>
    <BR>
    headers are parsed as needed -- the core has an incremental sip parser. By default ony few are parsed (like: call-id, csec, to, top via).<BR>
    <BR>
    Some of the well known headers have internal flags, so parsing to locate them would be like (example for Authorization and Proxy-Authorization):<BR>
    <BR>
    parse_headers(msg, HDR_PROXYAUTH_F|HDR_AUTHORIZATION_F, 0)<BR>
    <BR>
    If this function does not return error, then you can get these headers via their hooks in the sip_msg_t or iterating through headers list.<BR>
    <BR>
    If you look for undefined header, you have to parse to the end of headers with:<BR>
    <BR>
    &nbsp;&nbsp;&nbsp; if(parse_headers(msg, HDR_EOH_F, 0)&lt;0)<BR>
    &nbsp;&nbsp;&nbsp; {<BR>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LM_ERR(&quot;error parsing headers\n&quot;);<BR>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<BR>
    &nbsp;&nbsp;&nbsp; }<BR>
    <BR>
    Then you iterate through headers and find it by name if it is actually in the message.<BR>
    <BR>
    The parser does caching, so when parsing to locate a header, all the headers found before it are added to the list. For example, calling second time parse_headers(msg, HDR_EOH_F, 0) does pretty much nothing, as sip_msg_t keeps a flag that message was already parsed to the last header.<BR>
    <BR>
    Cheers,<BR>
    Daniel<BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    On 10/25/12 8:58 PM, Peter Dunkley wrote:<BR>
    <BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
    <BLOCKQUOTE TYPE=CITE>
        Hi,<BR>
        <BR>
        When adding the oma.xcap-directory auid support to xcap_server I couldn't get the following bit of code (in xcap_server.c:xcaps_get_directory()) to work:<BR>
        <BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (hdr != NULL)<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (cmp_hdrname_strzn(&amp;hdr-&gt;name, &quot;Host&quot;, 4) == 0)<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server_name = hdr-&gt;body;<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr = hdr-&gt;next;<BR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
        <BR>
        The host header was never found.&nbsp; However, simply putting 'xdbg(&quot;$hdr(Host)\n&quot;);' in event_route[xhttp:request] made it start working.<BR>
        <BR>
        Have I missed something in the code, or is this a bug?<BR>
        <BR>
        Regards,<BR>
        <BR>
        Peter<BR>
        <BR>
        <BR>
        <TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
        <BR>
        <BR>
<PRE>
_______________________________________________
sr-dev mailing list
<A HREF="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</A>
<A HREF="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</A>
</PRE>
    </BLOCKQUOTE>
    <BR>
<PRE>
-- 
Daniel-Constantin Mierla - <A HREF="http://www.asipto.com">http://www.asipto.com</A>
<A HREF="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</A> - <A HREF="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</A>
Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - <A HREF="http://asipto.com/u/kat">http://asipto.com/u/kat</A>
Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - <A HREF="http://asipto.com/u/katu">http://asipto.com/u/katu</A>
</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>