netutils/webserver: Fix a few complaints from nutts/tools/nxstyle.

This commit is contained in:
Gregory Nutt 2019-07-04 21:21:26 -06:00
parent 0b352178c1
commit 39ad02f72e
3 changed files with 43 additions and 37 deletions

View File

@ -14,7 +14,6 @@ config NETUTILS_WEBSERVER
if NETUTILS_WEBSERVER if NETUTILS_WEBSERVER
config NETUTILS_HTTPD_SINGLECONNECT config NETUTILS_HTTPD_SINGLECONNECT
bool "Single Connection" bool "Single Connection"
default n if !DISABLE_PTHREAD default n if !DISABLE_PTHREAD
@ -179,5 +178,4 @@ config NETUTILS_HTTPD_DIRLIST
depends on NETUTILS_HTTPD_SENDFILE depends on NETUTILS_HTTPD_SENDFILE
default n default n
endif # NETUTILS_WEBSERVER endif # NETUTILS_WEBSERVER

View File

@ -444,7 +444,10 @@ static int send_headers(struct httpd_state *pstate, int status, int len)
{ {
const char *mime; const char *mime;
const char *ptr; const char *ptr;
char contentlen[HTTPD_MAX_CONTENTLEN] = { 0 }; char contentlen[HTTPD_MAX_CONTENTLEN] =
{
0
};
char header[HTTPD_MAX_HEADERLEN]; char header[HTTPD_MAX_HEADERLEN];
int hdrlen; int hdrlen;
int i; int i;
@ -456,19 +459,36 @@ static int send_headers(struct httpd_state *pstate, int status, int len)
} a[] = } a[] =
{ {
#ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE #ifndef CONFIG_NETUTILS_HTTPD_SCRIPT_DISABLE
{ "shtml", "text/html" }, {
"shtml", "text/html"
},
#endif #endif
{ "html", "text/html" }, {
{ "css", "text/css" }, "html", "text/html"
{ "txt", "text/plain" }, },
{ "js", "text/javascript" }, {
"css", "text/css"
{ "png", "image/png" }, },
{ "gif", "image/gif" }, {
{ "jpeg", "image/jpeg" }, "txt", "text/plain"
{ "jpg", "image/jpeg" }, },
{
{ "mp3", "audio/mpeg" } "js", "text/javascript"
},
{
"png", "image/png"
},
{
"gif", "image/gif"
},
{
"jpeg", "image/jpeg"
},
{
"jpg", "image/jpeg"
},
{ "mp3", "audio/mpeg"
}
}; };
ptr = strrchr(pstate->ht_filename, ISO_period); ptr = strrchr(pstate->ht_filename, ISO_period);

View File

@ -54,18 +54,6 @@
#include "httpd.h" #include "httpd.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/