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!
This commit is contained in:
FRIGN 2014-08-09 22:29:08 +02:00
parent dc82dd9705
commit 34b584e2cb
2 changed files with 3 additions and 5 deletions

View file

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

View file

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