Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
Bogdan Pilyugin 2022-08-25 16:17:12 +02:00
commit 203a9d86c1
3 changed files with 19 additions and 9 deletions

View File

@ -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);

View File

@ -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
{

View File

@ -210,14 +210,14 @@ static void OTATask(void *pvParameter)
struct espfs_stat_t stat;
//open file
file = espfs_fopen(fs, "ca_cert.pem");
file = espfs_fopen(fs, "res/ca_cert.pem");
if (!file)
{
ESP_LOGE(TAG, "Failed to read certificate file");
goto update_error;
}
//get file info
espfs_stat(fs, "ca_cert.pem", &stat);
espfs_stat(fs, "res/ca_cert.pem", &stat);
uint32_t fileSize;
fileSize = stat.size;
char *certbuf = (char*) malloc(fileSize);