[svn-commits] rmudgett: branch 13 r432764 - /branches/13/res/res_pjsip/pjsip_global_headers.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 11 10:18:59 CDT 2015


Author: rmudgett
Date: Wed Mar 11 10:18:55 2015
New Revision: 432764

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=432764
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/

Modified:
    branches/13/res/res_pjsip/pjsip_global_headers.c

Modified: branches/13/res/res_pjsip/pjsip_global_headers.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_pjsip/pjsip_global_headers.c?view=diff&rev=432764&r1=432763&r2=432764
==============================================================================
--- branches/13/res/res_pjsip/pjsip_global_headers.c (original)
+++ branches/13/res/res_pjsip/pjsip_global_headers.c Wed Mar 11 10:18:55 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;




More information about the svn-commits mailing list