Module: kamailio
Branch: master
Commit: b0bfe7afc52335774f8de8b31c19621f86fc4bc7
URL:
https://github.com/kamailio/kamailio/commit/b0bfe7afc52335774f8de8b31c19621…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-05-31T13:32:14+02:00
core: store start of via body start in the structure
- paired with bsize field
---
Modified: src/core/parser/parse_via.c
Modified: src/core/parser/parse_via.h
Modified: src/core/sip_msg_clone.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b0bfe7afc52335774f8de8b31c19621…
Patch:
https://github.com/kamailio/kamailio/commit/b0bfe7afc52335774f8de8b31c19621…
---
diff --git a/src/core/parser/parse_via.c b/src/core/parser/parse_via.c
index 8805fad5ca..78bd304f32 100644
--- a/src/core/parser/parse_via.c
+++ b/src/core/parser/parse_via.c
@@ -2667,6 +2667,7 @@ char *parse_via(
/*DBG("parse_via: rest=<%s>\n", tmp);*/
vb->error = PARSE_OK;
+ vb->bstart = buffer;
vb->bsize = tmp - buffer;
if(vb->port_str.s) {
vb->port = str2s(vb->port_str.s, vb->port_str.len, &err);
@@ -2680,6 +2681,7 @@ char *parse_via(
nextvia:
DBG("parsing via: next via\n");
vb->error = PARSE_OK;
+ vb->bstart = buffer;
vb->bsize = tmp - buffer;
if(vb->port_str.s) {
vb->port = str2s(vb->port_str.s, vb->port_str.len, &err);
diff --git a/src/core/parser/parse_via.h b/src/core/parser/parse_via.h
index e4957961f1..b4e99a09df 100644
--- a/src/core/parser/parse_via.h
+++ b/src/core/parser/parse_via.h
@@ -76,6 +76,7 @@ typedef struct via_body {
str port_str;
str params;
str comment;
+ char *bstart; /* body content, not including hdr */
int bsize; /* body size, not including hdr */
struct via_param* param_lst; /* list of parameters*/
struct via_param* last_param; /*last via parameter, internal use*/
diff --git a/src/core/sip_msg_clone.c b/src/core/sip_msg_clone.c
index e69c7f785d..f66614c99c 100644
--- a/src/core/sip_msg_clone.c
+++ b/src/core/sip_msg_clone.c
@@ -159,6 +159,8 @@ static inline struct via_body* via_body_cloner( char* new_buf,
/* hdr (str type) */
new_via->hdr.s=translate_pointer(new_buf,org_buf,org_via->hdr.s);
+ /* bstart (char* type) */
+ new_via->bstart=translate_pointer(new_buf,org_buf,org_via->bstart);
/* name (str type) */
new_via->name.s=translate_pointer(new_buf,org_buf,org_via->name.s);
/* version (str type) */