Browse code

core: parser - use case insensitive comparison to get header by name

- same for next sibling header
- GH #1217

(cherry picked from commit 4072b0f9fbc084a4f4640e1b4272b7f8495cd1bb)

Daniel-Constantin Mierla authored on 17/08/2017 11:42:59
Showing 1 changed files
... ...
@@ -958,7 +958,7 @@ hdr_field_t* get_hdr_by_name(const sip_msg_t* const msg, const char* const name,
958 958
 
959 959
 	for(hdr = msg->headers; hdr; hdr = hdr->next) {
960 960
 		if(hdr->name.len == name_len && *hdr->name.s==*name
961
-				&& strncmp(hdr->name.s, name, name_len)==0)
961
+				&& strncasecmp(hdr->name.s, name, name_len)==0)
962 962
 			return hdr;
963 963
 	}
964 964
 	return NULL;
... ...
@@ -971,7 +971,7 @@ hdr_field_t* next_sibling_hdr_by_name(const hdr_field_t* const hf)
971 971
 
972 972
 	for(hdr = hf->next; hdr; hdr = hdr->next) {
973 973
 		if(hdr->name.len == hf->name.len && *hdr->name.s==*hf->name.s
974
-				&& strncmp(hdr->name.s, hf->name.s, hf->name.len)==0)
974
+				&& strncasecmp(hdr->name.s, hf->name.s, hf->name.len)==0)
975 975
 			return hdr;
976 976
 	}
977 977
 	return NULL;