From 93ee8262f526db8d9b73dcb21b1a94054d5a064b Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 18 Sep 2012 18:45:39 +0000 Subject: 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 --- apps/netutils/webserver/httpd_sendfile.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'apps/netutils/webserver/httpd_sendfile.c') 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; -- cgit v1.2.3