projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ath9k: fix various calibration related bugs and clean up the code
[openwrt.git]
/
package
/
uhttpd
/
src
/
uhttpd-file.c
diff --git
a/package/uhttpd/src/uhttpd-file.c
b/package/uhttpd/src/uhttpd-file.c
index
2a06f85
..
850a141
100644
(file)
--- 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];
static const char * uh_file_mime_lookup(const char *path)
{
struct mimetype *m = &uh_mime_types[0];
- c
har *p, *pd, *ps
;
+ c
onst 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;
return m->mime;
-
m++
;
+
e--
;
}
}
+
+ m++;
}
return "application/octet-stream";
}
return "application/octet-stream";
@@
-277,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));
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"
uh_http_sendf(cl, req,
"<li><strong><a href='%s%s'>%s</a>/</strong><br />"
"<small>modified: %s<br />directory - %.02f kbyte"
@@
-295,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));
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 />"
uh_http_sendf(cl, req,
"<li><strong><a href='%s%s'>%s</a></strong><br />"
"<small>modified: %s<br />%s - %.02f kbyte<br />"
@@
-371,7
+373,7
@@
void uh_file_request(struct client *cl, struct http_request *req, struct path_in
}
/* directory */
}
/* 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);
{
/* write status */
uh_file_response_200(cl, req, NULL);
This page took
0.021533 seconds
and
4
git commands to generate.