Permalink
Browse files

Merges the Front-Line Cache branch.

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6574 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent e2af228 commit a68f41b1dbb918f39d6695c42bdccf8d301b0f36 @alobbs alobbs committed May 3, 2011
Showing with 3,832 additions and 912 deletions.
  1. +3 −3 README
  2. +165 −28 admin/PageEntry.py
  3. +3 −0 admin/PageRule.py
  4. +12 −2 admin/PageVServer.py
  5. +7 −0 admin/wizards/php.py
  6. +7 −1 cherokee/Makefile.am
  7. +75 −655 cherokee/avl.c
  8. +30 −20 cherokee/avl.h
  9. +461 −0 cherokee/avl_flcache.c
  10. +97 −0 cherokee/avl_flcache.h
  11. +712 −0 cherokee/avl_generic.c
  12. +102 −0 cherokee/avl_generic.h
  13. +8 −6 cherokee/buffer.c
  14. +24 −0 cherokee/common-internal.h
  15. +47 −22 cherokee/config_entry.c
  16. +28 −21 cherokee/config_entry.h
  17. +8 −2 cherokee/connection-protected.h
  18. +254 −91 cherokee/connection.c
  19. +12 −0 cherokee/error_list.py
  20. +725 −0 cherokee/flcache.c
  21. +105 −0 cherokee/flcache.h
  22. +0 −8 cherokee/handler.h
  23. +2 −2 cherokee/handler_cgi.c
  24. +2 −4 cherokee/handler_file.c
  25. +1 −1 cherokee/handler_proxy.c
  26. +10 −1 cherokee/handler_server_info.c
  27. +7 −1 cherokee/header.c
  28. +1 −0 cherokee/header.h
  29. +1 −1 cherokee/iocache.c
  30. +2 −2 cherokee/logger_writer.c
  31. +1 −0 cherokee/macros.h
  32. +1 −1 cherokee/main_admin.c
  33. +2 −2 cherokee/rrd_tools.c
  34. +3 −0 cherokee/server-protected.h
  35. +29 −3 cherokee/server.c
  36. +2 −2 cherokee/shm.c
  37. +1 −1 cherokee/source_interpreter.c
  38. +61 −6 cherokee/thread.c
  39. +39 −0 cherokee/util.c
  40. +5 −3 cherokee/util.h
  41. +134 −3 cherokee/virtual_server.c
  42. +2 −0 cherokee/virtual_server.h
  43. +2 −0 configure.in
  44. +3 −1 constants.h.pre
  45. +1 −0 doc/Makefile.am
  46. +67 −15 doc/config_virtual_servers_rule.txt
  47. +1 −0 doc/index.txt
  48. BIN doc/media/images/admin_advanced0.png
  49. BIN doc/media/images/admin_advanced1.png
  50. BIN doc/media/images/admin_advanced2.png
  51. BIN doc/media/images/admin_advanced3.png
  52. BIN doc/media/images/admin_advanced4.png
  53. BIN doc/media/images/admin_advanced5.png
  54. BIN doc/media/images/admin_behavior.png
  55. BIN doc/media/images/admin_general.png
  56. BIN doc/media/images/admin_general_icons.png
  57. BIN doc/media/images/admin_general_mime.png
  58. BIN doc/media/images/admin_general_networking.png
  59. BIN doc/media/images/admin_general_permissions.png
  60. BIN doc/media/images/admin_general_ports.png
  61. BIN doc/media/images/admin_handler_admin.png
  62. BIN doc/media/images/admin_handler_cgi.png
  63. BIN doc/media/images/admin_handler_custom_error.png
  64. BIN doc/media/images/admin_handler_dbslayer.png
  65. BIN doc/media/images/admin_handler_dirlist.png
  66. BIN doc/media/images/admin_handler_dirlist_ex.png
  67. BIN doc/media/images/admin_handler_fastcgi1.png
  68. BIN doc/media/images/admin_handler_fastcgi2.png
  69. BIN doc/media/images/admin_handler_file.png
  70. BIN doc/media/images/admin_handler_onlylisting.png
  71. BIN doc/media/images/admin_handler_onlylisting_ex.png
  72. BIN doc/media/images/admin_handler_proxy.png
  73. BIN doc/media/images/admin_handler_secdownload.png
  74. BIN doc/media/images/admin_index.png
  75. BIN doc/media/images/admin_index_backup.png
  76. BIN doc/media/images/admin_index_restore.png
  77. BIN doc/media/images/admin_info_sources.png
  78. BIN doc/media/images/admin_launch.png
  79. BIN doc/media/images/admin_noconfig.png
  80. BIN doc/media/images/admin_notrunning.png
  81. BIN doc/media/images/admin_rule_regex.png
  82. BIN doc/media/images/admin_validators_authlist.png
  83. BIN doc/media/images/admin_validators_ldap.png
  84. BIN doc/media/images/admin_validators_pam.png
  85. BIN doc/media/images/admin_validators_plain.png
  86. BIN doc/media/images/admin_vserver.png
  87. BIN doc/media/images/admin_vserver_errors.png
  88. BIN doc/media/images/admin_vserver_evhost.png
  89. BIN doc/media/images/admin_vserver_loggers.png
  90. BIN doc/media/images/admin_vserver_security.png
  91. BIN doc/media/images/admin_vserver_wizard.png
  92. BIN doc/media/images/admin_vservers_wizard.png
  93. BIN doc/media/images/cookbook_alfresco_alfresco.png
  94. BIN doc/media/images/cookbook_alfresco_assistant.png
  95. BIN doc/media/images/cookbook_alfresco_install.png
  96. BIN doc/media/images/cookbook_alfresco_path.png
  97. BIN doc/media/images/cookbook_alfresco_share.png
  98. BIN doc/media/images/cookbook_alfresco_soffice.png
  99. BIN doc/media/images/cookbook_dbslayer1.png
  100. BIN doc/media/images/cookbook_dbslayer2.png
  101. BIN doc/media/images/cookbook_dbslayer3.png
  102. BIN doc/media/images/cookbook_dbslayer4.png
  103. BIN doc/media/images/cookbook_django.png
  104. BIN doc/media/images/cookbook_django_common.png
  105. BIN doc/media/images/cookbook_django_infosources.png
  106. BIN doc/media/images/cookbook_drupal.png
  107. BIN doc/media/images/cookbook_drupal_dir_rules.png
  108. BIN doc/media/images/cookbook_drupal_dir_rules_1.png
  109. BIN doc/media/images/cookbook_drupal_dir_rules_2.png
  110. BIN doc/media/images/cookbook_drupal_dir_rules_3.png
  111. BIN doc/media/images/cookbook_drupal_dir_rules_4.png
  112. BIN doc/media/images/cookbook_drupal_dir_rules_6.png
  113. BIN doc/media/images/cookbook_drupal_dir_rules_7.png
  114. BIN doc/media/images/cookbook_drupal_vserver_rules.png
  115. BIN doc/media/images/cookbook_glassfish.png
  116. BIN doc/media/images/cookbook_https_accelerator_handler.png
  117. BIN doc/media/images/cookbook_https_accelerator_sources.png
  118. BIN doc/media/images/cookbook_joomla.png
  119. BIN doc/media/images/cookbook_liferay.png
  120. BIN doc/media/images/cookbook_mailman.png
  121. BIN doc/media/images/cookbook_maintenance_advanced_domains.png
  122. BIN doc/media/images/cookbook_maintenance_advanced_redir.png
  123. BIN doc/media/images/cookbook_maintenance_advanced_rules.png
  124. BIN doc/media/images/cookbook_maintenance_copy.png
  125. BIN doc/media/images/cookbook_maintenance_domain.png
  126. BIN doc/media/images/cookbook_maintenance_error.png
  127. BIN doc/media/images/cookbook_maintenance_result.png
  128. BIN doc/media/images/cookbook_maintenance_rule.png
  129. BIN doc/media/images/cookbook_managing_logs_handler.png
  130. BIN doc/media/images/cookbook_managing_logs_rules.png
  131. BIN doc/media/images/cookbook_managing_logs_security.png
  132. BIN doc/media/images/cookbook_mono_demo.png
  133. BIN doc/media/images/cookbook_mono_handler.png
  134. BIN doc/media/images/cookbook_moodle.png
  135. BIN doc/media/images/cookbook_moodle_db.png
  136. BIN doc/media/images/cookbook_moodle_document_root.png
  137. BIN doc/media/images/cookbook_moodle_modules.png
  138. BIN doc/media/images/cookbook_moodle_paths.png
  139. BIN doc/media/images/cookbook_mysql_rule.png
  140. BIN doc/media/images/cookbook_mysql_validator.png
  141. BIN doc/media/images/cookbook_nagios1.png
  142. BIN doc/media/images/cookbook_nagios2.png
  143. BIN doc/media/images/cookbook_nagios3.png
  144. BIN doc/media/images/cookbook_nagios4.png
  145. BIN doc/media/images/cookbook_phpbb_1_intro.png
  146. BIN doc/media/images/cookbook_phpbb_2_req.png
  147. BIN doc/media/images/cookbook_phpbb_3_db.png
  148. BIN doc/media/images/cookbook_phpbb_4_admin.png
  149. BIN doc/media/images/cookbook_phpbb_5_config.png
  150. BIN doc/media/images/cookbook_phpbb_6_advanced.png
  151. BIN doc/media/images/cookbook_phpbb_7_create.png
  152. BIN doc/media/images/cookbook_phpbb_8_final.png
  153. BIN doc/media/images/cookbook_phpbb_adm.png
  154. BIN doc/media/images/cookbook_phpbb_adm_warning.png
  155. BIN doc/media/images/cookbook_phpbb_rules.png
  156. BIN doc/media/images/cookbook_phpbb_running.png
  157. BIN doc/media/images/cookbook_phpmyadmin.png
  158. BIN doc/media/images/cookbook_phpmyadmin_denied.png
  159. BIN doc/media/images/cookbook_redir_behavior.png
  160. BIN doc/media/images/cookbook_redir_domains.png
  161. BIN doc/media/images/cookbook_redir_handler.png
  162. BIN doc/media/images/cookbook_redir_https.png
  163. BIN doc/media/images/cookbook_ror.png
  164. BIN doc/media/images/cookbook_ror_common.png
  165. BIN doc/media/images/cookbook_ror_fcgi.png
  166. BIN doc/media/images/cookbook_ror_wizard.png
  167. BIN doc/media/images/cookbook_sugarcrm_install0.png
  168. BIN doc/media/images/cookbook_sugarcrm_install1.png
  169. BIN doc/media/images/cookbook_sugarcrm_running0.png
  170. BIN doc/media/images/cookbook_sugarcrm_running1.png
  171. BIN doc/media/images/cookbook_symfony.png
  172. BIN doc/media/images/cookbook_trac.png
  173. BIN doc/media/images/cookbook_trac_info.png
  174. BIN doc/media/images/cookbook_trac_rules.png
  175. BIN doc/media/images/cookbook_trac_scgi.png
  176. BIN doc/media/images/cookbook_trac_static.png
  177. BIN doc/media/images/cookbook_wp1.png
  178. BIN doc/media/images/cookbook_wp2.png
  179. BIN doc/media/images/cookbook_wp3.png
  180. BIN doc/media/images/cookbook_wp4.png
  181. BIN doc/media/images/cookbook_wp5.png
  182. BIN doc/media/images/cookbook_wp_example1.png
  183. BIN doc/media/images/cookbook_wp_example2.png
  184. BIN doc/media/images/cookbook_wp_example3.png
  185. BIN doc/media/images/cookbook_zend1.png
  186. BIN doc/media/images/market_index.png
  187. BIN doc/media/images/other_graphs_conns.png
  188. BIN doc/media/images/other_graphs_logging.png
  189. BIN doc/media/images/other_graphs_timeouts.png
  190. BIN doc/media/images/other_graphs_traffic.png
  191. BIN doc/media/images/proxy_phase1.png
  192. BIN doc/media/images/proxy_phase2.png
  193. BIN doc/media/images/screencast.png
  194. BIN doc/media/images/tracelor.png
  195. +1 −0 doc/other.txt
  196. +66 −0 doc/other_front_line_cache.txt
  197. +12 −0 doc/other_goodies.txt
  198. +1 −1 qa/122-Methods.py
  199. +41 −0 qa/273-Flcache-basic1.py
  200. +52 −0 qa/274-Flcache-cookie1.py
  201. +56 −0 qa/275-Flcache-cookie2.py
  202. +53 −0 qa/276-Flcache-headers1.py
  203. +53 −0 qa/277-Flcache-headers2.py
  204. +60 −0 qa/278-Flcache-gzip1.py
  205. +51 −0 qa/279-Flcache-expired1.py
  206. +51 −0 qa/280-Flcache-expired2.py
  207. +55 −0 qa/281-Flcache-expired3.py
  208. +11 −1 qa/Makefile.am
  209. +4 −2 qa/base.py
