[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: -support mime-types by file exten
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: -support mime-types by file extension in demo.c |
Date: |
Fri, 28 Oct 2022 15:20:40 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new b85d48cd -support mime-types by file extension in demo.c
b85d48cd is described below
commit b85d48cd952dc2654bb0eb4bbbbbb9d722d2ea04
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Oct 28 15:20:33 2022 +0200
-support mime-types by file extension in demo.c
---
src/examples/demo.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 0ab7a973..edce395d 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -797,6 +797,27 @@ generate_page (void *cls,
else
#endif /* MHD_HAVE_LIBMAGIC */
mime = NULL;
+ {
+ /* Set mime-type by file-extension in some cases */
+ const char *ldot = strrchr (&url[1], '.');
+
+ if (NULL != ldot)
+ {
+ if (0 == strcasecmp (ldot,
+ ".html"))
+ mime = "text/html";
+ if (0 == strcasecmp (ldot,
+ ".css"))
+ mime = "text/css";
+ if (0 == strcasecmp (ldot,
+ ".css3"))
+ mime = "text/css";
+ if (0 == strcasecmp (ldot,
+ ".js"))
+ mime = "application/javascript";
+ }
+
+ }
if (NULL == (response = MHD_create_response_from_fd ((size_t) buf.st_size,
fd)))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: -support mime-types by file extension in demo.c,
gnunet <=