Author: rmudgett
Date: Wed Mar 11 10:22:01 2015
New Revision: 432765

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=432765
Log:
res_pjsip: Fixed invalid empty Server and User-Agent SIP headers.

Setting pjsip.conf useragent to an empty string results in an empty SIP
header being sent.

* Made not add an empty SIP header item to the global SIP headers list.

Review: https://reviewboard.asterisk.org/r/4467/
........

Merged revisions 432764 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip/pjsip_global_headers.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/res/res_pjsip/pjsip_global_headers.c
URL: 
http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/pjsip_global_headers.c?view=diff&rev=432765&r1=432764&r2=432765
==============================================================================
--- trunk/res/res_pjsip/pjsip_global_headers.c (original)
+++ trunk/res/res_pjsip/pjsip_global_headers.c Wed Mar 11 10:22:01 2015
@@ -121,18 +121,22 @@
 
 static int add_header(struct header_list *headers, const char *name, const 
char *value, int replace)
 {
-       struct header *to_add;
+       struct header *to_add = NULL;
 
-       to_add = alloc_header(name, value);
-       if (!to_add) {
-               return -1;
+       if (!ast_strlen_zero(value)) {
+               to_add = alloc_header(name, value);
+               if (!to_add) {
+                       return -1;
+               }
        }
 
        AST_RWLIST_WRLOCK(headers);
        if (replace) { 
                remove_header(headers, name);
        }
-       AST_LIST_INSERT_TAIL(headers, to_add, next);
+       if (to_add) {
+               AST_LIST_INSERT_TAIL(headers, to_add, next);
+       }
        AST_RWLIST_UNLOCK(headers);
 
        return 0;


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to