]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
From: Henrik Nordstrom <hno@hem.passagen.se>
authorwessels <>
Tue, 21 Jul 1998 04:42:23 +0000 (04:42 +0000)
committerwessels <>
Tue, 21 Jul 1998 04:42:23 +0000 (04:42 +0000)
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.

src/mime.cc

index 847ce11339245c924d02c2987eefc8b37f126c56..a72c3e030effc06c2c7e3694399829f6c539386c 100644 (file)
@@ -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;