diff web/templog.py @ 277:0a1c02160e66

merge
author Matt Johnston <matt@ucc.asn.au>
date Tue, 17 Nov 2015 22:26:35 +0800
parents 205809a8872f 9be8464e4295
children 788d713f6b87 6bacd8ca9f8f
line wrap: on
line diff
--- a/web/templog.py	Tue Nov 17 22:26:00 2015 +0800
+++ b/web/templog.py	Tue Nov 17 22:26:35 2015 +0800
@@ -69,6 +69,12 @@
 
 @route('/set/update', method='post')
 def set_update():
+    if not secure.check_user_hash(config.ALLOWED_USERS):
+        # the "Save" button should be disabled if the cert wasn't
+        # good
+        response.status = 403
+        return "No cert, dodginess"
+
     post_json = json.loads(request.forms.data)
 
     csrf_blob = post_json['csrf_blob']
@@ -79,7 +85,7 @@
 
     ret = log.update_params(post_json['params'])
     if not ret is True:
-        response.status = 403
+        response.status = 409 # Conflict
         return ret
         
     return "Good"
@@ -157,6 +163,11 @@
     #var_lookup = environ['mod_ssl.var_lookup']
     #return var_lookup("SSL_SERVER_I_DN_O")
 
+@route('/h')
+def headers():
+    response.set_header('Content-Type', 'text/plain')
+    return '\n'.join("%s: %s" % x for x in request.headers.items())
+
 @route('/get_settings')
 def get_settings():
     response.set_header('Cache-Control', 'no-cache')