projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added incomplete MIDIToneGenerator project.
[pub/USBasp.git]
/
Projects
/
Webserver
/
Lib
/
HTTPServerApp.c
diff --git
a/Projects/Webserver/Lib/HTTPServerApp.c
b/Projects/Webserver/Lib/HTTPServerApp.c
index
b6277d3
..
08d8494
100644
(file)
--- a/
Projects/Webserver/Lib/HTTPServerApp.c
+++ b/
Projects/Webserver/Lib/HTTPServerApp.c
@@
-56,12
+56,12
@@
const char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
"Content-Type: text/plain\r\n\r\n"
\r
"Error 404: File Not Found: /";
\r
\r
"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 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
/** List of MIME types for each supported file extension. */
\r
const MIME_Type_t MIMETypes[] =
\r
{
\r
@@
-77,7
+77,7
@@
const MIME_Type_t MIMETypes[] =
{.Extension = "pdf", .MIMEType = "application/pdf"},
\r
};
\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
FATFS DiskFATState;
\r
\r
\r
@@
-100,13
+100,9
@@
void HTTPServerApp_Callback(void)
\r
if (uip_aborted() || uip_timedout() || uip_closed())
\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
/* Lock to the closed state so that no further processing will occur on the connection */
\r
- AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Clos
ed
;
\r
- AppState->HTTPServer.NextState = WEBSERVER_STATE_Clos
ed
;
\r
+ AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Clos
ing
;
\r
+ AppState->HTTPServer.NextState = WEBSERVER_STATE_Clos
ing
;
\r
}
\r
\r
if (uip_connected())
\r
}
\r
\r
if (uip_connected())
\r
@@
-148,9
+144,15
@@
void HTTPServerApp_Callback(void)
HTTPServerApp_SendData();
\r
break;
\r
case WEBSERVER_STATE_Closing:
\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
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
break;
\r
}
\r
}
\r
@@
-172,7
+174,7
@@
static void HTTPServerApp_OpenRequestedFile(void)
char* RequestedFileName = strtok(NULL, " ");
\r
\r
/* Must be a GET request, abort otherwise */
\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
uip_abort();
\r
return;
\r
@@
-255,7
+257,7
@@
static void HTTPServerApp_SendResponseHeader(void)
}
\r
\r
/* Add the end-of-line terminator and end-of-headers terminator after the MIME type */
\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
\r
/* Send the MIME header to the receiving client */
\r
uip_send(AppData, strlen(AppData));
\r