From: hno <> Date: Mon, 5 Apr 2004 05:17:48 +0000 (+0000) Subject: Bug #856: Icon URLs are uneededly complex X-Git-Tag: SQUID_3_0_PRE4~1108 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e72a0ec05aa1d5622203c84d8723cd5416d3315d;p=thirdparty%2Fsquid.git Bug #856: Icon URLs are uneededly complex 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. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 2e4709c4b0..70f799ff14 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 diff --git a/src/client_side.cc b/src/client_side.cc index 821d6b344e..803ed4062f 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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; diff --git a/src/mime.cc b/src/mime.cc index 74fe6277ae..3a3a21da4d 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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 * diff --git a/src/structs.h b/src/structs.h index 51e576f0fb..67c4103d05 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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;