Add comments about always setting INFER_EXTENSION.
[src/app-framework-binder.git] / src / afb-hreq.c
index b0f1172..00d4b0e 100644 (file)
@@ -38,7 +38,7 @@
 #include "afb-context.h"
 #include "afb-hreq.h"
 #include "afb-subcall.h"
-#include "session.h"
+#include "afb-session.h"
 #include "verbose.h"
 #include "locale-root.h"
 
@@ -274,12 +274,22 @@ static const char *mimetype_fd_name(int fd, const char *filename)
        const char *result = NULL;
 
 #if defined(INFER_EXTENSION)
+       /*
+        * Set some well-known extensions
+        * Note that it is mandatory for example for css files in order to provide
+        * right mimetype that must be text/css (otherwise chrome browser will not
+        * load correctly css file) while libmagic returns text/plain.
+        */
        const char *extension = strrchr(filename, '.');
        if (extension) {
                static const char *const known[][2] = {
                        { ".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;