Re: squid-1.2B config tag: Config.icons.content_type - icon_content_type [patch]

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 07 Feb 1998 14:49:30 +0100

This is a multi-part message in MIME format.

--------------713B422D320B805A678387EB
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Oskar Pearson wrote:
> =

> Hi
> =

> We should be able to get the mime-types for the icon files from the mim=
e.conf
> file instead of having to have a static tag, shouldn't we?

Agreed. I have attached a small patch that does this. The only change
needed in mime.conf is to move the definition maching the icon-files
first in the list (the format needs to be defined before the icon is
loaded).

---
Henrik Nordstr=F6m
Sparetime Squid Hacker
--------------713B422D320B805A678387EB
Content-Type: text/plain; charset=us-ascii; name="squid-1.2.beta13.icon_type_from_mime.conf.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="squid-1.2.beta13.icon_type_from_mime.conf.patch"
Index: squid/src/cf.data.pre
diff -u squid/src/cf.data.pre:1.1.1.8 squid/src/cf.data.pre:1.1.1.8.4.1
--- squid/src/cf.data.pre:1.1.1.8	Thu Feb  5 22:44:59 1998
+++ squid/src/cf.data.pre	Sat Feb  7 14:41:02 1998
@@ -1878,13 +1878,13 @@
 	XXX
 DOC_END
 
-NAME: icon_content_type
-TYPE: string
-LOC: Config.icons.content_type
-DEFAULT: image/gif
-DOC_START
-	XXX
-DOC_END
+#NAME: icon_content_type
+#TYPE: string
+#LOC: Config.icons.content_type
+#DEFAULT: image/gif
+#DOC_START
+#	XXX
+#DOC_END
 
 NAME: minimum_retry_timeout
 COMMENT: (seconds)
Index: squid/src/mime.c
diff -u squid/src/mime.c:1.1.1.7 squid/src/mime.c:1.1.1.7.4.2
--- squid/src/mime.c:1.1.1.7	Thu Feb  5 22:45:04 1998
+++ squid/src/mime.c	Sat Feb  7 14:42:03 1998
@@ -375,10 +375,10 @@
 	    m->transfer_mode = 'A';
 	else
 	    m->transfer_mode = 'I';
-	mimeLoadIconFile(m->icon);
-	debug(25, 5) ("mimeInit: added '%s'\n", buf);
 	*MimeTableTail = m;
 	MimeTableTail = &m->next;
+	mimeLoadIconFile(m->icon);
+	debug(25, 5) ("mimeInit: added '%s'\n", buf);
     }
     fclose(fp);
     mimeLoadIconFile(ICON_MENU);
@@ -400,6 +400,9 @@
     LOCAL_ARRAY(char, url, MAX_URL);
     char *buf;
     const cache_key *key;
+    const char *type = mimeGetContentType(icon);
+    if( type == NULL )
+        fatal("Unknown icon format while reading mime.conf\n");
     snprintf(url, MAX_URL, "http://internal.squid/icons/%s", icon);
     key = storeKeyPublic(url, METHOD_GET);
     if (storeGet(key))
@@ -427,7 +430,7 @@
     l += snprintf(buf + l, SM_PAGE_SIZE - l, "HTTP/1.0 200 OK\r\n");
     l += snprintf(buf + l, SM_PAGE_SIZE - l, "Date: %s\r\n", mkrfc1123(squid_curtime));
     l += snprintf(buf + l, SM_PAGE_SIZE - l, "Server: Squid/%s\r\n", version_string);
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Content-Type: %s\r\n", Config.icons.content_type);
+    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Content-Type: %s\r\n", type);
     l += snprintf(buf + l, SM_PAGE_SIZE - l, "Content-Length: %d\r\n", (int) sb.st_size);
     l += snprintf(buf + l, SM_PAGE_SIZE - l, "Last-Modified: %s\r\n", mkrfc1123(sb.st_mtime));
     l += snprintf(buf + l, SM_PAGE_SIZE - l, "Expires: %s\r\n", mkrfc1123(squid_curtime + 86400));
Index: squid/src/mime.conf
diff -u squid/src/mime.conf:1.1.1.1 squid/src/mime.conf:1.1.1.1.26.1
--- squid/src/mime.conf:1.1.1.1	Fri Nov 21 12:29:38 1997
+++ squid/src/mime.conf	Sat Feb  7 14:41:02 1998
@@ -3,9 +3,13 @@
 #
 #
 #
+# The definition for the icon file format has to be first in the list
+# or the icons loaded before the file format is defined will get wrong
+# content type.
 #
 # regexp	content-type			icon		encoding	mode
 #-----------------------------------------------------------------------------------
+\.gif$		image/gif			anthony-image.gif		-		image
 \.mime$		www/mime			anthony-text.gif	-		ascii
 \.bin$		application/macbinary		anthony-unknown.gif		-		image
 \.oda$		application/oda			anthony-unknown.gif		-		image
@@ -55,7 +59,6 @@
 \.aiff$		audio/x-aiff			anthony-sound.gif		-		image
 \.aifc$		audio/x-aiff			anthony-sound.gif		-		image
 \.wav$		audio/x-wav			anthony-sound.gif		-		image
-\.gif$		image/gif			anthony-image.gif		-		image
 \.ief$		image/ief			anthony-image.gif		-		image
 \.jpeg$		image/jpeg			anthony-image.gif		-		image
 \.jpg$		image/jpeg			anthony-image.gif		-		image
Index: squid/src/structs.h
diff -u squid/src/structs.h:1.1.1.11 squid/src/structs.h:1.1.1.11.4.1
--- squid/src/structs.h:1.1.1.11	Thu Feb  5 22:45:10 1998
+++ squid/src/structs.h	Sat Feb  7 14:41:02 1998
@@ -300,8 +300,10 @@
     struct {
 	size_t list_width;
 	int list_wrap;
+#if NOT_USED
 	char *icon_prefix;
 	char *icon_suffix;
+#endif
 	char *anon_user;
     } Ftp;
     refresh_t *Refresh;
@@ -313,7 +315,9 @@
     char *fake_ua;
     struct {
 	char *directory;
+#if NOT_USED
 	char *content_type;
+#endif
     } icons;
     char *errorDirectory;
     struct {
--------------713B422D320B805A678387EB--
Received on Tue Jul 29 2003 - 13:15:46 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:42 MST