summaryrefslogtreecommitdiff
path: root/package/uhttpd/src/uhttpd-file.c
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-04-15 19:46:35 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-04-15 19:46:35 +0000
commitcbe586a91926490315c183de105cba6ee4872d1e (patch)
treeadd83536eb3628963124e90e451ebad16f729ada /package/uhttpd/src/uhttpd-file.c
parent51aaf7163fef08f8c9aa83b227c5554ac4f16a8f (diff)
[package] uhttpd:
- make network timeout configurable, increase default to 30 seconds (#7067) - follow symlinks in docroot and add option to disable that - fix mimetype detection for files with combined extensions (.tar.gz, ...) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20883 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/uhttpd/src/uhttpd-file.c')
-rw-r--r--package/uhttpd/src/uhttpd-file.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/package/uhttpd/src/uhttpd-file.c b/package/uhttpd/src/uhttpd-file.c
index 2a06f85206..81f66a34b0 100644
--- a/package/uhttpd/src/uhttpd-file.c
+++ b/package/uhttpd/src/uhttpd-file.c
@@ -29,23 +29,21 @@
static const char * uh_file_mime_lookup(const char *path)
{
struct mimetype *m = &uh_mime_types[0];
- char *p, *pd, *ps;
+ char *e;
- ps = strrchr(path, '/');
- pd = strrchr(path, '.');
-
- /* use either slash or dot as separator, whatever comes last */
- p = (ps && pd && (ps > pd)) ? ps : pd;
-
- if( (p != NULL) && (*(++p) != 0) )
+ while( m->extn )
{
- while( m->extn )
+ e = &path[strlen(path)-1];
+
+ while( e >= path )
{
- if( ! strcasecmp(p, m->extn) )
+ if( (*e == '.') && !strcasecmp(&e[1], m->extn) )
return m->mime;
- m++;
+ e--;
}
+
+ m++;
}
return "application/octet-stream";