View
6 README
@@ -35,7 +35,7 @@ Mailing lists
IRC channel
-----------
- irc.freenode.net, channel #cherokee
+ irc.freenode.net, channel #cherokee
Building from a tar.gz file
@@ -94,13 +94,13 @@ FAQ
How to build a MacOS X binary package
-----------------------------------
./autogen.sh --prefix=/usr/local --with-wwwroot=/Library/WebServer/Documents --with-wwwuser=www --with-wwwgroup=www --with-mysql=no --with-ffmpeg=no --with-ldap=no --enable-beta
- make -j4
+ make -j8
packages/osx/build.py
Development
-----------
./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-static-module=all --enable-static --enable-shared=no --with-mysql=no --with-ffmpeg=no --with-ldap=no --enable-beta --enable-trace --enable-backtraces --enable-maintainer-mode
- make CFLAGS="-ggdb -O0" -j4
+ make CFLAGS="-ggdb -O0" -j8
How to cross compile the Win32 version
--------------------------------------
View
@@ -36,9 +36,10 @@
from configured import *
URL_BASE = r'^/vserver/([\d]+)/rule/content/([\d]+)/?$'
-URL_APPLY = r'^/vserver/([\d]+)/rule/content/([\d]+)/apply$'
URL_CLONE = r'^/vserver/([\d]+)/rule/content/([\d]+)/clone$'
-URL_HEADER_OP_APPLY = r'^/vserver/([\d]+)/rule/content/([\d]+)/header_op$'
+URL_APPLY = r'^/vserver/([\d]+)/rule/content/([\d]+)/apply$'
+URL_HEADER_OP_APPLY = r'^/vserver/([\d]+)/rule/content/([\d]+)/apply/header_op$'
+URL_FLCACHE_APPLY = r'^/vserver/([\d]+)/rule/content/([\d]+)/apply/flcache$'
NOTE_TIMEOUT = N_('Apply a custom timeout to the connections matching this rule.')
NOTE_HANDLER = N_('How the connection will be handled.')
@@ -48,6 +49,9 @@
NOTE_EXPIRATION = N_('Points how long the files should be cached')
NOTE_RATE = N_("Set an outbound traffic limit. It must be specified in Bytes per second.")
NOTE_NO_LOG = N_("Do not log requests matching this rule.")
+NOTE_FLCACHE = N_("Allow the server to cache the responses from this rule.")
+NOTE_FLCACHE_POLICY = N_("How to behave when a response does not explicitly set a caching status.")
+NOTE_FLCACHE_COOKIES = N_("Allow to cache responses setting cookies. (Defualt: No)")
NOTE_EXPIRATION_TIME = N_("""How long from the object can be cached.<br />
The <b>m</b>, <b>h</b>, <b>d</b> and <b>w</b> suffixes are allowed for minutes, hours, days, and weeks. Eg: 2d.
""")
@@ -57,6 +61,7 @@
NOTE_CACHING_NO_TRANSFORM = N_("Forbid intermediate caches from transforming the content.")
NOTE_CACHING_MUST_REVALIDATE = N_("The client must contact the server to revalidate the object.")
NOTE_CACHING_PROXY_REVALIDATE = N_("Proxy servers must contact the server to revalidate the object.")
+NOTE_FLCACHE_EXPERIMENTAL = N_("This caching mechanism should still be considered an experimental technology. Use it with caution.")
VALIDATIONS = [
("vserver![\d]+!rule![\d]+!document_root", validations.is_dev_null_or_local_dir_exists),
@@ -80,6 +85,17 @@
('forbid', N_('Forbid'))
]
+FLCACHE_OPTIONS = [
+ ('', N_('Leave unset')),
+ ('allow', N_('Allow Caching')),
+ ('forbid', N_('Forbid Caching'))
+]
+
+FLCACHE_POLICIES = [
+ ('explicitly_allowed', N_('Only explicitly cacheable responses')),
+ ('all_but_forbidden', N_('All except explicitly forbidden responses'))
+]
+
HEADER_OP_OPTIONS = [
('add', N_('Add')),
('del', N_('Remove'))
@@ -94,11 +110,21 @@ def Clone():
return CTK.cfg_reply_ajax_ok()
-class TrafficWidget (CTK.Container):
+class RestrictionsWidget (CTK.Container):
def __init__ (self, vsrv, rule, apply):
CTK.Container.__init__ (self)
pre = 'vserver!%s!rule!%s' %(vsrv, rule)
+ # Timeout
+ table = CTK.PropsTable()
+ table.Add (_('Timeout'), CTK.TextCfg ('%s!timeout'%(pre), True), _(NOTE_TIMEOUT))
+ submit = CTK.Submitter (apply)
+ submit += table
+
+ self += CTK.RawHTML ("<h2>%s</h2>" % (_('Connections Timeout')))
+ self += CTK.Indenter (submit)
+
+ # Traffic Shaping
table = CTK.PropsTable()
table.Add (_('Limit traffic to'), CTK.TextCfg ('%s!rate'%(pre), False), _(NOTE_RATE))
submit = CTK.Submitter (apply)
@@ -173,7 +199,7 @@ def HeaderOp_Apply():
class HeaderOps (CTK.Container):
class OpsTable (CTK.Box):
- def __init__ (self, pre, apply, refresh):
+ def __init__ (self, pre, apply_url, refresh):
CTK.Box.__init__ (self)
def reorder (arg, pre=pre):
@@ -197,7 +223,7 @@ def reorder (arg, pre=pre):
value = CTK.TextCfg('%s!value' %(pre2))
delete = CTK.ImageStock('del')
- delete.bind('click', CTK.JS.Ajax (apply, data = {pre2: ''},
+ delete.bind('click', CTK.JS.Ajax (apply_url, data = {pre2: ''},
complete = refresh.JS_to_refresh()))
if type_ == 'add':
@@ -210,13 +236,14 @@ def reorder (arg, pre=pre):
self += table
- def __init__ (self, vsrv, rule, apply):
+ def __init__ (self, vsrv, rule, apply_orig):
CTK.Container.__init__ (self)
pre = 'vserver!%s!rule!%s' %(vsrv, rule)
+ apply_url = '%s/header_op'%(apply_orig)
# Operation Table
refresh = CTK.Refreshable({'id': 'header_op'})
- refresh.register (lambda: HeaderOps.OpsTable(pre, apply, refresh).Render())
+ refresh.register (lambda: HeaderOps.OpsTable(pre, apply_orig, refresh).Render())
self += CTK.RawHTML ("<h2>%s</h2>" % (_('Header Operations')))
self += CTK.Indenter (refresh)
@@ -236,15 +263,127 @@ def __init__ (self, vsrv, rule, apply):
selector = ','.join (['#%s'%(row[3].id) for row in table])
tipe.bind('change', "if ($(this).val()=='add'){ $('%s').show(); }else{ $('%s').hide();}" %(selector, selector))
- submit = CTK.Submitter ('/vserver/%s/rule/content/%s/header_op'%(vsrv, rule))
+ submit = CTK.Submitter (apply_url)
submit.bind ('submit_success', refresh.JS_to_refresh())
submit += table
self += CTK.RawHTML ('<h3>%s</h3>'%(_('Add New Header')))
self += CTK.Indenter (submit)
-class TimeWidget (CTK.Container):
+class FrontLine_Cache (CTK.Container):
+ class Apply:
+ def __call__ (self):
+ tmp = re.findall (r'^/vserver/([\d]+)/rule/content/([\d]+)/', CTK.request.url)
+ vsrv = tmp[0][0]
+ rule = tmp[0][1]
+
+ # Main operarion
+ op = CTK.post.pop('op')
+
+ if op == "docache_add":
+ # Validation
+ new_docache = CTK.post.pop('new_flcache_docache')
+ if not new_docache:
+ return {'ret':'error', 'errors': {'new_flcache_docache': _("Can not be empty")}}
+
+ # Add the configuration entries
+ next_pre = CTK.cfg.get_next_entry_prefix ('vserver!%s!rule!%s!flcache!cookies!do_cache'%(vsrv, rule))
+
+ CTK.cfg['%s!regex'%(next_pre)] = new_docache
+ return CTK.cfg_reply_ajax_ok()
+
+ elif op == "docache_del":
+ pre = 'vserver!%s!rule!%s!flcache!cookies!do_cache'%(vsrv, rule)
+
+ to_del = CTK.post.pop('to_del')
+ if to_del:
+ del (CTK.cfg['%s!%s'%(pre, to_del)])
+
+ return CTK.cfg_reply_ajax_ok()
+
+ return CTK.cfg_apply_post()
+
+
+ class docache_Table (CTK.Box):
+ def __init__ (self, pre, apply_url, refresh):
+ CTK.Box.__init__ (self)
+
+ do_cache_keys = CTK.cfg.keys('%s!cookies!do_cache'%(pre))
+
+ if do_cache_keys:
+ table = CTK.Table()
+ table.set_header(1)
+ table += [CTK.RawHTML(_('Regular Expressions'))]
+
+ submit = CTK.Submitter (apply_url)
+ submit += CTK.Indenter (table, 2)
+ self += submit
+
+ for k in do_cache_keys:
+ pre2 = '%s!cookies!do_cache!%s!regex'%(pre, k)
+ value = CTK.TextCfg (pre2, False)
+ remove = CTK.ImageStock('del')
+ remove.bind('click', CTK.JS.Ajax (apply_url, data = {'op':'docache_del', 'to_del':k},
+ complete = refresh.JS_to_refresh()))
+ table += [value, remove]
+
+
+ def __init__ (self, vsrv, rule, apply_url):
+ CTK.Container.__init__ (self)
+ pre = 'vserver!%s!rule!%s!flcache' %(vsrv, rule)
+ apply_url = '%s/flcache'%(apply_url)
+
+ # Enable
+ rest = CTK.Box()
+ combo = CTK.ComboCfg (pre, trans_options(FLCACHE_OPTIONS))
+ combo_js = "if ($('#%s').val() == 'allow'){ $('#%s').show(); }else{ $('#%s').hide(); }"%(combo.id, rest.id, rest.id)
+ combo.bind ('change', combo_js)
+
+ table = CTK.PropsTable()
+ table.Add (_('Content Caching'), combo, _(NOTE_FLCACHE))
+
+ submit = CTK.Submitter (apply_url)
+ submit += table
+
+ self += CTK.Indenter(submit)
+ self += rest
+ self += CTK.RawHTML (js=combo_js)
+
+ # Front-Line Cache Policies
+ table = CTK.PropsTable()
+ table.Add (_('Responses to cache'), CTK.ComboCfg ('%s!policy'%(pre), trans_options(FLCACHE_POLICIES)), _(NOTE_FLCACHE_POLICY))
+
+ submit = CTK.Submitter (apply_url)
+ submit += table
+
+ rest += CTK.RawHTML ('<h3>%s</h3>' %(_("Caching Policy")))
+ rest += CTK.Indenter(submit)
+
+ # Disregard Cookies
+ refresh = CTK.Refreshable ({'id': 'docache'})
+ refresh.register (lambda: FrontLine_Cache.docache_Table(pre, apply_url, refresh).Render())
+
+ new_regex = CTK.TextField ({'name': 'new_flcache_docache', 'class': 'noauto'})
+ new_add = CTK.SubmitterButton (_('Add'))
+
+ table = CTK.Table()
+ table.set_header(1)
+ table += [CTK.RawHTML(_('New Regular Expression'))]
+ table += [new_regex, new_add]
+
+ submit = CTK.Submitter (apply_url)
+ submit.bind ('submit_success', refresh.JS_to_refresh() + new_regex.JS_to_clean())
+ submit += CTK.Indenter (table, 2)
+ submit += CTK.Hidden ('op', 'docache_add')
+
+ rest += CTK.RawHTML ('<h3>%s</h3>' %(_('Disregarded Cookies')))
+ rest += refresh
+ rest += submit
+
+
+
+class CachingWidget (CTK.Container):
class Expiration (CTK.Container):
def __init__ (self, pre, apply, refresh):
CTK.Container.__init__ (self)
@@ -274,32 +413,26 @@ def __init__ (self, vsrv, rule, apply):
CTK.Container.__init__ (self)
pre = 'vserver!%s!rule!%s' %(vsrv, rule)
- # Timeout
- table = CTK.PropsTable()
- table.Add (_('Timeout'), CTK.TextCfg ('%s!timeout'%(pre), True), _(NOTE_TIMEOUT))
- submit = CTK.Submitter (apply)
- submit += table
-
- self += CTK.RawHTML ("<h2>%s</h2>" % (_('Connections Timeout')))
- self += CTK.Indenter (submit)
-
# Expiration
refresh = CTK.Refreshable({'id': 'time_expiration'})
- refresh.register (lambda: TimeWidget.Expiration(pre, apply, refresh).Render())
+ refresh.register (lambda: CachingWidget.Expiration(pre, apply, refresh).Render())
self += CTK.RawHTML ("<h2>%s</h2>" % (_('Content Expiration')))
self += CTK.Indenter (refresh)
- # tmp
- self += HeaderOps (vsrv, rule, apply)
+ # Front-line cache
+ self += CTK.RawHTML ("<h2>%s</h2>" % (_('Cache')))
+ self += CTK.Indenter (CTK.Notice (content = CTK.RawHTML(NOTE_FLCACHE_EXPERIMENTAL)))
+ self += FrontLine_Cache (vsrv, rule, apply)
-class EncodingWidget (CTK.Container):
+class TransformsWidget (CTK.Container):
def __init__ (self, vsrv, rule, apply):
CTK.Container.__init__ (self)
pre = 'vserver!%s!rule!%s!encoder' %(vsrv, rule)
encoders = trans_options(Cherokee.support.filter_available (ENCODERS))
+ # Encoders
self += CTK.RawHTML ("<h2>%s</h2>" % (_('Information Encoders')))
for e,e_name in encoders:
@@ -324,6 +457,9 @@ def __init__ (self, vsrv, rule, apply):
if CTK.cfg.get_val(key) in ['1', 'allow']:
self += CTK.Indenter (module, 2)
+ # Header Operations
+ self += HeaderOps (vsrv, rule, apply)
+
class RuleWidget (CTK.Refreshable):
class Content (CTK.Container):
@@ -407,12 +543,12 @@ def __call__ (self):
# Tabs
tabs = CTK.Tab()
- tabs.Add (_('Rule'), RuleWidget (vsrv_num, rule_num, url_apply, refresh))
- tabs.Add (_('Handler'), HandlerWidget (vsrv_num, rule_num, url_apply))
- tabs.Add (_('Encoding'), EncodingWidget (vsrv_num, rule_num, url_apply))
- tabs.Add (_('Time'), TimeWidget (vsrv_num, rule_num, url_apply))
- tabs.Add (_('Security'), SecurityWidget (vsrv_num, rule_num, url_apply))
- tabs.Add (_('Traffic Shaping'), TrafficWidget (vsrv_num, rule_num, url_apply))
+ tabs.Add (_('Rule'), RuleWidget (vsrv_num, rule_num, url_apply, refresh))
+ tabs.Add (_('Handler'), HandlerWidget (vsrv_num, rule_num, url_apply))
+ tabs.Add (_('Transforms'), TransformsWidget (vsrv_num, rule_num, url_apply))
+ tabs.Add (_('Caching'), CachingWidget (vsrv_num, rule_num, url_apply))
+ tabs.Add (_('Security'), SecurityWidget (vsrv_num, rule_num, url_apply))
+ tabs.Add (_('Restrictions'), RestrictionsWidget (vsrv_num, rule_num, url_apply))
cont = CTK.Container()
cont += refresh
@@ -426,3 +562,4 @@ def __call__ (self):
CTK.publish (URL_CLONE, Clone, method="POST")
CTK.publish (URL_APPLY, CTK.cfg_apply_post, validation=VALIDATIONS, method="POST")
CTK.publish (URL_HEADER_OP_APPLY, HeaderOp_Apply, validation=VALIDATIONS, method="POST")
+CTK.publish (URL_FLCACHE_APPLY, FrontLine_Cache.Apply, validation=VALIDATIONS, method="POST")
View
@@ -187,6 +187,9 @@ def __init__ (self, refresh, right_box, vsrv_num):
elif val == 'forbid':
comment.append ("no %s"%(e))
+ if CTK.cfg.get_val ('vserver!%s!rule!%s!flcache'%(vsrv_num, r)) == "allow":
+ comment.append ('cache')
+
if CTK.cfg.get_val ('vserver!%s!rule!%s!timeout' %(vsrv_num, r)):
comment.append ('timeout')
View
@@ -144,6 +144,7 @@ def validation_ca_list (text):
(N_('Custom Document Root'), N_('Root')),
(N_('Only HTTPS'), N_('Secure')),
(N_('Encoders'), N_('Enc')),
+ (N_('Cacheable'), N_('Cache')),
(N_('Expiration'), N_('Exp')),
(N_('Connection Timeout'), N_('Timeout')),
(N_('Traffic Shaping'), N_('Shaping')),
@@ -368,7 +369,7 @@ def _get_row (self, vsrv_num, r):
rule_name = rule.GetName()
link = RuleLink (vsrv_num, r, CTK.RawHTML ('<span title="%s">%s</span>' %(rule_name, rule_name)))
- handler, auth, root, secure, enc, exp, timeout, shaping, log, final, active = [None for x in range(11)]
+ handler, auth, root, secure, enc, exp, flcache, timeout, shaping, log, final, active = [None for x in range(12)]
tmp = CTK.cfg.get_val ('vserver!%s!rule!%s!handler'%(vsrv_num, r), '')
if tmp:
@@ -424,14 +425,23 @@ def _get_row (self, vsrv_num, r):
tmp = _('Prevents further rule evaluation')
final = CTK.ImageStock('tick', {'alt': tmp, 'title': tmp})
+ tmp = CTK.cfg.get_val('vserver!%s!rule!%s!flcache'%(vsrv_num,r))
+ if tmp in ('allow', '1'):
+ tmp = _('Content can be cached')
+ flcache = CTK.ImageStock('tick', {'alt': tmp, 'title': tmp})
+ elif tmp in ('forbid', '0'):
+ tmp = _('Forbids content caching')
+ flcache = CTK.ImageStock ('forbid', {'alt': tmp, 'title': tmp})
+
+
tmp = not bool (int (CTK.cfg.get_val('vserver!%s!rule!%s!disabled'%(vsrv_num,r), "0")))
if tmp:
tmp = _('Rule is active')
active = CTK.ImageStock('tick', {'alt': tmp, 'title': tmp})
else:
active = CTK.Box({'class': 'inactive-rule'})
- return [link, handler, auth, root, secure, enc, exp, timeout, shaping, log, final, active]
+ return [link, handler, auth, root, secure, enc, flcache, exp, timeout, shaping, log, final, active]
class BasicsWidget (CTK.Container):
Oops, something went wrong.

0 comments on commit a68f41b

Please sign in to comment.