main/task_http.c

branch
stable
changeset 66
f066fdeb9650
parent 64
326c38d3681b
child 80
9d2c0a85ee6e
--- a/main/task_http.c	Tue Jul 02 17:33:23 2019 +0200
+++ b/main/task_http.c	Fri Jul 05 16:17:04 2019 +0200
@@ -139,6 +139,8 @@
 	sprintf(c_type, "text/html");
     } else if (strcmp(".css", &temp_url[strlen(temp_url) - 4]) == 0) {
 	sprintf(c_type, "text/css");
+    } else if (strcmp(".log", &temp_url[strlen(temp_url) - 4]) == 0) {
+        sprintf(c_type, "text/plain");
     } else if (strcmp(".js", &temp_url[strlen(temp_url) - 3]) == 0) {
 	sprintf(c_type, "text/javascript");
     } else if (strcmp(".json", &temp_url[strlen(temp_url) - 5]) == 0) {
@@ -173,7 +175,7 @@
     strncat(header, "\r\n", 255 - strlen(header));	// Add last empty line.
     err = netconn_write(conn, header, strlen(header), NETCONN_NOCOPY);
     if (err != ERR_OK) {
-	ESP_LOGE(TAG, "%s sendfile %s%s err=%d on header write", ipstr, temp_url, (send_gz) ? ".gz":"", err);
+	ESP_LOGW(TAG, "%s sendfile %s%s err=%d on header write", ipstr, temp_url, (send_gz) ? ".gz":"", err);
 	fclose(f);
 	return;
     }
@@ -192,7 +194,7 @@
 
 	err = netconn_write(conn, buff, bytes, NETCONN_NOCOPY);
 	if (err != ERR_OK) {
-	    ESP_LOGE(TAG, "%s sendfile %s%s err=%d send %u bytes of %ld bytes", ipstr, temp_url,  (send_gz) ? ".gz":"", err, sentsize, filesize);
+	    ESP_LOGW(TAG, "%s sendfile %s%s err=%d send %u bytes of %ld bytes", ipstr, temp_url,  (send_gz) ? ".gz":"", err, sentsize, filesize);
 	    break;
 	}
 	vTaskDelay(2 / portTICK_PERIOD_MS);
@@ -333,7 +335,7 @@
 
     if (err != ERR_OK) {
 	if (err != ERR_TIMEOUT) {	// Ignore timeout
-	    ESP_LOGI(TAG,"%s error %d on read", ipstr, err);
+	    ESP_LOGW(TAG,"%s error %d on read", ipstr, err);
 	}
 	netconn_close(conn);
 	netconn_delete(conn);
@@ -468,7 +470,7 @@
 	err = netconn_accept(conn, &newconn);
 	if (err == ERR_OK) {
 	    if (xQueueSendToBack(client_queue,&newconn,portMAX_DELAY) != pdTRUE) {
-		ESP_LOGE(TAG, "xQueueSendToBack() queue full");	    
+		ESP_LOGW(TAG, "xQueueSendToBack() queue full");	    
 	    };
 	}
 	vTaskDelay(5 / portTICK_PERIOD_MS);

mercurial