r620 - in zope-cachefu/branches/upstream/current: . CMFSquidTool
CacheSetup CacheSetup/Extensions CacheSetup/tests
PageCacheManager PolicyHTTPCacheManager squid squid/templates
Fabio Tranchitella
kobold at alioth.debian.org
Fri Feb 9 14:48:42 CET 2007
Author: kobold
Date: 2007-02-09 14:48:41 +0100 (Fri, 09 Feb 2007)
New Revision: 620
Removed:
zope-cachefu/branches/upstream/current/MemcachedManager/
Modified:
zope-cachefu/branches/upstream/current/CMFSquidTool/SquidTool.py
zope-cachefu/branches/upstream/current/CMFSquidTool/version.txt
zope-cachefu/branches/upstream/current/CacheSetup/Extensions/Install.py
zope-cachefu/branches/upstream/current/CacheSetup/VERSION.txt
zope-cachefu/branches/upstream/current/CacheSetup/config.py
zope-cachefu/branches/upstream/current/CacheSetup/patch_cmf.py
zope-cachefu/branches/upstream/current/CacheSetup/tests/test_functional.py
zope-cachefu/branches/upstream/current/PageCacheManager/version.txt
zope-cachefu/branches/upstream/current/PolicyHTTPCacheManager/PolicyHTTPCacheManager.py
zope-cachefu/branches/upstream/current/README.txt
zope-cachefu/branches/upstream/current/squid/makeconfig
zope-cachefu/branches/upstream/current/squid/squid.cfg
zope-cachefu/branches/upstream/current/squid/templates/iRedirector.py
zope-cachefu/branches/upstream/current/squid/templates/squid.conf
zope-cachefu/branches/upstream/current/squid/templates/squidRewriteRules.py
Log:
[svn-upgrade] Integrating new upstream version, zope-cachefu (1.0.2)
Modified: zope-cachefu/branches/upstream/current/CMFSquidTool/SquidTool.py
===================================================================
--- zope-cachefu/branches/upstream/current/CMFSquidTool/SquidTool.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/CMFSquidTool/SquidTool.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -12,7 +12,7 @@
#
##############################################################################
"""
-$Id: SquidTool.py 24614 2006-06-09 00:03:28Z alecm $
+$Id: SquidTool.py 31140 2006-09-28 14:08:14Z wichert $
"""
import os, re, httplib, urlparse, urllib, sys
@@ -29,6 +29,7 @@
from Products.CMFCore.utils import UniqueObject, getToolByName
from Products.CMFSquidTool.Permissions import *
from Products.CMFSquidTool.utils import pruneUrl
+from Products.CMFSquidTool.utils import logger
URL_REWRITE_MAP = {}
Modified: zope-cachefu/branches/upstream/current/CMFSquidTool/version.txt
===================================================================
--- zope-cachefu/branches/upstream/current/CMFSquidTool/version.txt 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/CMFSquidTool/version.txt 2007-02-09 13:48:41 UTC (rev 620)
@@ -1 +1 @@
-1.3.0
+1.3.1
Modified: zope-cachefu/branches/upstream/current/CacheSetup/Extensions/Install.py
===================================================================
--- zope-cachefu/branches/upstream/current/CacheSetup/Extensions/Install.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/CacheSetup/Extensions/Install.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -490,7 +490,8 @@
rule.setContentTypes(['Document', 'Event', 'Link', 'News Item', 'Image', 'File'])
rule.setDefaultView(True)
rule.setTemplates([])
- rule.setCacheStop(['portal_status_message'])
+ rule.setCacheStop(['portal_status_message', 'statusmessages',
+ 'SearchableText'])
rule.setLastModifiedExpression('python:object.modified()')
rule.setHeaderSetIdAnon('cache-in-memory')
rule.setHeaderSetIdAuth('cache-with-etag')
@@ -509,7 +510,8 @@
rule.setContentTypes(['Topic', 'Folder', 'Plone Site', 'Large Plone Folder'])
rule.setDefaultView(True)
rule.setTemplates(['folder_contents', 'RSS'])
- rule.setCacheStop(['portal_status_message'])
+ rule.setCacheStop(['portal_status_message', 'statusmessages',
+ 'SearchableText'])
rule.setLastModifiedExpression('python:object.modified()')
rule.setHeaderSetIdAnon('cache-in-memory')
rule.setHeaderSetIdAuth('cache-with-etag')
@@ -526,7 +528,8 @@
rule.setTitle('Templates')
rule.setDescription('Rule for various non-form templates. Both anonymous and authenticated users are served pages from memory, not the proxy cache, because some of these templates depend on catalog queries. Member ID is used in the ETag because content is personalized; the time of the last catalog change is included so that the contents and the navigation tree stays up to date.')
rule.setTemplates(['accessibility-info','sitemap','recently_modified'])
- rule.setCacheStop(['portal_status_message'])
+ rule.setCacheStop(['portal_status_message', 'statusmessages',
+ 'SearchableText'])
rule.setLastModifiedExpression('python:object.modified()')
rule.setHeaderSetIdAnon('cache-in-memory')
rule.setHeaderSetIdAuth('cache-with-etag')
Modified: zope-cachefu/branches/upstream/current/CacheSetup/VERSION.txt
===================================================================
--- zope-cachefu/branches/upstream/current/CacheSetup/VERSION.txt 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/CacheSetup/VERSION.txt 2007-02-09 13:48:41 UTC (rev 620)
@@ -1 +1 @@
-1.0.1
+1.0.2
Modified: zope-cachefu/branches/upstream/current/CacheSetup/config.py
===================================================================
--- zope-cachefu/branches/upstream/current/CacheSetup/config.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/CacheSetup/config.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -1,4 +1,4 @@
-from zLOG import LOG, INFO
+from zLOG import LOG, INFO, BLATHER
# BBB: CMF < 1.5
try:
from Products.CMFCore.permissions import AddPortalContent
@@ -19,7 +19,7 @@
MACRO_CACHE_SIZE = 500 # maximum number of cached objects
MACRO_CACHE_AGE = 3600 # maximum age of a cached object in seconds
-def log(msg):
- LOG(PROJECT_NAME, INFO, msg)
+def log(msg, level=BLATHER):
+ LOG(PROJECT_NAME, level, msg)
Modified: zope-cachefu/branches/upstream/current/CacheSetup/patch_cmf.py
===================================================================
--- zope-cachefu/branches/upstream/current/CacheSetup/patch_cmf.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/CacheSetup/patch_cmf.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -19,26 +19,38 @@
self._updateFromFS() # Make sure the template has been loaded.
+ # We may have a template that renders other templates internally,
+ # we need to ensure that only the outermost templates headers are applied
+ inner_template = False
if not source:
request = self.REQUEST
- object = self.getParentNode()
- view = self.getId()
- member = pcs.getMember()
- (rule, header_set) = pcs.getRuleAndHeaderSet(request, object, view, member)
- if header_set is not None:
- expr_context = rule._getExpressionContext(request, object, view, member, keywords=extra_context)
+ response = request.RESPONSE
+ # Check to see if we have already started rendering an outer template:
+ if response.getHeader('x-cache-rules-applied') is not None:
+ inner_template = True
+ rule = header_set = None
else:
- expr_context = None
+ object = self.getParentNode()
+ view = self.getId()
+ member = pcs.getMember()
+ (rule, header_set) = pcs.getRuleAndHeaderSet(request, object, view, member)
+ if header_set is not None:
+ expr_context = rule._getExpressionContext(request, object, view, member, keywords=extra_context)
+ else:
+ expr_context = None
+ # Set a header to indicate that we searched for header rules
+ # for the primary template
+ response['x-cache-rules-applied'] = 'yes'
- # If we have a conditional get, set status 304 and return
- # no content
- if _checkConditionalGET(self, extra_context, rule, header_set, expr_context):
- return ''
-
+ # If we have a conditional get, set status 304 and return
+ # no content
+ if _checkConditionalGET(self, extra_context, rule, header_set, expr_context):
+ return ''
+
result = FSPageTemplate.inheritedAttribute('pt_render')(
self, source, extra_context
)
- if not source:
+ if not source and not inner_template:
_setCacheHeaders(self, extra_context, rule, header_set, expr_context)
return result
@@ -65,22 +77,34 @@
raise PTRuntimeError, (
'Page Template %s has errors: %s' % (self.id, e))
+ # We may have a template that renders other templates internally,
+ # we need to ensure that only the outermost templates headers are applied
+ inner_template = False
if not source:
# If we have a conditional get, set status 304 and return
# no content
request = self.REQUEST
- object = self.getParentNode()
- view = self.getId()
- member = pcs.getMember()
- (rule, header_set) = pcs.getRuleAndHeaderSet(request, object, view, member)
- if header_set is not None:
- expr_context = rule._getExpressionContext(request, object, view, member, keywords=extra_context)
+ response = request.RESPONSE
+ # Check to see if we have already started rendering an outer template:
+ if response.getHeader('x-cache-rules-applied') is not None:
+ inner_template = True
+ rule = header_set = None
else:
- expr_context = None
+ object = self.getParentNode()
+ view = self.getId()
+ member = pcs.getMember()
+ (rule, header_set) = pcs.getRuleAndHeaderSet(request, object, view, member)
+ if header_set is not None:
+ expr_context = rule._getExpressionContext(request, object, view, member, keywords=extra_context)
+ else:
+ expr_context = None
+ # Set a header to indicate that we searched for header rules
+ # for the primary template
+ response['x-cache-rules-applied'] = 'yes'
- if _checkConditionalGET(self, extra_context, rule, header_set, expr_context):
- return ''
-
+ if _checkConditionalGET(self, extra_context, rule, header_set, expr_context):
+ return ''
+
output = self.StringIO()
c = self.pt_getContext()
c.update(extra_context)
@@ -113,7 +137,7 @@
context._scope_stack = None
result = output.getvalue()
- if not source:
+ if not source and not inner_template:
_setCacheHeaders(self, extra_context, rule, header_set, expr_context)
return result
Modified: zope-cachefu/branches/upstream/current/CacheSetup/tests/test_functional.py
===================================================================
--- zope-cachefu/branches/upstream/current/CacheSetup/tests/test_functional.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/CacheSetup/tests/test_functional.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -20,6 +20,15 @@
from Products.CacheSetup.Extensions.Install import install as installCacheSetup
import Products.CacheSetup.config as config
+COMPOSITE_TEMPLATE = '''
+<html>
+ <body>
+ <h1>A template that renders another template internally</h1>
+ <div tal:replace="here/doc" />
+ </body>
+</html>
+'''
+
# util for making content in a container
def makeContent(container, id, portal_type, title=None):
container.invokeFactory(id=id, type_name=portal_type)
@@ -288,13 +297,11 @@
ob_path = '/'+f.absolute_url(1)+'/download'
response = self.publish(ob_path)
self.assertEqual(response.status, 302)
- self.failUnless(response.getHeader('location').find('login_form') != -1)
# anonymous download, alternate url
ob_path = '/'+f.absolute_url(1)
response = self.publish(ob_path)
self.assertEqual(response.status, 302)
- self.failUnless(response.getHeader('location').find('login_form') != -1)
# authenticated download
ob_path = '/'+f.absolute_url(1)+'/download'
@@ -308,6 +315,36 @@
self.assertEqual(response.headers.get('x-caching-rule-id',None), 'downloads')
self.assertEqual(response.headers.get('x-header-set-id',None), 'no-cache')
+ def test_composite_template(self):
+ # Add a document to be rendered inside our composite template
+ d = makeContent(self.portal, 'doc', 'Document', 'My document')
+ # Add our composite template
+ self.portal.manage_addProduct['PageTemplates'].manage_addPageTemplate(
+ 'compo_template', title='A Composite Template',
+ text=COMPOSITE_TEMPLATE)
+ ob_path = '/'+self.portal.absolute_url(1)+'/compo_template'
+ # Our template is not associated with any rules, so let's ensure it
+ # doesn't pick up rules for rendered sub-objects
+ response = self.publish(ob_path)
+ self.assertEqual(response.headers.get('x-caching-rule-id',None), None)
+ self.assertEqual(response.headers.get('x-header-set-id',None), None)
+ response = self.publish(ob_path, basic='%s:%s' % (self.USER1, 'secret'))
+ self.assertEqual(response.headers.get('x-caching-rule-id',None), None)
+ self.assertEqual(response.headers.get('x-header-set-id',None), None)
+ # Let's associate this template with a cache manager to make sure that
+ # it has headers set appropriately
+ pcs = getattr(self.portal, config.CACHE_TOOL_ID)
+ rule = pcs.rules['plone-templates']
+ templates = rule.getTemplates()
+ rule.setTemplates(templates + ('compo_template',))
+ response = self.publish(ob_path)
+ self.assertEqual(response.headers.get('x-caching-rule-id',None), 'plone-templates')
+ self.assertEqual(response.headers.get('x-header-set-id',None), 'cache-in-memory')
+ # When authenticated we get different headers
+ response = self.publish(ob_path, basic='%s:%s' % (self.USER1, 'secret'))
+ self.assertEqual(response.headers.get('x-caching-rule-id',None), 'plone-templates')
+ self.assertEqual(response.headers.get('x-header-set-id',None), 'cache-with-etag')
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(CacheManagerTest))
Modified: zope-cachefu/branches/upstream/current/PageCacheManager/version.txt
===================================================================
--- zope-cachefu/branches/upstream/current/PageCacheManager/version.txt 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/PageCacheManager/version.txt 2007-02-09 13:48:41 UTC (rev 620)
@@ -1 +1 @@
-1.0.1
+1.0.2 (SVN/UNRELEASED)
Modified: zope-cachefu/branches/upstream/current/PolicyHTTPCacheManager/PolicyHTTPCacheManager.py
===================================================================
--- zope-cachefu/branches/upstream/current/PolicyHTTPCacheManager/PolicyHTTPCacheManager.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/PolicyHTTPCacheManager/PolicyHTTPCacheManager.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -16,7 +16,7 @@
the response so that downstream caches will cache
according to a common policy.
-$Id: PolicyHTTPCacheManager.py 22667 2006-04-26 08:48:10Z plonista $
+$Id: PolicyHTTPCacheManager.py 27007 2006-08-09 16:15:32Z dreamcatcher $
"""
import time
@@ -99,10 +99,8 @@
# Grab only the numeric part
status = status.split(' ')[0]
if not status in ('200', '304'):
- REQUEST.setHeader('Pragma', 'no-cache')
- REQUEST.setHeader('Expires', 'Sat, 1 Jan 2000 00:00:00 GMT')
- REQUEST.setHeader('Cache-Control',
- 'max-age=0,s-maxage=0,must-revalidate')
+ # Don't muck with the caching headers at all in this
+ # case.
return
# Only then increment hits
Modified: zope-cachefu/branches/upstream/current/README.txt
===================================================================
--- zope-cachefu/branches/upstream/current/README.txt 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/README.txt 2007-02-09 13:48:41 UTC (rev 620)
@@ -1,6 +1,6 @@
See CacheSetup/docs/audiences.rest for more documentation
-CacheFu should work with Plone 2.0/2.1/2.5 and CMF 1.4.8/1.5/1.6
+Tested with Plone 2.5, Plone 2.1.3, Plone 2.1.2, Plone 2.0.5 and CMF 1.4.8/1.5/1.6
IMPORTANT: If you have a pre-beta CacheFu installation, you MUST
uninstall it before putting any of the CacheFu code into your Products
@@ -104,7 +104,7 @@
If squid blocks your access to a particular page, uncomment the line
'debug_options ALL, 1 33,2' in squid.conf, reconfigure squid, then
-look at '/var/log/squid/access.log'.
+look at '/var/log/squid/cache.log'.
The redirector and external ACL python scripts can all log their
activity. Set 'debug=1' in each of the .py files to see what they are
@@ -511,7 +511,7 @@
If Squid blocks your access to a particular page, uncomment the line
'debug_options ALL, 1 33,2' in squid.conf, reconfigure Squid, then
-look at '/var/log/squid/access.log'.
+look at '/var/log/squid/cache.log'.
The redirector and external ACL python scripts can all log their
activity. Set 'debug=1' in each of the .py files to see what they are
Modified: zope-cachefu/branches/upstream/current/squid/makeconfig
===================================================================
--- zope-cachefu/branches/upstream/current/squid/makeconfig 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/squid/makeconfig 2007-02-09 13:48:41 UTC (rev 620)
@@ -31,7 +31,9 @@
c.read(config_file)
values = {
'unique_values': unique_values, # helper function
+ 'hostname': c.get('host', 'name'),
'python_binary': c.get('python', 'binary'),
+ 'squid_version': c.get('squid', 'version'),
'squid_binary': c.get('squid', 'binary'),
'squid_user': c.get('squid', 'user'),
'squid_config_dir': c.get('squid', 'config_dir'),
@@ -39,6 +41,7 @@
'squid_cache_dir': c.get('squid', 'cache_dir'),
'squid_cache_size_mb': c.getint('squid', 'cache_size_mb'),
'squid_direct': c.getboolean('squid', 'direct'),
+ 'squid_address': c.get('squid', 'address'),
'squid_port': c.getint('squid', 'port'),
'squid_admin_email': c.get('squid', 'admin_email')
}
Modified: zope-cachefu/branches/upstream/current/squid/squid.cfg
===================================================================
--- zope-cachefu/branches/upstream/current/squid/squid.cfg 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/squid/squid.cfg 2007-02-09 13:48:41 UTC (rev 620)
@@ -1,3 +1,7 @@
+[host]
+
+name: server.mysite.com
+
[python]
# python binary
binary: /usr/bin/python
@@ -3,8 +7,11 @@
[squid]
+# squid version
+version: 2.5
# squid binary file
binary: /usr/sbin/squid
# effective user for the squid daemon
-user: proxy
+# proxy on freebsd ?
+user: squid
# directory for squid configuration files
config_dir: /etc/squid
@@ -16,7 +23,9 @@
# maximum size of disk cache in MB (should be at most 85% of available disk space)
cache_size_mb: 1000
# squid serves the site directly (True) or squid runs behind apache (False)
-direct: True
+direct: False
+# squid address when squid runs behind apache
+address: 127.0.0.1
# squid port when squid runs behind apache
port: 3128
# email address displayed on squid error pages
@@ -25,7 +34,7 @@
[supported-protocols]
# protocols and ports supported by the site
http: 80
-https: 443
+#https: 443
[accelerated-hosts]
# urls to be accelerated with corresponding zope urls, ports, and directories
Modified: zope-cachefu/branches/upstream/current/squid/templates/iRedirector.py
===================================================================
--- zope-cachefu/branches/upstream/current/squid/templates/iRedirector.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/squid/templates/iRedirector.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -41,7 +41,8 @@
# NOTE: having this turned on saves a lot of resources
# only turn this on when having redirect_concurrency in squid.conf
# set to something other than 0
-threaded = 0
+<tal:squid condition="python: squid_version <= 2.5">threaded = 0</tal:squid>
+<tal:squid condition="python: squid_version > 2.5">threaded = 1</tal:squid>
# the logfile for the redirector log (only used when debug is 1)
logfile = "<tal:log replace="squid_log_dir" />/squid/iRedirector.log"
@@ -116,7 +117,7 @@
log("request : " + line)
# format url, src, ident, method
- url, src_address, ident, method = line.split(" ")
+ url, src_address, ident, method = line.split(" ")[:4] #XXX - need to make 100% sure these fields aren't rearranged in squid 2.6/3.0 protocol
# send through redirector class
new_url = squidRewriteRules.rewrite(url, src_address)
@@ -144,7 +145,7 @@
log("request : " + line)
# format index, url, src, ident, method
- index, url, src_address, ident, method = line.split(" ")
+ index, url, src_address, ident, method = line.split(" ")[:5] #XXX - need to make 100% sure these fields aren't rearranged in squid 2.6/3.0 protocol
# send through redirector class
new_url = squidRewriteRules.rewrite(url, src_address)
Modified: zope-cachefu/branches/upstream/current/squid/templates/squid.conf
===================================================================
--- zope-cachefu/branches/upstream/current/squid/templates/squid.conf 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/squid/templates/squid.conf 2007-02-09 13:48:41 UTC (rev 620)
@@ -9,6 +9,8 @@
# BASIC CONFIGURATION
# ------------------------------------------------------------------------------
+visible_hostname <tal:hostname replace="hostname" />
+
<tal:effective_user tal:condition="not:squid_direct">
# The user and group that squid will run as when started as root
# (ignored if you don't run squid as root)
@@ -17,8 +19,13 @@
</tal:effective_user>
# port on which to listen
+<tal:port condition="python: squid_version <= 2.5">
<tal:port condition="squid_direct">http_port 80</tal:port>
<tal:port condition="not:squid_direct">http_port <tal:port replace="squid_port" /></tal:port>
+</tal:port><tal:port condition="python: squid_version > 2.5">
+<tal:port condition="squid_direct">http_port 80 vhost defaultsite=<tal:port replace="hostname" /></tal:port>
+<tal:port condition="not:squid_direct">http_port <tal:port replace="squid_port" /> vhost defaultsite=<tal:port replace="hostname" /></tal:port>
+</tal:port>
# set cache directory and size (<tal:dir replace="squid_cache_size_mb" /> MB) - be sure to set the cache size to
# about 10% less than the physical space available to leave room for squid's
@@ -26,10 +33,12 @@
cache_dir ufs <tal:dir replace="squid_cache_dir" /> <tal:dir replace="squid_cache_size_mb" /> 16 256
cache_mgr <tal:email replace="squid_admin_email" />
+<tal:squid condition="python: squid_version <= 2.5">
# set squid up as a web accelerator
httpd_accel_host virtual
httpd_accel_port 0
httpd_accel_uses_host_header on
+</tal:squid>
# LOGS
@@ -58,7 +67,7 @@
acl ssl_ports port 443 563
acl safe_ports port 80 443
-acl zope_servers src <tal:ips repeat="ip zope_hosts"><tal:ip replace="ip" /> </tal:ips>
+acl zope_servers src <tal:ips repeat="ip zope_hosts"><tal:ip replace="ip" /> </tal:ips><tal:ips condition="python: '127.0.0.1' not in zope_hosts">127.0.0.1</tal:ips>
acl manager proto cache_object
acl connect method connect
@@ -70,7 +79,9 @@
acl accelerated_domains dstdomain <tal:hosts repeat="host hosts"><tal:host replace="host" /> </tal:hosts>
acl accelerated_ports myport <tal:ports repeat="port ports"><tal:port replace="port" /> </tal:ports>
-http_access allow accelerated_domains accelerated_ports accelerated_protocols
+http_access allow accelerated_domains
+http_access allow accelerated_ports
+http_access allow accelerated_protocols
</tal:acl><tal:acl tal:condition="not:squid_direct">
# Assumes apache rewrite rule looks like this:
# RewriteRule ^/(.*)/$ http://127.0.0.1:3128/http/%{SERVER_NAME}/80/$1 [L,P]
@@ -78,8 +89,13 @@
acl accelerated_hosts dst 127.0.0.0/8
acl accelerated_ports myport <tal:port replace="squid_port" />
<tal:proto repeat="ppinfo python:protocol_port_map.items()"><tal:hosts tal:define="proto python:ppinfo[0]; port python:ppinfo[1];" repeat="host hosts">
-acl accelerated_urls urlpath_regex ^/<tal:proto replace="proto" />/<tal:host replace="host" />/<tal:port replace="port" /></tal:hosts></tal:proto>
-http_access allow accelerated_hosts accelerated_ports accelerated_urls accelerated_protocols
+acl accelerated_urls urlpath_regex ^/<tal:proto replace="proto" />/<tal:host replace="host" />:<tal:port replace="port" /></tal:hosts></tal:proto>
+http_access allow accelerated_hosts
+<tal:acl condition="python: squid_version > 2.5">always_direct allow accelerated_hosts</tal:acl>
+http_access allow accelerated_ports
+<tal:acl condition="python: squid_version > 2.5">always_direct allow accelerated_ports</tal:acl>
+http_access allow accelerated_urls
+http_access allow accelerated_protocols
</tal:acl>
# Purge access - zope servers can purge but nobody else
@@ -137,11 +153,17 @@
# REDIRECTOR PROGRAM
# ------------------------------------------------------------------------------
+<tal:rewrite condition="python: squid_version <= 2.5">
redirect_program <tal:dir replace="squid_config_dir" />/iRedirector.py
redirect_children 20
redirect_rewrites_host_header off
+</tal:rewrite><tal:rewrite condition="python: squid_version > 2.5">
+url_rewrite_program <tal:dir replace="squid_config_dir" />/iRedirector.py
+url_rewrite_children 1
+url_rewrite_concurrency 20
+url_rewrite_host_header off
+</tal:rewrite>
-
# SPECIFY WHAT REQUESTS SQUID SHOULD CACHE
# ------------------------------------------------------------------------------
@@ -162,6 +184,7 @@
# If this is uncommented, squid will treat a url with 2 different query strings
# as 2 different urls when caching.
+# XXX: where did this example go?
# 4) Prevent squid from caching requests from authenticated users or conditional
# GETs with an If-None-Match header (since squid doesn't know about ETags)
@@ -174,10 +197,15 @@
# external_acl_type is_cacheable_type children=20 ttl=0 negative_ttl=0 %{Cookie:__ac} %{Cookie:;__ac} %{Authorization} %{If-None-Match} <tal:dir replace="squid_config_dir" />/squidAcl.py
-external_acl_type is_cacheable_type children=20 %{Cookie:__ac} %{Cookie:;__ac} %{Authorization} %{If-None-Match} <tal:dir replace="squid_config_dir" />/squidAcl.py
+external_acl_type is_cacheable_type protocol=2.5 children=20 %{Cookie:__ac} %{Cookie:;__ac} %{Authorization} %{If-None-Match} <tal:dir replace="squid_config_dir" />/squidAcl.py
acl is_cacheable external is_cacheable_type
no_cache allow is_cacheable
+<tal:squid condition="python: squid_version > 2.5">
+collapsed_forwarding on
+#refresh_stale_hit on
+</tal:squid>
+
# Explicitly disallow squid from handling anything else
no_cache deny all
Modified: zope-cachefu/branches/upstream/current/squid/templates/squidRewriteRules.py
===================================================================
--- zope-cachefu/branches/upstream/current/squid/templates/squidRewriteRules.py 2007-02-09 13:48:16 UTC (rev 619)
+++ zope-cachefu/branches/upstream/current/squid/templates/squidRewriteRules.py 2007-02-09 13:48:41 UTC (rev 620)
@@ -72,8 +72,8 @@
<tal:def define="proto python:ppinfo[0];
port python:ppinfo[1];">
<tal:direct condition="squid_direct">(r'^<tal:proto replace="proto" />://<tal:host replace="host" />/(.*)',</tal:direct>
- <tal:apache condition="not:squid_direct">(r'http://127.0.0.1:<tal:port replace="squid_port" />/<tal:proto replace="proto" />/<tal:host replace="host" />/<tal:port replace="port" />/(.*)',</tal:apache>
- r'http://<tal:ip replace="zope_host" />:<tal:port replace="zope_port" />/VirtualHostBase/<tal:proto replace="proto" />/<tal:host replace="host" />:<tal:port replace="port" />/<tal:path replace="zope_path" />/VirtualHostRoot/\1', 'P,L'),
+ <tal:apache condition="not:squid_direct">(r'http://<tal:squid replace="squid_address" /><tal:port condition="python: squid_version <= 2.5">:<tal:port replace="squid_port" /></tal:port>/<tal:proto replace="proto" />/<tal:host replace="host" />/<tal:port replace="port" />/(.*)',</tal:apache>
+ r'http://<tal:ip replace="zope_host" />:<tal:port replace="zope_port" />/VirtualHostBase/<tal:proto replace="proto" />/<tal:host replace="host" />:<tal:port replace="port" /><tal:path replace="zope_path" />/VirtualHostRoot/\1', 'P,L'),
</tal:def></tal:protos></tal:hosts>
)
More information about the pkg-zope-commits
mailing list