diff --git a/src/HTTPPostSystem.c b/src/HTTPPostSystem.c index 7dd53c4..3da6df9 100644 --- a/src/HTTPPostSystem.c +++ b/src/HTTPPostSystem.c @@ -27,13 +27,13 @@ static const char *TAG = "HTTPServerPost"; #define FILE_PATH_MAX (ESP_VFS_PATH_MAX + CONFIG_SPIFFS_OBJ_NAME_LEN) -const char url_eth_settings[] = "sys/set_eth.html"; -const char url_wifi_settings[] = "sys/set_wifi.html"; -const char url_gprs_settings[] = "sys/set_gprs.html"; -const char url_mqtt_settings[] = "sys/set_mqtt.html"; -const char url_sys_settings[] = "sys/set_sys.html"; -const char url_time_settings[] = "sys/set_time.html"; -const char url_reboot[] = "sys/reboot.html"; +const char url_eth_settings[] = "set_eth.html"; +const char url_wifi_settings[] = "set_wifi.html"; +const char url_gprs_settings[] = "set_gprs.html"; +const char url_mqtt_settings[] = "set_mqtt.html"; +const char url_sys_settings[] = "set_sys.html"; +const char url_time_settings[] = "set_time.html"; +const char url_reboot[] = "reboot.html"; static HTTP_IO_RESULT AfterPostHandler(httpd_req_t *req, const char *filename, char *PostData); diff --git a/src/HTTPServer.c b/src/HTTPServer.c index 03f8f47..8e5fd64 100644 --- a/src/HTTPServer.c +++ b/src/HTTPServer.c @@ -124,6 +124,10 @@ static esp_err_t set_content_type_from_file(httpd_req_t *req, { return httpd_resp_set_type(req, "text/css"); } + else if (IS_FILE_EXT(filename, ".woff2")) + { + return httpd_resp_set_type(req, "font/woff2"); + } /* This is a limited set only */ /* For any other type always set as plain text */ return httpd_resp_set_type(req, "text/plain"); @@ -305,12 +309,18 @@ static esp_err_t GETHandler(httpd_req_t *req) espfs_fclose(file); return ESP_FAIL; } + if (memmem(buf, 3, GZIP_SIGN, 3)) { httpd_resp_set_hdr(req, "Content-Encoding", "gzip"); httpd_resp_set_hdr(req, "Cache-Control", "max-age=600"); isCompressed = true; } + + //prevent mangle compressed font files + if (IS_FILE_EXT(filename, ".woff2")) + isCompressed = true; + int pt = 0; do {