commit 34b584e2cb63e3372f42d0f9825d0274510d95d3
Author: FRIGN <[email protected]>
Date: Sat Aug 9 22:29:08 2014 +0200
Fix mime-handling with default mime
Now it should work. It doesn't make much sense to tweak the default
mime-type, given octet-stream is the default and there are
no real alternatives which would make sense.
Thanks Hiltjo and sin!
diff --git a/config.def.h b/config.def.h
index d5d4448..5acac6b 100644
--- a/config.def.h
+++ b/config.def.h
@@ -24,5 +24,5 @@ static const MimeType servermimes[] = {
{ "gz", "application/x-gtar" },
{ "pdf", "application/x-pdf" },
{ "tar", "application/tar" },
- { "", "application/octet-stream" }
+ { "mp3", "audio/mp3" }
};
diff --git a/quark.c b/quark.c
index f0d32eb..db036b5 100644
--- a/quark.c
+++ b/quark.c
@@ -181,7 +181,7 @@ responsefiledata(int fd, off_t size) {
void
responsefile(void) {
- const char *mimetype;
+ const char *mimetype = "application/octet-stream";
char *p;
char mod[25];
int i, ffd, r;
@@ -209,9 +209,7 @@ responsefile(void) {
if ((p = strrchr(reqbuf, '.'))) {
p++;
for (i = 0; i < LENGTH(servermimes); i++)
- if (!strncmp(servermimes[i].extension,
p,
-
strlen(servermimes[i].extension)))
- {
+ if (!strcmp(servermimes[i].extension,
p)) {
mimetype =
servermimes[i].mimetype;
break;
}