More uIP webserver changes from Kate

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5163 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-09-16 22:01:23 +00:00
parent 1947d55686
commit cdaf727061
3 changed files with 17 additions and 5 deletions

View File

@ -84,9 +84,13 @@ extern "C" {
#define HTTPD_IOBUFFER_SIZE (3*UIP_TCP_MSS) #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 #define HTTPD_MAX_FILENAME 20
#endif
/**************************************************************************** /****************************************************************************
* Public types * Public types
@ -96,7 +100,7 @@ struct httpd_fs_file
{ {
char *data; char *data;
int len; int len;
#ifdef CONFIG_NETUTILS_HTTPD_MMAP #if defined(CONFIG_NETUTILS_HTTPD_MMAP) || defined(CONFIG_NETUTILS_HTTPD_SENDFILE)
int fd; int fd;
#endif #endif
}; };

View File

@ -14,8 +14,8 @@ uIP Applications
This directory contains most of the network applications contained This directory contains most of the network applications contained
under the uIP-1.0 apps directory. As the uIP apps/README says, under the uIP-1.0 apps directory. As the uIP apps/README says,
these applications "are not all heavily tested." These uIP apps these applications "are not all heavily tested." These uIP-based
include: apps include:
dhcpc - Dynamic Host Configuration Protocol (DHCP) client. See dhcpc - Dynamic Host Configuration Protocol (DHCP) client. See
apps/include/netutils/dhcpc.h for interface information. apps/include/netutils/dhcpc.h for interface information.
@ -29,7 +29,9 @@ include:
for interface information. for interface information.
You may find additional information on these apps in the uIP forum 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 Other Network Applications
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -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_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_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_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 #ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE
static const char g_httpextensionshtml[] = ".shtml"; 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_httpextensionpng[] = ".png";
static const char g_httpextensiongif[] = ".gif"; static const char g_httpextensiongif[] = ".gif";
static const char g_httpextensionjpg[] = ".jpg"; static const char g_httpextensionjpg[] = ".jpg";
static const char g_httpextensionjs[] = ".js";
static const char g_http404path[] = "/404.html"; static const char g_http404path[] = "/404.html";
#ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE #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)); 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 else
{ {
ret = httpd_addchunk(pstate, g_httpcontenttypeplain, strlen(g_httpcontenttypeplain)); ret = httpd_addchunk(pstate, g_httpcontenttypeplain, strlen(g_httpcontenttypeplain));