summaryrefslogtreecommitdiff
path: root/apps/netutils/webserver/httpd_sendfile.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-18 18:45:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-18 18:45:39 +0000
commit93ee8262f526db8d9b73dcb21b1a94054d5a064b (patch)
tree57e05816aff54967e701523653dd1dfd3155be7f /apps/netutils/webserver/httpd_sendfile.c
parent9d045b959ec699d0bc459ed965e042a185307a37 (diff)
downloadnuttx-93ee8262f526db8d9b73dcb21b1a94054d5a064b.tar.gz
nuttx-93ee8262f526db8d9b73dcb21b1a94054d5a064b.tar.bz2
nuttx-93ee8262f526db8d9b73dcb21b1a94054d5a064b.zip
Add default file name if URL is a directory, giving index.html behavior. From Kate
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5162 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils/webserver/httpd_sendfile.c')
-rw-r--r--apps/netutils/webserver/httpd_sendfile.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/netutils/webserver/httpd_sendfile.c b/apps/netutils/webserver/httpd_sendfile.c
index 6a6ec24ab..a60144d04 100644
--- a/apps/netutils/webserver/httpd_sendfile.c
+++ b/apps/netutils/webserver/httpd_sendfile.c
@@ -89,6 +89,18 @@ int httpd_sendfile_open(const char *name, struct httpd_fs_file *file)
return ERROR;
}
+ if (S_ISDIR(st.st_mode))
+ {
+ errno = EISDIR;
+ return ERROR;
+ }
+
+ if (!S_ISREG(st.st_mode))
+ {
+ errno = ENOENT;
+ return ERROR;
+ }
+
if (st.st_size > INT_MAX || st.st_size > SIZE_MAX)
{
errno = EFBIG;