From: wessels <> Date: Tue, 21 Jul 1998 04:42:23 +0000 (+0000) Subject: From: Henrik Nordstrom X-Git-Tag: SQUID_3_0_PRE1~3031 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5510d9e7d855f3539221d1b7bf0cbffecd3487fa;p=thirdparty%2Fsquid.git From: Henrik Nordstrom Here is a small mime type patch. to properly handle the .tgz extension as gzip application/x-tar. It's done by allowing content type to be blank "-" if it has no meaning, as in encodings. --- diff --git a/src/mime.cc b/src/mime.cc index 847ce11339..a72c3e030e 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -1,6 +1,6 @@ /* - * $Id: mime.cc,v 1.69 1998/07/20 17:19:53 wessels Exp $ + * $Id: mime.cc,v 1.70 1998/07/20 22:42:23 wessels Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -320,17 +320,21 @@ mimeGetContentType(const char *fn) mimeEntry *m; char *name = xstrdup(fn); char *t; - if (mimeGetContentEncoding(name)) { - /* Assume we matched /\.\w$/ and cut off the last extension */ - if ((t = strrchr(name, '.'))) - *t = '\0'; - } +try_again: for (m = MimeTable; m; m = m->next) { if (m->content_type == NULL) continue; if (regexec(&m->compiled_pattern, name, 0, 0, 0) == 0) break; } + if (!strcmp(m->content_type, dash_str)) { + /* Assume we matched /\.\w$/ and cut off the last extension */ + if ((t = strrchr(name, '.'))) { + *t = '\0'; + goto try_again; + } + /* What? A encoding without a extension? */ + } xfree(name); if (m == NULL) return NULL;