@cryptotaxi247 / netdata-1 / commits / f706b9b01

fix for woff2 fonts mime type

Costa Tsaousis (ktsaou) committed Dec 26, 2015 at 13:07 UTC f706b9b0133f4b9cb7fb14ec695c1e7e8b27b6f5
2 files changed +8 -2
src/web_buffer.h
+3 -2
@@ -28,8 +28,9 @@ typedef struct web_buffer {
28 #define CT_APPLICATION_X_FONT_TRUETYPE 10
29 #define CT_APPLICATION_X_FONT_OPENTYPE 11
30 #define CT_APPLICATION_FONT_WOFF 12
31 -#define CT_APPLICATION_VND_MS_FONTOBJ 13
32 -#define CT_IMAGE_SVG_XML 14
31 +#define CT_APPLICATION_FONT_WOFF2 13
32 +#define CT_APPLICATION_VND_MS_FONTOBJ 14
33 +#define CT_IMAGE_SVG_XML 15
34
35 #define buffer_strlen(wb) ((wb)->len)
36 extern const char *buffer_tostring(BUFFER *wb);
src/web_client.c
+5
@@ -338,6 +338,7 @@ int mysendfile(struct web_client *w, char *filename)
338 else if(strstr(filename, ".svg") != NULL) w->response.data->contenttype = CT_IMAGE_SVG_XML;
339 else if(strstr(filename, ".ttf") != NULL) w->response.data->contenttype = CT_APPLICATION_X_FONT_TRUETYPE;
340 else if(strstr(filename, ".otf") != NULL) w->response.data->contenttype = CT_APPLICATION_X_FONT_OPENTYPE;
341 + else if(strstr(filename, ".woff2")!= NULL) w->response.data->contenttype = CT_APPLICATION_FONT_WOFF2;
342 else if(strstr(filename, ".woff") != NULL) w->response.data->contenttype = CT_APPLICATION_FONT_WOFF;
343 else if(strstr(filename, ".eot") != NULL) w->response.data->contenttype = CT_APPLICATION_VND_MS_FONTOBJ;
344 else w->response.data->contenttype = CT_APPLICATION_OCTET_STREAM;
@@ -1228,6 +1229,10 @@ void web_client_process(struct web_client *w) {
1229 content_type_string = "application/font-woff";
1230 break;
1231
1232 + case CT_APPLICATION_FONT_WOFF2:
1233 + content_type_string = "application/font-woff2";
1234 + break;
1235 +
1236 case CT_APPLICATION_VND_MS_FONTOBJ:
1237 content_type_string = "application/vnd.ms-fontobject";
1238 break;