+\r
+ if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())\r
+ {\r
+ switch (AppState->HTTPServer.CurrentState)\r
+ {\r
+ case WEBSERVER_STATE_OpenRequestedFile:\r
+ HTTPServerApp_OpenRequestedFile();\r
+ break;\r
+ case WEBSERVER_STATE_SendResponseHeader:\r
+ HTTPServerApp_SendResponseHeader();\r
+ break;\r
+ case WEBSERVER_STATE_SendData:\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.CurrentState = WEBSERVER_STATE_Closed;\r
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;\r
+ break;\r
+ } \r
+ } \r
+}\r
+\r
+/** HTTP Server State handler for the Request Process state. This state manages the processing of incoming HTTP\r
+ * GET requests to the server from the receiving HTTP client.\r
+ */\r
+static void HTTPServerApp_OpenRequestedFile(void)\r
+{\r
+ uip_tcp_appstate_t* const AppState = &uip_conn->appstate;\r
+ char* const AppData = (char*)uip_appdata;\r
+ \r
+ /* No HTTP header received from the client, abort processing */\r
+ if (!(uip_newdata()))\r
+ return;\r
+ \r
+ char* RequestToken = strtok(AppData, " ");\r
+ char* RequestedFileName = strtok(NULL, " ");\r
+ \r
+ /* Must be a GET request, abort otherwise */\r
+ if (strcmp_P(RequestToken, PSTR("GET")) != 0)\r