mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432765 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -121,18 +121,22 @@ static void remove_header(struct header_list *headers, const char *to_remove)
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user