"Content-Type: text/plain\r\n\r\n"\r
"Error 404: File Not Found: /";\r
\r
-/** Default MIME type sent if no other MIME type can be determined. */\r
-const char PROGMEM DefaultMIMEType[] = "text/plain";\r
-\r
/** Default filename to fetch when a directory is requested */\r
const char PROGMEM DefaultDirFileName[] = "index.htm";\r
\r
+/** Default MIME type sent if no other MIME type can be determined. */\r
+const char PROGMEM DefaultMIMEType[] = "text/plain";\r
+\r
/** List of MIME types for each supported file extension. */\r
const MIME_Type_t MIMETypes[] =\r
{\r
{.Extension = "pdf", .MIMEType = "application/pdf"},\r
};\r
\r
-/** FAT Fs structure to hold the internal state of the FAT driver for the dataflash contents. */\r
+/** FATFs structure to hold the internal state of the FAT driver for the dataflash contents. */\r
FATFS DiskFATState;\r
\r
\r
\r
if (uip_aborted() || uip_timedout() || uip_closed())\r
{\r
- /* Connection is being terminated for some reason - close file handle */\r
- f_close(&AppState->HTTPServer.FileHandle);\r
- AppState->HTTPServer.FileOpen = false;\r
- \r
/* Lock to the closed state so that no further processing will occur on the connection */\r
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;\r
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;\r
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closing;\r
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;\r
}\r
\r
if (uip_connected())\r
HTTPServerApp_SendData();\r
break;\r
case WEBSERVER_STATE_Closing:\r
+ /* Connection is being terminated for some reason - close file handle */\r
+ f_close(&AppState->HTTPServer.FileHandle);\r
+ AppState->HTTPServer.FileOpen = false;\r
+ \r
+ /* If connection is not already closed, close it */\r
uip_close();\r
\r
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;\r
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;\r
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;\r
break;\r
} \r
} \r
char* RequestedFileName = strtok(NULL, " ");\r
\r
/* Must be a GET request, abort otherwise */\r
- if (strcmp(RequestToken, "GET") != 0)\r
+ if (strcmp_P(RequestToken, PSTR("GET")) != 0)\r
{\r
uip_abort();\r
return;\r
}\r
\r
/* Add the end-of-line terminator and end-of-headers terminator after the MIME type */\r
- strcpy(&AppData[strlen(AppData)], "\r\n\r\n");\r
+ strcpy_P(&AppData[strlen(AppData)], PSTR("\r\n\r\n"));\r
\r
/* Send the MIME header to the receiving client */\r
uip_send(AppData, strlen(AppData));\r