Search squid archive

URI suffix remove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Had a problem similar to http://www.squid-cache.org/mail-archive/squid-users/200501/0278.html
that is: to be able to ignore the suffix of the URI for caching and retrieving
purposes.

For example imagine you have the following URI request:

/mybanners/468x60N/lrec-pink3.swf?clicktag=http%3A//bverv.pt/event/Tffggfdf86%2C93%2C101%2C110%2C150%2C182%2C204%2C2674%2C2675%2C2679%2C3493%2C3671%2C3824%2C3854%2C4228%2C4252%2C6199%2C6363%2C6548%2C6650%2C6701%2C6824%2C6883%2C6884%2C6897%2C6971%2C7308%2C7309%2C73186%2C93%2C101%2C110%2C150%2C182%2C204%2C2674%2C2675%2C2679%2C3493%2C3671%2C3824%2C3854%2C4228%2C4252%2C6199%2C6363%2C6548%2C6650%2C6701%2C6824%2C6883%2C6884%2C6897%2C6971%2C7308%2C7309%2C731

In a not uncommon scenario files like these are served by a squid proxy.
And there's, of course, no server side use for that mumbo-jumbo.

But you either end not caching it or caching useless, always diferent, objects.

The solution would be to discard everything after (and including) the 1st '?'.

I've added a patch to do that:

#  TAG: uri_ender
#        A list of words/character which, if found in a URI, cause the remaining
#        of the URI, including this word/character to be ignored as if non-existant
#
#Default:
# none

It may be of use to someone and, most important, i'll have an easier time
finding it on the list archives than on the laptop.

Applies to squid-2.5.STABLE12.


-- 
Jose Celestino | http://xpto.org/~japc/files/japc-pgpkey.asc
----------------------------------------------------------------
"You just have to accept that some days you are the pigeon,
and some days you are the statue." - David Brent
diff -bur squid-2.5.STABLE12/src/cf.data.pre squid-2.5.STABLE12.japc/src/cf.data.pre
--- squid-2.5.STABLE12/src/cf.data.pre  2005-10-20 18:28:08.000000000 +0100
+++ squid-2.5.STABLE12.japc/src/cf.data.pre     2006-03-11 00:20:56.000000000 +0000
@@ -514,6 +514,16 @@
 DOC_END


+NAME: uri_ender
+TYPE: wordlist
+DEFAULT: none
+LOC: Config.uri_ender
+DOC_START
+        A list of words/character which, if found in a URI, cause the remaining
+        of the URI, including this word/character to be ignored as if non-existant
+DOC_END
+
+
 NAME: no_cache
 TYPE: acl_access
 DEFAULT: none
diff -bur squid-2.5.STABLE12/src/client_side.c squid-2.5.STABLE12.japc/src/client_side.c
--- squid-2.5.STABLE12/src/client_side.c        2005-10-18 16:22:26.000000000 +0100
+++ squid-2.5.STABLE12.japc/src/client_side.c   2006-03-11 00:09:00.000000000 +0000
@@ -2609,6 +2609,7 @@
     size_t req_sz;
     method_t method;
     clientHttpRequest *http = NULL;
+    const wordlist *p = NULL;
 #if IPF_TRANSPARENT
     struct natlookup natLookup;
     static int natfd = -1;
@@ -2748,6 +2750,12 @@
        *t = '\0';
 #endif

+    /* scan uri_ender */
+    for (p = Config.uri_ender; p; p = p->next)
+      if ((t = strstr(url, p->key))) /* remove cgi, swf, ... parameters */
+        *t = '\0';
+    debug(33, 5) ("parseHttpRequest: URI post uri_ender is '%s'\n", url);
+
     /* handle direct internal objects */
     if ((!Config2.Accel.on || Config.onoff.global_internal_static) && internalCheck(url)) {
        /* prepend our name & port */
diff -bur squid-2.5.STABLE12/src/structs.h squid-2.5.STABLE12.japc/src/structs.h
--- squid-2.5.STABLE12/src/structs.h    2005-09-03 10:14:43.000000000 +0100
+++ squid-2.5.STABLE12.japc/src/structs.h       2006-03-10 23:51:52.000000000 +0000
@@ -537,6 +537,7 @@
     squid_off_t tcpRcvBufsz;
     squid_off_t udpMaxHitObjsz;
     wordlist *hierarchy_stoplist;
+    wordlist *uri_ender;
     wordlist *mcast_group_list;
     wordlist *dns_testname_list;
     wordlist *dns_nameservers;


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux