]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #856: Icon URLs are uneededly complex
authorhno <>
Mon, 5 Apr 2004 05:17:48 +0000 (05:17 +0000)
committerhno <>
Mon, 5 Apr 2004 05:17:48 +0000 (05:17 +0000)
The URL syntax used by Squid for FTP/Gopher icons are uneededly complex and
often causes problems. This patch adds a "short_icon_urls" directive which
can be used to enable a less complex URL syntax for icons.

src/cf.data.pre
src/client_side.cc
src/mime.cc
src/structs.h

index 2e4709c4b01715f55688463bd7fa48e00d8e54e1..70f799ff14611cd8698657d39baa2e624a6fbc19 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.347 2004/04/04 15:05:13 hno Exp $
+# $Id: cf.data.pre,v 1.348 2004/04/04 23:17:48 hno Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -3526,6 +3526,19 @@ DOC_START
        @DEFAULT_ICON_DIR@
 DOC_END
 
+NAME: short_icon_urls
+TYPE: onoff
+LOC: Config.icons.use_short_names
+DEFAULT: on
+DOC_START
+       If this is enabled then Squid will use short URLs for icons.
+       If disabled it will revert to the old behaviour of including
+       it's own name and port in the URL.
+
+       If you run a complex cache hierarchy with a mix of Squid and
+       other proxies then you may need to disable this directive.
+DOC_END
+
 NAME: error_directory
 TYPE: string
 LOC: Config.errorDirectory
index 821d6b344e3fccca2f9535e3aae00f5f8789a944..803ed4062f1b6d382f38cc9a03a9dd972769f238 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.669 2004/03/01 01:37:34 adrian Exp $
+ * $Id: client_side.cc,v 1.670 2004/04/04 23:21:53 hno Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -2220,6 +2220,9 @@ clientProcessRequest(ConnStateData::Pointer &conn, ClientSocketContext *context,
                 http->flags.internal = 1;
             }
         }
+
+        if (http->flags.internal)
+            request->protocol = PROTO_HTTP;
     }
 
     request->flags.internal = http->flags.internal;
index 74fe6277ae0b639d05a07ef03f6bdaf5d244bebb..3a3a21da4d76fb145392415048c41ae0311a3cde 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mime.cc,v 1.114 2003/09/01 03:49:39 robertc Exp $
+ * $Id: mime.cc,v 1.115 2004/04/04 23:17:48 hno Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -332,12 +332,19 @@ mimeGetIcon(const char *fn)
 const char *
 mimeGetIconURL(const char *fn)
 {
+    static MemBuf mb = MemBufNULL;
     char const *icon = mimeGetIcon(fn);
 
     if (icon == NULL)
         return null_string;
 
-    return internalLocalUri("/squid-internal-static/icons/", icon);
+    if (Config.icons.use_short_names) {
+        memBufReset(&mb);
+        memBufPrintf(&mb, "/squid-internal-static/icons/%s", icon);
+        return mb.buf;
+    } else {
+        return internalLocalUri("/squid-internal-static/icons/", icon);
+    }
 }
 
 char *
index 51e576f0fbb9db0ccfff21812dcef4ef6bc72838..67c4103d05d3380d084163565e97b00a003ace19 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.486 2004/04/04 15:05:13 hno Exp $
+ * $Id: structs.h,v 1.487 2004/04/04 23:17:48 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -622,6 +622,7 @@ struct _SquidConfig
     struct
     {
         char *directory;
+        int use_short_names;
     }
 
     icons;