Browse code

core: fixup sip_msg_apply_changes

- adds header parser to fill headers in msg structure. msg gets copied
but many of the headers don't when msg_apply_changes is called.
- reported in #2803

Ivan Aponte authored on 10/10/2021 16:43:09
Showing 1 changed files
... ...
@@ -3267,6 +3267,7 @@ int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len,
3267 3267
 int sip_msg_update_buffer(sip_msg_t *msg, str *obuf)
3268 3268
 {
3269 3269
 	sip_msg_t tmp;
3270
+	int res;
3270 3271
 
3271 3272
 	if(obuf==NULL || obuf->s==NULL || obuf->len<=0) {
3272 3273
 		LM_ERR("invalid buffer parameter\n");
... ...
@@ -3329,6 +3330,13 @@ int sip_msg_update_buffer(sip_msg_t *msg, str *obuf)
3329 3330
 		return 0;
3330 3331
 	}
3331 3332
 
3333
+	//parse all the headers again
3334
+	res = parse_headers(msg, HDR_EOH_F, 0);
3335
+	if (res == -1) {
3336
+		LM_ERR("Error while parsing headers (%d)\n", res);
3337
+		return 0;
3338
+	}
3339
+
3332 3340
 	return 1;
3333 3341
 }
3334 3342