Browse code

textopsx: return false on iterator end of headers

Daniel-Constantin Mierla authored on 07/07/2021 10:38:25
Showing 1 changed files
... ...
@@ -93,7 +93,7 @@ static int pv_get_hf_iterator_hbody(sip_msg_t *msg, pv_param_t *param,
93 93
 static pv_export_t mod_pvs[] = {
94 94
 	{ {"hfitname", sizeof("hfitname")-1}, PVT_OTHER, pv_get_hf_iterator_hname, 0,
95 95
 		pv_parse_hf_iterator_name, 0, 0, 0 },
96
-	{ {"hfitbody", sizeof("hfitname")-1}, PVT_OTHER, pv_get_hf_iterator_hbody, 0,
96
+	{ {"hfitbody", sizeof("hfitbody")-1}, PVT_OTHER, pv_get_hf_iterator_hbody, 0,
97 97
 		pv_parse_hf_iterator_name, 0, 0, 0 },
98 98
 	{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
99 99
 };
... ...
@@ -1924,6 +1924,10 @@ static int ki_hf_iterator_next(sip_msg_t *msg, str *iname)
1924 1924
 		LM_ERR("iterator not available [%.*s]\n", iname->len, iname->s);
1925 1925
 		return -1;
1926 1926
 	}
1927
+	if(_hf_iterators[k].eoh == 1) {
1928
+		return -1;
1929
+	}
1930
+
1927 1931
 	if(_hf_iterators[k].it == NULL) {
1928 1932
 		_hf_iterators[k].it = msg->headers;
1929 1933
 	} else {
... ...
@@ -1931,6 +1935,7 @@ static int ki_hf_iterator_next(sip_msg_t *msg, str *iname)
1931 1935
 	}
1932 1936
 	if(_hf_iterators[k].it == NULL) {
1933 1937
 		_hf_iterators[k].eoh = 1;
1938
+		return -1;
1934 1939
 	}
1935 1940
 	return 1;
1936 1941
 }