summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-04-15 22:04:01 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-04-15 22:04:01 +0200
commitf5314448943216b558a3efd53f35ac9f14926b32 (patch)
treeafaf61f7f61f6037f795aae00d8d252a6b1a3200
parent68a8eaafe5f43480f29308bfd2ec12ad54da43f1 (diff)
fix use of libmagic
Change-Id: Ic772bf327b45f4ad74095d57a8e29a28663aa3d0 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-hreq.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/afb-hreq.c b/src/afb-hreq.c
index 045a0d60..8a0b2804 100644
--- a/src/afb-hreq.c
+++ b/src/afb-hreq.c
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-#define USE_MAGIC_MIME_TYPE
#define _GNU_SOURCE
#include <stdlib.h>
@@ -145,12 +144,6 @@ static int validsubpath(const char *subpath)
return 1;
}
-#if defined(USE_MAGIC_MIME_TYPE)
-
-#if !defined(MAGIC_DB)
-#define MAGIC_DB "/usr/share/misc/magic.mgc"
-#endif
-
static void afb_hreq_reply_v(struct afb_hreq *hreq, unsigned status, struct MHD_Response *response, va_list args)
{
char *cookie;
@@ -209,6 +202,12 @@ void afb_hreq_reply_free(struct afb_hreq *hreq, unsigned status, size_t size, ch
va_end(args);
}
+#if defined(USE_MAGIC_MIME_TYPE)
+
+#if !defined(MAGIC_DB)
+#define MAGIC_DB "/usr/share/misc/magic.mgc"
+#endif
+
static magic_t lazy_libmagic()
{
static int done = 0;
@@ -254,8 +253,9 @@ static const char *mimetype_fd_name(int fd, const char *filename)
const char *extension = strrchr(filename, '.');
if (extension) {
static const char *const known[][2] = {
- { ".js", "text/javascript" },
+ { ".js", "text/javascript" },
{ ".html", "text/html" },
+ { ".css", "text/css" },
{ NULL, NULL }
};
int i = 0;