Module: kamailio
Branch: master
Commit: 4fef850efb73aa063ae4f920e0f86f2bf085956c
URL: 
https://github.com/kamailio/kamailio/commit/4fef850efb73aa063ae4f920e0f86f2bf085956c

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-09-28T09:02:21+02:00

core: parse - parse from body on first iteration

---

Modified: src/core/parser/msg_parser.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/4fef850efb73aa063ae4f920e0f86f2bf085956c.diff
Patch: 
https://github.com/kamailio/kamailio/commit/4fef850efb73aa063ae4f920e0f86f2bf085956c.patch

---

diff --git a/src/core/parser/msg_parser.c b/src/core/parser/msg_parser.c
index dcbbb3804b6..803e2dbe179 100644
--- a/src/core/parser/msg_parser.c
+++ b/src/core/parser/msg_parser.c
@@ -409,6 +409,18 @@ int parse_headers(
                        case HDR_FROM_T:
                                if(msg->from == 0) {
                                        msg->from = hf;
+                                       msg->parsed_flag |= HDR_FROM_F;
+                                       if(IS_SIP(msg)) {
+                                               if(parse_from_header(msg) < 0) {
+                                                       LOG(cfg_get(core, 
core_cfg, sip_parser_log),
+                                                                       
"invalid From header field [%.*s]\n",
+                                                                       (end - 
tmp > 100) ? 100 : (int)(end - tmp),
+                                                                       tmp);
+                                                       msg->parsed_flag &= 
~HDR_FROM_F;
+                                                       msg->from = NULL;
+                                                       goto error;
+                                               }
+                                       }
                                } else if(ksr_sip_parser_mode & 
KSR_SIP_PARSER_MODE_STRICT) {
                                        if(IS_SIP(msg)) {
                                                LOG(cfg_get(core, core_cfg, 
sip_parser_log),
@@ -418,16 +430,6 @@ int parse_headers(
                                                goto error;
                                        }
                                }
-                               msg->parsed_flag |= HDR_FROM_F;
-                               if(IS_SIP(msg)) {
-                                       if(parse_from_header(msg) < 0) {
-                                               LOG(cfg_get(core, core_cfg, 
sip_parser_log),
-                                                               "invalid From 
header field [%.*s]\n",
-                                                               (end - tmp > 
100) ? 100 : (int)(end - tmp),
-                                                               tmp);
-                                               goto error;
-                                       }
-                               }
                                break;
                        case HDR_CONTACT_T:
                                if(msg->contact == 0)

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to