From f5314448943216b558a3efd53f35ac9f14926b32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Fri, 15 Apr 2016 22:04:01 +0200 Subject: [PATCH] fix use of libmagic MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Ic772bf327b45f4ad74095d57a8e29a28663aa3d0 Signed-off-by: José Bollo --- src/afb-hreq.c | 16 ++++++++-------- 1 file 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 @@ -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; -- 2.16.6