diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-04-15 19:46:35 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-04-15 19:46:35 +0000 |
commit | 20ef055c2f698618142a280d5cbc010acacfd651 (patch) | |
tree | 3df03f974bf03b35e3f32dbbfed7385272c2d975 /package/uhttpd/src/uhttpd-file.c | |
parent | a8e20318c5fdb6809892e31cd658d2eda4a9ee2d (diff) | |
download | mtk-20170518-20ef055c2f698618142a280d5cbc010acacfd651.zip mtk-20170518-20ef055c2f698618142a280d5cbc010acacfd651.tar.gz mtk-20170518-20ef055c2f698618142a280d5cbc010acacfd651.tar.bz2 |
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, ...)
SVN-Revision: 20883
Diffstat (limited to 'package/uhttpd/src/uhttpd-file.c')
-rw-r--r-- | package/uhttpd/src/uhttpd-file.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/package/uhttpd/src/uhttpd-file.c b/package/uhttpd/src/uhttpd-file.c index 2a06f85..81f66a3 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"; |