[sr-dev] git:5.5:b42dfd30: pv_headers: restore pvh_real_hdr_del_by_name()

Victor Seva linuxmaniac at torreviejawireless.org
Wed Dec 22 11:21:28 CET 2021


Module: kamailio
Branch: 5.5
Commit: b42dfd30ba74562e3c7673b3de449760bb315d62
URL: https://github.com/kamailio/kamailio/commit/b42dfd30ba74562e3c7673b3de449760bb315d62

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2021-12-22T11:21:15+01:00

pv_headers: restore pvh_real_hdr_del_by_name()

it was wrongly removed at 09981c41cb6685fa18f61b9e7d66339917c4f097

(cherry picked from commit d8f0e71a0497e0bb98be60452914df51c84b56d8)

---

Modified: src/modules/pv_headers/pvh_hdr.c

---

Diff:  https://github.com/kamailio/kamailio/commit/b42dfd30ba74562e3c7673b3de449760bb315d62.diff
Patch: https://github.com/kamailio/kamailio/commit/b42dfd30ba74562e3c7673b3de449760bb315d62.patch

---

diff --git a/src/modules/pv_headers/pvh_hdr.c b/src/modules/pv_headers/pvh_hdr.c
index 31c09b4b5d..fbb471ccd5 100644
--- a/src/modules/pv_headers/pvh_hdr.c
+++ b/src/modules/pv_headers/pvh_hdr.c
@@ -131,6 +131,21 @@ int pvh_real_hdr_append(struct sip_msg *msg, str *hname, str *hvalue)
 	return 1;
 }
 
+int pvh_real_hdr_del_by_name(struct sip_msg *msg, str *hname)
+{
+	hdr_field_t *hf = NULL;
+
+	for(hf = msg->headers; hf; hf = hf->next) {
+		if(hf->name.len == hname->len
+				&& strncasecmp(hf->name.s, hname->s, hname->len) == 0) {
+			LM_DBG("remove header[%.*s]: %.*s\n", hf->name.len, hf->name.s,
+					hf->body.len, hf->body.s);
+			del_lump(msg, hf->name.s - msg->buf, hf->len, 0);
+		}
+	}
+	return 1;
+}
+
 int pvh_real_hdr_remove_display(struct sip_msg *msg, str *hname)
 {
 	hdr_field_t *hf = NULL;




More information about the sr-dev mailing list