diff options
Diffstat (limited to 'Projects')
-rw-r--r-- | Projects/Webserver/Lib/FATFs/diskio.c | 28 | ||||
-rw-r--r-- | Projects/Webserver/Lib/FATFs/diskio.h | 2 | ||||
-rw-r--r-- | Projects/Webserver/Lib/HTTPServerApp.c | 10 | ||||
-rw-r--r-- | Projects/Webserver/Lib/TELNETServerApp.c | 14 | ||||
-rw-r--r-- | Projects/Webserver/Lib/uip/uipopt.h | 2 | ||||
-rw-r--r-- | Projects/Webserver/Webserver.txt | 7 | ||||
-rw-r--r-- | Projects/Webserver/makefile | 3 |
7 files changed, 27 insertions, 39 deletions
diff --git a/Projects/Webserver/Lib/FATFs/diskio.c b/Projects/Webserver/Lib/FATFs/diskio.c index c7c837ba4..028c631ba 100644 --- a/Projects/Webserver/Lib/FATFs/diskio.c +++ b/Projects/Webserver/Lib/FATFs/diskio.c @@ -62,31 +62,3 @@ DRESULT disk_write ( return RES_OK;
}
#endif /* _READONLY */
-
-
-
-/*-----------------------------------------------------------------------*/
-/* Miscellaneous Functions */
-
-DRESULT disk_ioctl (
- BYTE drv, /* Physical drive nmuber (0..) */
- BYTE ctrl, /* Control code */
- void *buff /* Buffer to send/receive control data */
-)
-{
- if (ctrl == CTRL_SYNC)
- return RES_OK;
- else
- return RES_PARERR;
-}
-
-
-DWORD get_fattime (void)
-{
- return ((DWORD)1 << 25) |
- ((DWORD)1 << 21) |
- ((DWORD)1 << 16) |
- ((DWORD)1 << 11) |
- ((DWORD)1 << 5) |
- ((DWORD)1 << 0);
-}
diff --git a/Projects/Webserver/Lib/FATFs/diskio.h b/Projects/Webserver/Lib/FATFs/diskio.h index 3df93ae7a..2f444f7b6 100644 --- a/Projects/Webserver/Lib/FATFs/diskio.h +++ b/Projects/Webserver/Lib/FATFs/diskio.h @@ -5,7 +5,7 @@ #ifndef _DISKIO
#define _READONLY 0 /* 1: Read-only mode */
-#define _USE_IOCTL 1
+#define _USE_IOCTL 0
#include "integer.h"
#include "ff.h"
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c index e781beb22..0d0cbb903 100644 --- a/Projects/Webserver/Lib/HTTPServerApp.c +++ b/Projects/Webserver/Lib/HTTPServerApp.c @@ -31,7 +31,7 @@ /** \file
*
* Simple HTTP Webserver Application. When connected to the uIP stack,
- * this will serve out files to HTTP clients.
+ * this will serve out files to HTTP clients on port 80.
*/
#define INCLUDE_FROM_HTTPSERVERAPP_C
@@ -270,8 +270,12 @@ static void HTTPServerApp_SendData(void) uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
char* const AppData = (char*)uip_appdata;
- /* Must determine the maximum segment size to determine maximum file chunk size */
- uint16_t MaxSegmentSize = uip_mss();
+ /* Must determine the maximum segment size to determine maximum file chunk size - never send a completely
+ * full packet, as this will cause some hosts to start delaying ACKs until a non-full packet is received.
+ * since uIP only allows one packet to be in transit at a time, this would cause long delays between packets
+ * until the host times out and sends the ACK for the last received packet.
+ */
+ uint16_t MaxSegmentSize = (uip_mss() >> 1);
/* Return file pointer to the last ACKed position */
f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
diff --git a/Projects/Webserver/Lib/TELNETServerApp.c b/Projects/Webserver/Lib/TELNETServerApp.c index 7d8c907fe..2abd7b0ed 100644 --- a/Projects/Webserver/Lib/TELNETServerApp.c +++ b/Projects/Webserver/Lib/TELNETServerApp.c @@ -31,7 +31,7 @@ /** \file
*
* TELNET Webserver Application. When connected to the uIP stack,
- * this will serve out connection information to the client.
+ * this will serve out raw TELNET to the client on port 23.
*/
#define INCLUDE_FROM_TELNETSERVERAPP_C
@@ -44,9 +44,13 @@ const char PROGMEM WelcomeHeader[] = "****************************************** /** Main TELNET menu, giving the user the list of available commands they may issue */
const char PROGMEM TELNETMenu[] = "\r\n"
- " Available Commands:\r\n"
+ " == Available Commands: ==\r\n"
" c) List Active TCP Connections\r\n"
- "\r\nCommand>";
+ " =========================\r\n"
+ "\r\n>";
+
+/** Header to print before the current connections are printed to the client */
+const char PROGMEM CurrentConnectionsHeader = "\r\n* Current TCP Connections: *\r\n";
/** Initialization function for the simple HTTP webserver. */
void TELNETServerApp_Init(void)
@@ -65,11 +69,13 @@ void TELNETServerApp_Callback(void) if (uip_connected())
{
+ /* New connection - initialize connection state values */
AppState->TELNETServer.CurrentState = TELNET_STATE_SendHeader;
}
if (uip_acked())
{
+ /* Progress to the next state once the current state's data has been ACKed */
AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
}
@@ -124,7 +130,7 @@ static void TELNETServerApp_DisplayTCPConnections(void) {
char* const AppData = (char*)uip_appdata;
- strcpy(AppData, "\r\n* Current TCP Connections: *\r\n");
+ strcpy_P(AppData, CurrentConnectionsHeader);
uint16_t ResponseLen = strlen(AppData);
uint8_t ActiveConnCount = 0;
diff --git a/Projects/Webserver/Lib/uip/uipopt.h b/Projects/Webserver/Lib/uip/uipopt.h index 5fca686a2..244ce1df1 100644 --- a/Projects/Webserver/Lib/uip/uipopt.h +++ b/Projects/Webserver/Lib/uip/uipopt.h @@ -691,7 +691,7 @@ typedef union uint8_t CurrentState; uint8_t NextState; - char FileName[50]; + char FileName[MAX_URI_LENGTH]; FIL FileHandle; bool FileOpen; uint32_t ACKedFilePos; diff --git a/Projects/Webserver/Webserver.txt b/Projects/Webserver/Webserver.txt index 3ea167f55..05d0b1ffd 100644 --- a/Projects/Webserver/Webserver.txt +++ b/Projects/Webserver/Webserver.txt @@ -55,7 +55,7 @@ * To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load
* HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called
* <i>index.htm</i>. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver, and the total
- * requested file path must be equal to or less than 50 characters (set in uipopt.h).
+ * requested file path must be equal to or less than the maximum URI length (\see \ref SSec_Options).
*
* When attached to a RNDIS class device, such as a USB (desktop) modem, the system will enumerate the device, set the
* appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80 and TELNET
@@ -98,5 +98,10 @@ * <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT
* is not defined).</td>
* </tr>
+ * <tr>
+ * <td>MAX_URI_LENGTH</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Maximum length of a URI for the Webserver. This is the maximum file path, including subdirectories and seperators.</td>
+ * </tr>
* </table>
*/
\ No newline at end of file diff --git a/Projects/Webserver/makefile b/Projects/Webserver/makefile index d5eda4c44..a813b8ac6 100644 --- a/Projects/Webserver/makefile +++ b/Projects/Webserver/makefile @@ -200,8 +200,9 @@ CSTANDARD = -std=gnu99 # Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)
CDEFS += -DENABLE_DHCP_CLIENT
+CDEFS += -DMAX_URI_LENGTH=50
-CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=5
+CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=3
CDEFS += -DUIP_CONF_MAX_LISTENPORTS=5 -DUIP_URGDATA=0 -DUIP_CONF_BUFFER_SIZE=1514 -DUIP_ARCH_CHKSUM=0
CDEFS += -DUIP_CONF_LL_802154=0 -DUIP_CONF_LL_80211=0 -DUIP_CONF_ROUTER=0 -DUIP_CONF_ICMP6=0
CDEFS += -DUIP_ARCH_ADD32=0 -DUIP_CONF_ICMP_DEST_UNREACH=1 -DUIP_NEIGHBOR_CONF_ADDRTYPE=0
|