You probably see what I want to have pulled. #2

Closed
wants to merge 16 commits into
from
Commits
Jump to file or symbol
Failed to load files and symbols.
+1,427 −17
Split
View
@@ -40,6 +40,7 @@
PRODUCT_TOKENS = [
('', N_('Default')),
+ ('void', N_('No server string')),
('product', N_('Product only')),
('minor', N_('Product + Minor version')),
('minimal', N_('Product + Minimal version')),
@@ -68,6 +69,7 @@
('admin', N_('Remote Administration')),
('empty_gif', N_('1x1 Transparent GIF')),
('drop', N_('Drop Connection')),
+ ('tile', N_('Renderd Frontend')),
]
ERROR_HANDLERS = [
@@ -186,6 +188,7 @@
RULES = [
('directory', N_('Directory')),
('extensions', N_('Extensions')),
+ ('filetime', N_('File Time')),
('request', N_('Regular Expression')),
('header', N_('Header')),
('exists', N_('File Exists')),
@@ -21,6 +21,7 @@ extensions.py \
failover.py \
fcgi.py \
file.py \
+filetime.py \
from.py \
fullpath.py \
geoip.py \
@@ -44,9 +45,11 @@ rrd.py \
scgi.py \
secdownload.py \
server_info.py \
+sphinx.py \
ssi.py \
streaming.py \
target_ip.py \
+tile.py \
url_arg.py \
uwsgi.py \
wildcard.py \
View
@@ -0,0 +1,102 @@
+# Cheroke Admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+# Stefan de Konink <stefan@konink.de>
+#
+# Copyright (C) 2009-2010 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import CTK
+
+from Rule import RulePlugin
+from util import *
+
+URL_APPLY = '/plugin/filetime/apply'
+
+NOTE_STATPROP = N_("The time propery of the file to match against.")
+NOTE_OPERATOR = N_("What operator should be used to match the property against the value.")
+NOTE_TIMESTAMP = N_("Unix timestamp")
+
+STATPROPS = [
+ ('', _('Choose')),
+ ('atime', _('Access Time')),
+ ('ctime', _('Creation Time')),
+ ('mtime', _('Modification Time'))
+]
+
+OPERATORS = [
+ ('', _('Choose')),
+ ('le', _('less equal')),
+ ('ge', _('greater equal')),
+ ('eq', _('equal')),
+ ('lenow', _('less equal now +')),
+ ('genow', _('greater equal now +'))
+]
+
+def commit():
+ # POST info
+ key = CTK.post.pop ('key', None)
+ vsrv_num = CTK.post.pop ('vsrv_num', None)
+ new_stat = CTK.post.pop ('tmp!stat', None)
+ new_time = CTK.post.pop ('tmp!time', None)
+ new_op = CTK.post.pop ('tmp!op', None)
+
+ # New entry
+ if new_stat:
+ next_rule, next_pre = cfg_vsrv_rule_get_next ('vserver!%s'%(vsrv_num))
+
+ CTK.cfg['%s!match'%(next_pre)] = 'filetime'
+ CTK.cfg['%s!match!stat'%(next_pre)] = new_stat
+ CTK.cfg['%s!match!time'%(next_pre)] = new_time
+ CTK.cfg['%s!match!op'%(next_pre)] = new_op
+
+ return {'ret': 'ok', 'redirect': '/vserver/%s/rule/%s' %(vsrv_num, next_rule)}
+
+ # Modifications
+ return CTK.cfg_apply_post()
+
+
+class Plugin_filetime (RulePlugin):
+ def __init__ (self, key, **kwargs):
+ RulePlugin.__init__ (self, key)
+ is_new = key.startswith('tmp')
+ props = ({},{'class': 'noauto'})[is_new]
+
+ op_widget = CTK.ComboCfg ('%s!op'%(key), OPERATORS, props)
+ op_val = CTK.cfg.get_val ('%s!op'%(key), 'regex')
+
+ table = CTK.PropsTable()
+ table.Add (_('Property'), CTK.ComboCfg('%s!stat'%(key), STATPROPS, props), _(NOTE_STATPROP))
+ table.Add (_('Operator'), op_widget, _(NOTE_OPERATOR))
+ table.Add (_('Unix Timestamp'), CTK.TextCfg('%s!time'%(key), False, props), _(NOTE_TIMESTAMP))
+
+ submit = CTK.Submitter (URL_APPLY)
+ submit += CTK.Hidden ('key', key)
+ submit += CTK.Hidden ('vsrv_num', kwargs.pop('vsrv_num', ''))
+ submit += table
+ self += submit
+
+ # Validation, and Public URLs
+ CTK.publish (URL_APPLY, commit, method="POST")
+
+ def GetName (self):
+ stat = CTK.cfg.get_val ('%s!stat' %(self.key), '')
+ time = CTK.cfg.get_val ('%s!time' %(self.key), '')
+ op = CTK.cfg.get_val ('%s!op' %(self.key), '')
+
+ return "%s %s %s %s" % (_("File"), stat, op, time)
View
@@ -38,7 +38,7 @@
NOTE_USER = N_('User name for connecting to the database.')
NOTE_PASSWD = N_('Password for connecting to the database.')
NOTE_DB = N_('Database name containing the user/password pair list.')
-NOTE_SQL = N_('SQL command to execute. ${user} is replaced with the user name.')
+NOTE_SQL = N_('SQL command to execute. ${user} is replaced with the user name and ${passwd} is replaced with the user supplied password.')
NOTE_HASH = N_('Choose an encryption type for the password. Only suitable for the "Basic" authentication mechanism.')
HASHES = [
View
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+# Stefan de Konink <stefan@konink.de>
+#
+# Copyright (C) 2011 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import CTK
+import Handler
+import Cherokee
+import Balancer
+
+from util import *
+from consts import *
+
+URL_APPLY = '/plugin/sphinx/apply'
+
+NOTE_LANG = N_("Language from which the information will be consumed.")
+NOTE_DB = N_("Index to connect to.")
+
+
+class Plugin_sphinx (Handler.PluginHandler):
+ def __init__ (self, key, **kwargs):
+ kwargs['show_document_root'] = False
+ Handler.PluginHandler.__init__ (self, key, **kwargs)
+ Handler.PluginHandler.AddCommon (self)
+
+ # DB-Slayer alike
+ table = CTK.PropsTable()
+ table.Add (_('Language'), CTK.ComboCfg('%s!lang'%(key), trans_options(DWRITER_LANGS)), _(NOTE_LANG))
+ table.Add (_('Index'), CTK.TextCfg('%s!index'%(key), True), _(NOTE_DB))
+
+ submit = CTK.Submitter (URL_APPLY)
+ submit += table
+
+ self += CTK.RawHTML ("<h2>%s</h2>" %(_('Serialization')))
+ self += CTK.Indenter (submit)
+
+ # Load Balancing (currently only one source is actually used!)
+ modul = CTK.PluginSelector('%s!balancer'%(key), trans_options(Cherokee.support.filter_available (BALANCERS)))
+ table = CTK.PropsTable()
+ table.Add (_("Balancer"), modul.selector_widget, _(Balancer.NOTE_BALANCER))
+
+ self += CTK.RawHTML ('<h2>%s</h2>' %(_('Data Base Balancing')))
+ self += CTK.Indenter (table)
+ self += modul
+
+CTK.publish ('^%s$'%(URL_APPLY), CTK.cfg_apply_post, method="POST")
View
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+# Stefan de Konink <stefan@konink.de>
+#
+# Copyright (C) 2010 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import CTK
+import Handler
+import Cherokee
+import validations
+import Balancer
+
+from util import *
+from consts import *
+
+NOTE_TIMEOUT = N_("A value in seconds after which we don't wait for the rendering anymore.")
+NOTE_EXPIRATION_TIME = N_("""How long the older tile should 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: 10m.
+""")
+
+URL_APPLY = '/plugin/tile/apply'
+HELPS = []
+
+VALIDATIONS = [
+ ("vserver![\d]+!rule![\d]+!handler!timeout", validations.is_number),
+ ("vserver![\d]+!rule![\d]+!handler!expiration", validations.is_time)
+]
+
+class Plugin_tile (Handler.PluginHandler):
+ def __init__ (self, key, **kwargs):
+ kwargs['show_document_root'] = False
+ Handler.PluginHandler.__init__ (self, key, **kwargs)
+ Handler.PluginHandler.AddCommon (self)
+
+ # GUI
+ table = CTK.PropsAuto (URL_APPLY)
+ table.Add (_("Static Tile Expiration"), CTK.TextCfg('%s!expiration'%(key), True), _(NOTE_EXPIRATION_TIME))
+ table.Add (_("Render Timeout"), CTK.TextCfg('%s!timeout'%(key), True), _(NOTE_TIMEOUT))
+ self += CTK.Indenter (table)
+
+ # Load Balancing
+ modul = CTK.PluginSelector('%s!balancer'%(key), trans_options(Cherokee.support.filter_available (BALANCERS)))
+ table = CTK.PropsTable()
+ table.Add (_("Balancer"), modul.selector_widget, _(Balancer.NOTE_BALANCER))
+
+ self += CTK.RawHTML ('<h2>%s</h2>' %(_('Renderd Balancing')))
+ self += CTK.Indenter (table)
+ self += modul
+
+CTK.publish ('^%s$'%(URL_APPLY), CTK.cfg_apply_post, validation=VALIDATIONS, method="POST")
View
@@ -150,6 +150,23 @@ dynamic_rule_extensions_lib = libplugin_extensions.la
endif
+#
+# Rule filetime
+#
+rule_filetime = \
+rule_filetime.c \
+rule_filetime.h
+
+libplugin_filetime_la_LDFLAGS = $(module_ldflags)
+libplugin_filetime_la_SOURCES = $(rule_filetime)
+
+if STATIC_RULE_FILETIME
+static_rule_filetime_src = $(rule_filetime)
+else
+dynamic_rule_filetime_lib = libplugin_filetime.la
+endif
+
+
#
# Rule request
#
@@ -550,6 +567,43 @@ else
dynamic_handler_file_lib = libplugin_file.la
endif
+#
+# Handler sphinx
+#
+handler_sphinx = \
+handler_sphinx.h \
+handler_sphinx.c
+
+libplugin_sphinx_la_LDFLAGS = $(module_ldflags) $(SPHINXCLIENT_LDFLAGS)
+libplugin_sphinx_la_SOURCES = $(handler_sphinx)
+libplugin_sphinx_la_CFLAGS = $(SPHINXCLIENT_CFLAGS)
+
+if HAVE_SPHINXCLIENT
+if STATIC_HANDLER_SPHINX
+static_handler_sphinx_src = $(handler_sphinx)
+static_handler_sphinx_lib = $(SPHINXCLIENT_LDFLAGS)
+static_handler_sphinx_flags = $(SPHINXCLIENT_CFLAGS)
+else
+dynamic_handler_sphinx_lib = libplugin_sphinx.la
+endif
+endif
+
+#
+# Handler tile
+#
+handler_tile = \
+handler_tile.c \
+handler_tile.h
+
+libplugin_tile_la_LDFLAGS = $(module_ldflags)
+libplugin_tile_la_SOURCES = $(handler_tile)
+
+if STATIC_HANDLER_TILE
+static_handler_tile_src = $(handler_tile)
+else
+dynamic_handler_tile_lib = libplugin_tile.la
+endif
+
#
# Handler dirlist
@@ -1502,6 +1556,7 @@ endif
libcherokee_server_la_SOURCES = \
$(static_rule_directory_src) \
$(static_rule_extensions_src) \
+$(static_rule_filetime_src) \
$(static_rule_request_src) \
$(static_rule_header_src) \
$(static_rule_exists_src) \
@@ -1529,6 +1584,8 @@ $(static_handler_post_report_src) \
$(static_collector_rrd_src) \
\
$(static_handler_file_src) \
+$(static_handler_sphinx_src) \
+$(static_handler_tile_src) \
$(static_handler_dirlist_src) \
$(static_handler_cgi_src) \
$(static_handler_fcgi_src) \
@@ -1696,6 +1753,7 @@ plugindir = "$(libdir)/cherokee"
plugin_LTLIBRARIES = \
$(dynamic_rule_directory_lib) \
$(dynamic_rule_extensions_lib) \
+$(dynamic_rule_filetime_lib) \
$(dynamic_rule_request_lib) \
$(dynamic_rule_header_lib) \
$(dynamic_rule_exists_lib) \
@@ -1718,6 +1776,8 @@ $(dynamic_gen_evhost_lib) \
$(dynamic_post_track_lib) \
$(dynamic_handler_post_report_lib) \
$(dynamic_handler_file_lib) \
+$(dynamic_handler_sphinx_lib) \
+$(dynamic_handler_tile_lib) \
$(dynamic_handler_server_info_lib) \
$(dynamic_handler_render_rrd_lib) \
$(dynamic_handler_dirlist_lib) \
Oops, something went wrong.