This is a multi-part message in MIME format.
--------------2670098E69A05E217576A42C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Here is a rewritten version of my patch for icons in a cache hierarchy,
this time it looks a lot cleaner.
What patch does is to change the icon URL format to
http://your.squid.server:port/squid-internal/icon_for/<filename>
where <filename> is the name of the file the icon should represent. This
is then trapped in clientRedirectDone and translated to the appropriate
/squid-internal/icons/<iconname>
I have also moved the squid-internal detection to clientRedirectDone to
allow the use of a redirector to redirect squid-internal requests to
this cache, mainly to support trapping of icons at the first Squid cache
if wanted. There is also a short piece of #ifdef:ed code that traps all
icons..
I did not change how ICP requests are handled this time.
My previous icon-url patch was way to ugly. Please throw it away.
/Henrik
--------------2670098E69A05E217576A42C
Content-Type: text/plain; charset=us-ascii; name="squid-1.2.beta20-1.icon_url.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="squid-1.2.beta20-1.icon_url.patch"
Index: squid/ChangeLog
diff -u squid/ChangeLog:1.1.1.19 squid/ChangeLog:1.1.1.19.2.1
--- squid/ChangeLog:1.1.1.19 Sat Apr 25 14:47:15 1998
+++ squid/ChangeLog Sat Apr 25 19:14:48 1998
@@ -1,3 +1,5 @@
+ - Changed icon URL style again, to allow the first Squid cache
+ in the cache hierarchy to decide on what to do.
- Added Italian error pages by Alessio Bragadini.
- Fixed asnAclInitialize calling to prevent coredump.
- Fixed FTP directory parsing again.
Index: squid/src/client_side.c
diff -u squid/src/client_side.c:1.1.1.19 squid/src/client_side.c:1.1.1.19.2.1
--- squid/src/client_side.c:1.1.1.19 Sat Apr 25 14:47:46 1998
+++ squid/src/client_side.c Sat Apr 25 19:14:54 1998
@@ -210,12 +210,36 @@
size_t l;
request_t *new_request = NULL;
request_t *old_request = http->request;
+ request_t *request = http->request; /* "current" request structure */
debug(33, 5) ("clientRedirectDone: '%s' result=%s\n", http->uri,
result ? result : "NULL");
assert(http->redirect_state == REDIRECT_PENDING);
http->redirect_state = REDIRECT_DONE;
if (result && strcmp(result, http->uri))
- new_request = urlParse(old_request->method, result);
+ request = new_request = urlParse(old_request->method, result);
+ assert(request!=NULL);
+ /* Detect internal requests */
+ if (!http->flags.internal)
+ if (0 == strNCmp(request->urlpath, "/squid-internal/", 16))
+ if (0 == strcasecmp(request->host, getMyHostname()))
+ if (request->port == Config.Port.http->i)
+ http->flags.internal = 1;
+#if CATCH_ALL_ICONS
+ /* Catch all icons (better done in a redirector..) */
+ if (!http->flags.internal)
+ if (0 == strNCmp(request->urlpath, "/squid-internal/icon_for/", 25))
+ http->flags.internal = 1;
+#endif
+ /* Map icons */
+ if (http->flags.internal) {
+ if (0 == strNCmp(request->urlpath, "/squid-internal/icon_for/", 25)) {
+ request_t *old_icon_request = requestLink(request);
+ result = mimeGetRealIconURL( strBuf(old_icon_request->urlpath) + 25);
+ request = new_request = urlParse(old_icon_request->method, result);
+ /* Free "redirected" request */
+ requestUnlink(old_icon_request);
+ }
+ }
if (new_request) {
safe_free(http->uri);
/* need to malloc because the URL returned by the redirector might
@@ -1989,11 +2013,6 @@
safe_free(headers);
break;
}
- if (!http->flags.internal)
- if (0 == strNCmp(request->urlpath, "/squid-internal/", 16))
- if (0 == strcasecmp(request->host, getMyHostname()))
- if (request->port == Config.Port.http->i)
- http->flags.internal = 1;
safe_free(http->log_uri);
http->log_uri = xstrdup(urlCanonicalClean(request));
request->client_addr = conn->peer.sin_addr;
Index: squid/src/mime.c
diff -u squid/src/mime.c:1.1.1.15 squid/src/mime.c:1.1.1.15.2.1
--- squid/src/mime.c:1.1.1.15 Sat Apr 25 14:47:51 1998
+++ squid/src/mime.c Sat Apr 25 19:14:54 1998
@@ -329,12 +329,18 @@
}
char *
-mimeGetIconURL(const char *fn)
+mimeGetRealIconURL(const char *fn)
{
char *icon = mimeGetIcon(fn);
- if (icon == NULL)
+ if (icon == NULL)
return NULL;
return urlInternal("icons", icon);
+}
+
+char *
+mimeGetIconURL(const char *fn)
+{
+ return urlInternal("icon_for", rfc1738_escape(fn));
}
char *
Index: squid/src/protos.h
diff -u squid/src/protos.h:1.1.1.19 squid/src/protos.h:1.1.1.19.2.1
--- squid/src/protos.h:1.1.1.19 Sat Apr 25 14:47:53 1998
+++ squid/src/protos.h Sat Apr 25 19:14:54 1998
@@ -462,6 +462,7 @@
extern char *mimeGetContentType(const char *fn);
extern char *mimeGetIcon(const char *fn);
extern char *mimeGetIconURL(const char *fn);
+extern char *mimeGetRealIconURL(const char *fn);
extern char mimeGetTransferMode(const char *fn);
extern int mcastSetTtl(int, int);
--------------2670098E69A05E217576A42C--
Received on Tue Jul 29 2003 - 13:15:48 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:45 MST