Re: Unable to access HTTP request headers using microhttpd module
Jurijs Ivolga via sr-users <[email protected]>
| Newsgroups | gmane.comp.voip.ser |
|---|---|
| Message-ID | <CAOrA2UZ9Z1eqcXb4aKLa6qgrFBNt-jkzNxcaJ2+JhGoog61tww@mail.gmail.com> |
Yes, definitely a bug. I opened a github issue: https://github.com/kamailio/kamailio/issues/4369 Jurijs On Fri, Aug 15, 2025 at 6:33 PM Jurijs Ivolga <[email protected]> wrote: > Hi, > > I'm not an expert in C and I checked module code and it looks like a bug. > > Your syntax seems correct. > > With kind regards, > > Jurijs > > > On Fri, Aug 15, 2025 at 1:48 PM Ivan Ribakov via sr-users < > [email protected]> wrote: > >> Could someone confirm if they ever had success accessing HTTP headers >> with microhttpd module? Am I even using the correct syntax? >> >> >> >> *IVAN RIBAKOV* >> Lead Engineer >> >> *__________________________________________* >> >> CAIT, Campus Montegancedo, >> >> Pozuelo de Alarcón 28223 >> >> Madrid - Spain >> [image: https://zaleos.net] <https://zaleos.net/> [image: >> https://www.linkedin.com/company/18014823] >> <https://www.linkedin.com/company/18014823> >> >> On Tue, 5 Aug 2025, 17:52 Ivan Ribakov via sr-users, < >> [email protected]> wrote: >> >>> I'm trying to access the value of HTTP X header inside >>> "event_route[microhttpd:request]" as follows: >>> ``` >>> xlog("L_INFO", "$mhttpd(H:X-Foo)\n"); >>> ``` >>> >>> But I'm getting null. >>> >>> I also tried non-X headers `$mhttpd(H:Content-Type)` but still no luck. >>> >>> When running with DEBUG logs, I'm not seeing any hints as to what might >>> be going wrong: >>> >>> ``` >>> { "time": "2025-08-05T15:34:33.177582092Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: ctl [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177649420Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: jsonrpcs [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177667928Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: usrloc [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177695097Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/utils/sruid.c", "line": >>> 127, "function": "sruid_init", "logprefix": "", "message": "root for sruid >>> is [ulcx-1-68922489-21-] (0 / 19)" } >>> { "time": "2025-08-05T15:34:33.177713396Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: tm [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177742450Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "tm", "file": "callid.c", "line": 138, >>> "function": "child_init_callid", "logprefix": "", "message": "callid: ' >>> [email protected]'" } >>> { "time": "2025-08-05T15:34:33.177751949Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: tmx [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177768432Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "tmx", "file": "tmx_mod.c", "line": 249, >>> "function": "child_init", "logprefix": "", "message": "rank is (-2)" } >>> { "time": "2025-08-05T15:34:33.177777023Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: sl [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177792318Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: uac [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177807544Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: ndb_redis [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.177827100Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "ndb_redis", "file": "redis_client.c", "line": >>> 259, "function": "redisc_init", "logprefix": "", "message": "Connecting to >>> 22.22.22.102:6379" } >>> { "time": "2025-08-05T15:34:33.178143906Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "ndb_redis", "file": "redis_client.c", "line": >>> 271, "function": "redisc_init", "logprefix": "", "message": "rsrv->ctxRedis >>> = 0x5df7e046fb40" } >>> { "time": "2025-08-05T15:34:33.178464903Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: htable [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178536771Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "htable", "file": "htable.c", "line": 267, >>> "function": "child_init", "logprefix": "", "message": "rank is (-2)" } >>> { "time": "2025-08-05T15:34:33.178576651Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: corex [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178620093Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: dialog [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178664304Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: rtpengine [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178765506Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: nathelper [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178805176Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: dispatcher [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178846034Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: http_client [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178887870Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "http_client", "file": "http_client.c", "line": >>> 414, "function": "child_init", "logprefix": "", "message": "*** http_client >>> module initializing process 33" } >>> { "time": "2025-08-05T15:34:33.178919788Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "core", "file": "core/sr_module.c", "line": >>> 919, "function": "init_mod_child", "logprefix": "", "message": "idx 22 rank >>> -2: microhttpd [MicroHTTPd Server Process]" } >>> { "time": "2025-08-05T15:34:33.178961414Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "microhttpd", "file": "microhttpd_mod.c", >>> "line": 603, "function": "microhttpd_server_run", "logprefix": "", >>> "message": "preparing to listen on 10.52.0.100 :8081" } >>> ... >>> { "time": "2025-08-05T15:34:34.375701559Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "microhttpd", "file": "microhttpd_mod.c", >>> "line": 521, "function": "ksr_microhttpd_request", "logprefix": "", >>> "message": "incoming data: >>> [{\"jsonrpc\":\"2.0\",\"method\":\"core.version\",\"id\":1}]" } >>> { "time": "2025-08-05T15:34:34.375729356Z", "idx": 22, "pid": 33, >>> "level": "DEBUG", "module": "microhttpd", "file": "microhttpd_mod.c", >>> "line": 553, "function": "ksr_microhttpd_request", "logprefix": "", >>> "message": "executing event_route[microhttpd:request] (5)" } >>> { "time": "2025-08-05T15:34:34.375793262Z", "idx": 22, "pid": 33, >>> "level": "INFO", "module": "xlog", "file": "xlog.c", "line": 283, >>> "function": "", "logprefix": "", "message": "<null>" } >>> ``` >>> >>> Am I missing something or is this a bug? >>> >>> P.S. all other pre-fetched request data is fine (I checked path and >>> body). >>> __________________________________________________________ >>> Kamailio - Users Mailing List - Non Commercial Discussions -- >>> [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! >>> >> __________________________________________________________ >> Kamailio - Users Mailing List - Non Commercial Discussions -- >> [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! >> > __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- [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!