Browse code

textops: find_hdr_line_start() - locate header name without error logs

Daniel-Constantin Mierla authored on 02/06/2021 16:02:24
Showing 1 changed files
... ...
@@ -1611,13 +1611,16 @@ static inline int find_hdr_line_start(char *hname, unsigned int hname_len,
1611 1611
 
1612 1612
 	start = *buf;
1613 1613
 	len = *buf_len;
1614
-	if(parse_hname2_str(&sname, &h1)==NULL) {
1614
+	parse_hname2_str(&sname, &h1);
1615
+	if(h1.type!=HDR_ERROR_T) {
1615 1616
 		LM_ERR("not a header name: %.*s\n", hname_len, hname);
1616 1617
 		return 0;
1617 1618
 	}
1618 1619
 
1619 1620
 	while (hname_len <= len) {
1620
-		if(parse_hname2(start, start + hname_len, &h2)!=NULL) {
1621
+		/* attempt to find a header name */
1622
+		parse_sip_header_name(start, start + hname_len, &h2, 1, 0);
1623
+		if(h2.type!=HDR_ERROR_T) {
1621 1624
 			if(h1.type>0 && h1.type==h2.type) {
1622 1625
 				*buf = start;
1623 1626
 				*buf_len = len;
... ...
@@ -1628,6 +1631,7 @@ static inline int find_hdr_line_start(char *hname, unsigned int hname_len,
1628 1631
 				return 1;
1629 1632
 			}
1630 1633
 		}
1634
+		/* jump to next line */
1631 1635
 		if ((ch = memchr(start, 13, len - 1))) {
1632 1636
 			if (*(ch + 1) != 10) {
1633 1637
 				LM_ERR("No LF after CR\n");