summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-02-22 11:24:14 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-02-22 11:24:14 +0100
commit13bd63c1bd4055cba1316042267b31c4776af256 (patch)
treeffa3f40fb12cd122be1066606527dc05e9b7ef39
parenta8c1c8889910ae3b3439346dd1a9dfbd13c8f31b (diff)
Enable INFER_EXTENSION and add well-known mime types.
Change-Id: I7c433eea63c01d2b0813a9cc84c12433839bf125 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/afb-hreq.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e78d0323..0780cb4a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,6 +23,7 @@ endif(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
INCLUDE(FindPkgConfig)
ADD_DEFINITIONS(-DBINDING_INSTALL_DIR="${binding_install_dir}")
+ADD_DEFINITIONS(-DINFER_EXTENSION)
CHECK_INCLUDE_FILES(magic.h HAVE_MAGIC_H)
CHECK_LIBRARY_EXISTS(magic magic_load "" HAVE_LIBMAGIC_SO)
@@ -36,7 +37,7 @@ IF(NOT HAVE_LIBMAGIC)
MESSAGE(FATAL_ERROR "\"magic.h\" or \"libmagic.so\" missing.
Please install the \"file-devel\" or \"libmagic-dev\" package !")
ENDIF(NOT HAVE_LIBMAGIC)
-ADD_COMPILE_OPTIONS(-DUSE_MAGIC_MIME_TYPE)
+ADD_DEFINITIONS(-DUSE_MAGIC_MIME_TYPE)
PKG_CHECK_MODULES(libsystemd REQUIRED libsystemd>=222)
PKG_CHECK_MODULES(libmicrohttpd REQUIRED libmicrohttpd>=0.9.48)
diff --git a/src/afb-hreq.c b/src/afb-hreq.c
index b2180458..5052cca9 100644
--- a/src/afb-hreq.c
+++ b/src/afb-hreq.c
@@ -280,6 +280,10 @@ static const char *mimetype_fd_name(int fd, const char *filename)
{ ".js", "text/javascript" },
{ ".html", "text/html" },
{ ".css", "text/css" },
+ { ".ico", "image/x-icon"},
+ { ".png", "image/png" },
+ { ".svg", "image/svg+xml" },
+ { ".ttf", "application/x-font-ttf"},
{ NULL, NULL }
};
int i = 0;