diff --git a/apps/include/netutils/httpd.h b/apps/include/netutils/httpd.h index bcecca73ba..8ba9e2f7b0 100644 --- a/apps/include/netutils/httpd.h +++ b/apps/include/netutils/httpd.h @@ -84,9 +84,13 @@ extern "C" { #define HTTPD_IOBUFFER_SIZE (3*UIP_TCP_MSS) -/* this is the maximum size of a file path */ +/* This is the maximum size of a file path */ +#if defined(CONFIG_NETUTILS_HTTPD_MMAP) || defined(CONFIG_NETUTILS_HTTPD_SENDFILE) +#define HTTPD_MAX_FILENAME PATH_MAX +#else #define HTTPD_MAX_FILENAME 20 +#endif /**************************************************************************** * Public types @@ -96,7 +100,7 @@ struct httpd_fs_file { char *data; int len; -#ifdef CONFIG_NETUTILS_HTTPD_MMAP +#if defined(CONFIG_NETUTILS_HTTPD_MMAP) || defined(CONFIG_NETUTILS_HTTPD_SENDFILE) int fd; #endif }; diff --git a/apps/netutils/README.txt b/apps/netutils/README.txt index 73e6689fec..e97bf5a618 100644 --- a/apps/netutils/README.txt +++ b/apps/netutils/README.txt @@ -14,8 +14,8 @@ uIP Applications This directory contains most of the network applications contained under the uIP-1.0 apps directory. As the uIP apps/README says, -these applications "are not all heavily tested." These uIP apps -include: +these applications "are not all heavily tested." These uIP-based +apps include: dhcpc - Dynamic Host Configuration Protocol (DHCP) client. See apps/include/netutils/dhcpc.h for interface information. @@ -29,7 +29,9 @@ include: for interface information. You may find additional information on these apps in the uIP forum -accessible through: http://www.sics.se/~adam/uip/index.php/Main_Page +accessible through: http://www.sics.se/~adam/uip/index.php/Main_Page . +Some of these (such as the uIP web server) have grown some additional +functionality due primarily to NuttX user contributions. Other Network Applications ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/apps/netutils/webserver/httpd.c b/apps/netutils/webserver/httpd.c index 0c0ee0389d..b482b1e035 100644 --- a/apps/netutils/webserver/httpd.c +++ b/apps/netutils/webserver/httpd.c @@ -100,6 +100,7 @@ static const char g_httpcontenttypehtml[] = "Content-type: text/html\r\n\r\n"; static const char g_httpcontenttypejpg[] = "Content-type: image/jpeg\r\n\r\n"; static const char g_httpcontenttypeplain[] = "Content-type: text/plain\r\n\r\n"; static const char g_httpcontenttypepng[] = "Content-type: image/png\r\n\r\n"; +static const char g_httpcontenttypejs[] = "Content-type: text/javascript\r\n\r\n"; #ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE static const char g_httpextensionshtml[] = ".shtml"; @@ -109,6 +110,7 @@ static const char g_httpextensioncss[] = ".css"; static const char g_httpextensionpng[] = ".png"; static const char g_httpextensiongif[] = ".gif"; static const char g_httpextensionjpg[] = ".jpg"; +static const char g_httpextensionjs[] = ".js"; static const char g_http404path[] = "/404.html"; #ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE @@ -391,6 +393,10 @@ static int send_headers(struct httpd_state *pstate, const char *statushdr, int l { ret = httpd_addchunk(pstate, g_httpcontenttypejpg, strlen(g_httpcontenttypejpg)); } + else if (strncmp(g_httpextensionjs, ptr, strlen(g_httpextensionjs)) == 0) + { + ret = httpd_addchunk(pstate, g_httpcontenttypejs, strlen(g_httpcontenttypejs)); + } else { ret = httpd_addchunk(pstate, g_httpcontenttypeplain, strlen(g_httpcontenttypeplain));