quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit 34b584e2cb63e3372f42d0f9825d0274510d95d3
parent dc82dd9705c0e51980a3cf056cfb7482f1954fbc
Author: FRIGN <dev@frign.de>
Date:   Sat,  9 Aug 2014 22:29:08 +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!

Diffstat:
Mconfig.def.h | 2+-
Mquark.c | 6++----
2 files changed, 3 insertions(+), 5 deletions(-)

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