[hackers] [quark] Fix mime-handling with default mime || FRIGN

From: <git_AT_suckless.org>
Date: Sat, 09 Aug 2014 22:28:25 +0200

commit 34b584e2cb63e3372f42d0f9825d0274510d95d3
Author: FRIGN <dev_AT_frign.de>
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
_AT_@ -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
_AT_@ -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;
_AT_@ -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;
                                         }
Received on Sat Aug 09 2014 - 22:28:25 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 09 2014 - 22:36:09 CEST