aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/Webserver/Lib/HTTPServerApp.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-02-01 01:27:00 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-02-01 01:27:00 +0000
commitb6a4584a19e81c2e1f909355bbc64c2b8cea84f6 (patch)
tree3e5388a85cea77702c24478245097138c7bf704c /Projects/Webserver/Lib/HTTPServerApp.c
parentbb1a036f097602a70ce219915db28dea616b76a8 (diff)
downloadlufa-b6a4584a19e81c2e1f909355bbc64c2b8cea84f6.tar.gz
lufa-b6a4584a19e81c2e1f909355bbc64c2b8cea84f6.tar.bz2
lufa-b6a4584a19e81c2e1f909355bbc64c2b8cea84f6.zip
Fixed Pipe_IsEndpointBound() function not taking the endpoint's direction into account.
Re-added Pipe_IsEndpointBound() calls to the CDC and RNDIS host class drivers, not that the function has the correct behaviour for devices with bidirectional endpoints.
Diffstat (limited to 'Projects/Webserver/Lib/HTTPServerApp.c')
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c
index 7d29272b8..e31bdbb0b 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.c
+++ b/Projects/Webserver/Lib/HTTPServerApp.c
@@ -43,8 +43,8 @@
char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"
"Server: LUFA RNDIS\r\n"
"Connection: close\r\n"
- "MIME-version: 1.0\r\n"
- "Content-Type: ";
+ "MIME-version: 1.0\r\n"
+ "Content-Type: ";
/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given
* given URL is invalid, and gives extra error information.
@@ -52,9 +52,9 @@ char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"
char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
"Server: LUFA RNDIS\r\n"
"Connection: close\r\n"
- "MIME-version: 1.0\r\n"
- "Content-Type: text/plain\r\n\r\n"
- "Error 404: File Not Found";
+ "MIME-version: 1.0\r\n"
+ "Content-Type: text/plain\r\n\r\n"
+ "Error 404: File Not Found";
/** Default MIME type sent if no other MIME type can be determined */
char PROGMEM DefaultMIMEType[] = "text/plain";
@@ -97,12 +97,9 @@ void WebserverApp_Callback(void)
if (uip_aborted() || uip_timedout() || uip_closed())
{
- /* Connection is being terminated for some reason - close file handle if open */
- if (AppState->FileOpen)
- {
- f_close(&AppState->FileHandle);
- AppState->FileOpen = false;
- }
+ /* Connection is being terminated for some reason - close file handle */
+ f_close(&AppState->FileHandle);
+ AppState->FileOpen = false;
/* Lock to the closed state so that no further processing will occur on the connection */
AppState->CurrentState = WEBSERVER_STATE_Closed;
@@ -159,7 +156,7 @@ void WebserverApp_Callback(void)
static void Webserver_OpenRequestedFile(void)
{
uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* AppData = (char*)uip_appdata;
+ char* const AppData = (char*)uip_appdata;
/* No HTTP header received from the client, abort processing */
if (!(uip_newdata()))
@@ -199,12 +196,12 @@ static void Webserver_OpenRequestedFile(void)
static void Webserver_SendResponseHeader(void)
{
uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* AppData = (char*)uip_appdata;
+ char* const AppData = (char*)uip_appdata;
char* HeaderToSend;
uint16_t HeaderLength;
- /* Determine what HTTP header should be sent to the client */
+ /* Determine which HTTP header should be sent to the client */
if (AppState->FileOpen)
{
HeaderToSend = HTTP200Header;
@@ -216,6 +213,7 @@ static void Webserver_SendResponseHeader(void)
AppState->NextState = WEBSERVER_STATE_Closing;
}
+ /* Copy over the HTTP response header and send it to the receiving client */
HeaderLength = strlen_P(HeaderToSend);
strncpy_P(AppData, HeaderToSend, HeaderLength);
uip_send(AppData, HeaderLength);
@@ -227,7 +225,7 @@ static void Webserver_SendResponseHeader(void)
static void Webserver_SendMIMETypeHeader(void)
{
uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* AppData = (char*)uip_appdata;
+ char* const AppData = (char*)uip_appdata;
char* Extension = strpbrk(AppState->FileName, ".");
uint16_t MIMEHeaderLength = 0;
@@ -272,7 +270,7 @@ static void Webserver_SendMIMETypeHeader(void)
static void Webserver_SendData(void)
{
uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
- char* AppData = (char*)uip_appdata;
+ char* const AppData = (char*)uip_appdata;
/* Must determine the maximum segment size to determine maximum file chunk size */
uint16_t MaxSegmentSize = uip_mss();