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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-08-16T08:01:50+02:00

microhttps: detect header name variables before the rest

---

Modified: src/modules/microhttpd/microhttpd_mod.c

---

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

---

diff --git a/src/modules/microhttpd/microhttpd_mod.c 
b/src/modules/microhttpd/microhttpd_mod.c
index 7bc6586aaf3..665e61cd375 100644
--- a/src/modules/microhttpd/microhttpd_mod.c
+++ b/src/modules/microhttpd/microhttpd_mod.c
@@ -205,6 +205,13 @@ int pv_parse_mhttpd_name(pv_spec_p sp, str *in)
 {
        if(sp == NULL || in == NULL || in->len <= 0)
                return -1;
+
+       if(in->len > 2 && in->s[1] == ':' && (in->s[0] == 'h' || in->s[0] == 
'H')) {
+               sp->pvp.pvn.type = PV_NAME_INTSTR;
+               sp->pvp.pvn.u.isname.type = PVT_HDR;
+               sp->pvp.pvn.u.isname.name.s = *in;
+               return 0;
+       }
        switch(in->len) {
                case 3:
                        if(strncasecmp(in->s, "url", 3) == 0) {
@@ -244,13 +251,6 @@ int pv_parse_mhttpd_name(pv_spec_p sp, str *in)
                        }
                        break;
                default:
-                       if(in->len > 2 && in->s[1] == ':'
-                                       && (in->s[0] == 'h' || in->s[0] == 
'H')) {
-                               sp->pvp.pvn.type = PV_NAME_INTSTR;
-                               sp->pvp.pvn.u.isname.type = PVT_HDR;
-                               sp->pvp.pvn.u.isname.name.s = *in;
-                               return 0;
-                       }
                        goto error;
        }
        sp->pvp.pvn.type = PV_NAME_INTSTR;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to