diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-18 18:45:39 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-18 18:45:39 +0000 |
commit | 93ee8262f526db8d9b73dcb21b1a94054d5a064b (patch) | |
tree | 57e05816aff54967e701523653dd1dfd3155be7f /apps/netutils/webserver/httpd_sendfile.c | |
parent | 9d045b959ec699d0bc459ed965e042a185307a37 (diff) | |
download | nuttx-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.c | 12 |
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; |