Module: kamailio
Branch: master
Commit: d0aeacdc56f8b78477516e3a992e93b0f5219a60
URL:
https://github.com/kamailio/kamailio/commit/d0aeacdc56f8b78477516e3a992e93b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-06-28T15:02:15+02:00
microhttpd: set the content-type header in response
---
Modified: src/modules/microhttpd/microhttpd_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d0aeacdc56f8b78477516e3a992e93b…
Patch:
https://github.com/kamailio/kamailio/commit/d0aeacdc56f8b78477516e3a992e93b…
---
diff --git a/src/modules/microhttpd/microhttpd_mod.c
b/src/modules/microhttpd/microhttpd_mod.c
index c463a7406b..29b865a3e2 100644
--- a/src/modules/microhttpd/microhttpd_mod.c
+++ b/src/modules/microhttpd/microhttpd_mod.c
@@ -295,6 +295,13 @@ static int ksr_mhttpd_send_reply(
response = MHD_create_response_from_buffer(
sbody->len, sbody->s, MHD_RESPMEM_PERSISTENT);
+ if(response == NULL) {
+ LM_ERR("failed to create the response\n");
+ return -1;
+ }
+ if(sctype->len > 0) {
+ MHD_add_response_header(response, "Content-Type", sctype->s);
+ }
ret = MHD_queue_response(
_ksr_mhttpd_ctx.connection, (unsigned int)rcode, response);
MHD_destroy_response(response);