aboutsummaryrefslogtreecommitdiffstats
path: root/package/uhttpd/src/uhttpd-file.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-07-23 13:15:22 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-07-23 13:15:22 +0000
commitf589036a4facd028bf6d9ff669ee3b7e36e966f4 (patch)
treea6c7c52be230dae6d05eee1edb99a57e3cbf112e /package/uhttpd/src/uhttpd-file.c
parenta608f942ad27ac16e9262e502c670eb3a5a1dff8 (diff)
downloadmaster-187ad058-f589036a4facd028bf6d9ff669ee3b7e36e966f4.tar.gz
master-187ad058-f589036a4facd028bf6d9ff669ee3b7e36e966f4.tar.bz2
master-187ad058-f589036a4facd028bf6d9ff669ee3b7e36e966f4.zip
[package] uhttpd:
- fix a compile warning - support custom index file names - support custom error pages (or cgi handler) - add option to disable directory listings - add REDIRECT_STATUS for CGI requests, fixes php-cgi git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22366 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/uhttpd/src/uhttpd-file.c')
-rw-r--r--package/uhttpd/src/uhttpd-file.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/package/uhttpd/src/uhttpd-file.c b/package/uhttpd/src/uhttpd-file.c
index 81f66a34b0..850a14175c 100644
--- a/package/uhttpd/src/uhttpd-file.c
+++ b/package/uhttpd/src/uhttpd-file.c
@@ -29,7 +29,7 @@
static const char * uh_file_mime_lookup(const char *path)
{
struct mimetype *m = &uh_mime_types[0];
- char *e;
+ const char *e;
while( m->extn )
{
@@ -275,7 +275,9 @@ static void uh_file_dirlist(struct client *cl, struct http_request *req, struct
strncat(filename, files[i]->d_name,
sizeof(filename) - strlen(files[i]->d_name));
- if( !stat(filename, &s) && (s.st_mode & S_IFDIR) )
+ if( !stat(filename, &s) &&
+ (s.st_mode & S_IFDIR) && (s.st_mode & S_IXOTH)
+ )
uh_http_sendf(cl, req,
"<li><strong><a href='%s%s'>%s</a>/</strong><br />"
"<small>modified: %s<br />directory - %.02f kbyte"
@@ -293,7 +295,9 @@ static void uh_file_dirlist(struct client *cl, struct http_request *req, struct
strncat(filename, files[i]->d_name,
sizeof(filename) - strlen(files[i]->d_name));
- if( !stat(filename, &s) && !(s.st_mode & S_IFDIR) )
+ if( !stat(filename, &s) &&
+ !(s.st_mode & S_IFDIR) && (s.st_mode & S_IROTH)
+ )
uh_http_sendf(cl, req,
"<li><strong><a href='%s%s'>%s</a></strong><br />"
"<small>modified: %s<br />%s - %.02f kbyte<br />"
@@ -369,7 +373,7 @@ void uh_file_request(struct client *cl, struct http_request *req, struct path_in
}
/* directory */
- else if( pi->stat.st_mode & S_IFDIR )
+ else if( (pi->stat.st_mode & S_IFDIR) && !cl->server->conf->no_dirlists )
{
/* write status */
uh_file_response_200(cl, req, NULL);