Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Ensure configuration uses correct HTTP methods as per RFC 3253 #34

Merged
merged 2 commits into from Oct 3, 2012
Jump to file or symbol
Failed to load files and symbols.
+43 −2
Split
View
@@ -192,3 +192,14 @@ How to create a self signed certificate for TLS
openssl req -days 1000 -new -x509 -nodes -out /etc/cherokee/ssl/cherokee.pem -keyout /etc/cherokee/ssl/cherokee.pem
+How to create a release .tar.gz
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+::
+ git clone --recursive http://github.com/cherokee/webserver.git
+ cd webserver
+ ./autogen.sh
+ make dist-gzip
+
+The resulting file will be created in the current directory and will be
+a ``.tar.gz`` archive.
View
@@ -71,6 +71,32 @@ def upgrade_to_1_0_13 (cfg):
elif val == '0':
del(cfg[key])
+# Converts to 1.2.102
+METHODS_MAP = {'baseline_control': 'baseline-control',
+ 'version_control': 'version-control'
+ }
+def update_rules_methods(cfg, key, node):
+ if node.value == 'method':
+ method_key = '%s!method' % key
+ method_value = cfg.get_val(method_key)
+ # Check rule's method key value and replace if problematic
+ if method_value in METHODS_MAP:
+ cfg[method_key] = METHODS_MAP[method_value]
+ else:
+ for k in node.keys():
+ child_key = '%s!%s' % (key, k)
+ child_node = cfg[child_key]
+ update_rules_methods(cfg, child_key, child_node)
+
+def upgrade_to_1_2_102 (cfg):
+ # Update HTTP method specifications for those that were incorrect
+
+ for v in cfg.keys('vserver'):
+ for r in cfg.keys('vserver!%s!rule' % (v)):
+ # Traverse rules and look for HTTP method 'match' elements
+ rule_key = 'vserver!%s!rule!%s!match' % (v,r)
+ rule_node = cfg[rule_key]
+ update_rules_methods(cfg, rule_key, rule_node)
def config_version_get_current():
ver = configured.VERSION.split ('b')[0]
@@ -145,5 +171,9 @@ def config_version_update_cfg (cfg):
if ver_config_i < 1000013:
upgrade_to_1_0_13 (cfg)
+ # Update to.. 1.2.102
+ if ver_config_i < 1002102:
+ upgrade_to_1_2_102 (cfg)
+
cfg["config!version"] = ver_release_s
return True
View
@@ -52,15 +52,15 @@
('unsubscribe', 'UNSUBSCRIBE'),
('report', 'REPORT'),
('patch', 'PATCH'),
- ('version_control', 'VERSION_CONTROL'),
+ ('version-control', 'VERSION-CONTROL'),
('checkout', 'CHECKOUT'),
('uncheckout', 'UNCHECKOUT'),
('checkin', 'CHECKIN'),
('update', 'UPDATE'),
('label', 'LABEL'),
('mkworkspace', 'MKWORKSPACE'),
('mkactivity', 'MKACTIVITY'),
- ('baseline_control', 'BASELINE_CONTROL'),
+ ('baseline-control', 'BASELINE-CONTROL'),
('merge', 'MERGE')
]