projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
012628f
)
Use a temporary variable to hold the current URI length in the Webserver, rather...
author
Dean Camera
<dean@fourwalledcubicle.com>
Thu, 18 Feb 2010 05:33:35 +0000
(
05:33
+0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Thu, 18 Feb 2010 05:33:35 +0000
(
05:33
+0000)
Projects/Webserver/Lib/HTTPServerApp.c
patch
|
blob
|
blame
|
history
Projects/Webserver/Lib/uIPManagement.c
patch
|
blob
|
blame
|
history
Projects/Webserver/Lib/uip/uip-split.c
patch
|
blob
|
blame
|
history
diff --git
a/Projects/Webserver/Lib/HTTPServerApp.c
b/Projects/Webserver/Lib/HTTPServerApp.c
index
4f8490e
..
b6277d3
100644
(file)
--- a/
Projects/Webserver/Lib/HTTPServerApp.c
+++ b/
Projects/Webserver/Lib/HTTPServerApp.c
@@
-168,7
+168,7
@@
static void HTTPServerApp_OpenRequestedFile(void)
if (!(uip_newdata()))
\r
return;
\r
\r
if (!(uip_newdata()))
\r
return;
\r
\r
- char* RequestToken = strtok(AppData, " ");
\r
+ char* RequestToken
= strtok(AppData, " ");
\r
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
@@
-182,16
+182,19
@@
static void HTTPServerApp_OpenRequestedFile(void)
strncpy(AppState->HTTPServer.FileName, &RequestedFileName[1], (sizeof(AppState->HTTPServer.FileName) - 1));
\r
\r
/* Ensure filename is null-terminated */
\r
strncpy(AppState->HTTPServer.FileName, &RequestedFileName[1], (sizeof(AppState->HTTPServer.FileName) - 1));
\r
\r
/* Ensure filename is null-terminated */
\r
- AppState->HTTPServer.FileName[(sizeof(AppState->HTTPServer.FileName) - 1)] = 0x00;
\r
+ AppState->HTTPServer.FileName[sizeof(AppState->HTTPServer.FileName) - 1] = 0x00;
\r
+
\r
+ /* Determine the length of the URI so that it can be checked to see if it is a directory */
\r
+ uint8_t FileNameLen = strlen(AppState->HTTPServer.FileName);
\r
\r
/* If the URI is a directory, append the default filename */
\r
\r
/* If the URI is a directory, append the default filename */
\r
- if (AppState->HTTPServer.FileName[
strlen(AppState->HTTPServer.FileName)
- 1] == '/')
\r
+ if (AppState->HTTPServer.FileName[
FileNameLen
- 1] == '/')
\r
{
\r
{
\r
- strncpy_P(&AppState->HTTPServer.FileName[
strlen(AppState->HTTPServer.FileName)
], DefaultDirFileName,
\r
- (sizeof(AppState->HTTPServer.FileName) -
(strlen(AppState->HTTPServer.FileName) + 1)
));
\r
+ strncpy_P(&AppState->HTTPServer.FileName[
FileNameLen
], DefaultDirFileName,
\r
+ (sizeof(AppState->HTTPServer.FileName) -
FileNameLen
));
\r
\r
/* Ensure altered filename is still null-terminated */
\r
\r
/* Ensure altered filename is still null-terminated */
\r
- AppState->HTTPServer.FileName[
(sizeof(AppState->HTTPServer.FileName) - 1)
] = 0x00;
\r
+ AppState->HTTPServer.FileName[
sizeof(AppState->HTTPServer.FileName) - 1
] = 0x00;
\r
}
\r
\r
/* Try to open the file from the Dataflash disk */
\r
}
\r
\r
/* Try to open the file from the Dataflash disk */
\r
@@
-233,7
+236,7
@@
static void HTTPServerApp_SendResponseHeader(void)
if (Extension != NULL)
\r
{
\r
/* Look through the MIME type list, copy over the required MIME type if found */
\r
if (Extension != NULL)
\r
{
\r
/* Look through the MIME type list, copy over the required MIME type if found */
\r
- for (
in
t i = 0; i < (sizeof(MIMETypes) / sizeof(MIMETypes[0])); i++)
\r
+ for (
uint8_
t i = 0; i < (sizeof(MIMETypes) / sizeof(MIMETypes[0])); i++)
\r
{
\r
if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
\r
{
\r
{
\r
if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
\r
{
\r
@@
-251,7
+254,7
@@
static void HTTPServerApp_SendResponseHeader(void)
strcpy_P(&AppData[strlen(AppData)], DefaultMIMEType);
\r
}
\r
\r
strcpy_P(&AppData[strlen(AppData)], DefaultMIMEType);
\r
}
\r
\r
- /* Add the end-of
line terminator and end-of-headers terminator after the MIME type */
\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
\r
/* Send the MIME header to the receiving client */
\r
strcpy(&AppData[strlen(AppData)], "\r\n\r\n");
\r
\r
/* Send the MIME header to the receiving client */
\r
diff --git
a/Projects/Webserver/Lib/uIPManagement.c
b/Projects/Webserver/Lib/uIPManagement.c
index
13829c5
..
bd7804e
100644
(file)
--- a/
Projects/Webserver/Lib/uIPManagement.c
+++ b/
Projects/Webserver/Lib/uIPManagement.c
@@
-52,7
+52,7
@@
void uIPManagement_Init(void)
{
\r
/* uIP Timing Initialization */
\r
clock_init();
\r
{
\r
/* uIP Timing Initialization */
\r
clock_init();
\r
- timer_set(&ConnectionTimer, CLOCK_SECOND /
5
);
\r
+ timer_set(&ConnectionTimer, CLOCK_SECOND /
2
);
\r
timer_set(&ARPTimer, CLOCK_SECOND * 10);
\r
\r
/* uIP Stack Initialization */
\r
timer_set(&ARPTimer, CLOCK_SECOND * 10);
\r
\r
/* uIP Stack Initialization */
\r
diff --git
a/Projects/Webserver/Lib/uip/uip-split.c
b/Projects/Webserver/Lib/uip/uip-split.c
index
9ad6b48
..
5924fab
100644
(file)
--- a/
Projects/Webserver/Lib/uip/uip-split.c
+++ b/
Projects/Webserver/Lib/uip/uip-split.c
@@
-80,7
+80,6
@@
uip_split_output(void)
#endif /* UIP_CONF_IPV6 */
/* Transmit the first packet. */
#endif /* UIP_CONF_IPV6 */
/* Transmit the first packet. */
- /* uip_fw_output();*/
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
@@
-103,7
+102,6
@@
uip_split_output(void)
BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
#endif /* UIP_CONF_IPV6 */
BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
#endif /* UIP_CONF_IPV6 */
- /* uip_appdata += len1;*/
memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2);
uip_add32(BUF->seqno, len1);
memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2);
uip_add32(BUF->seqno, len1);
@@
-123,12
+121,10
@@
uip_split_output(void)
#endif /* UIP_CONF_IPV6 */
/* Transmit the second packet. */
#endif /* UIP_CONF_IPV6 */
/* Transmit the second packet. */
- /* uip_fw_output();*/
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
- //tcpip_output();
#endif /* UIP_CONF_IPV6 */
return;
}
#endif /* UIP_CONF_IPV6 */
return;
}