1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

[backfire] merge r20883

git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@20884 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow
2010-04-15 19:53:29 +00:00
parent bd8f4ba347
commit 4916211814
8 changed files with 186 additions and 82 deletions

View File

@@ -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";