Changeset

851:836e4e110c71

mod_register_json: add option to handle requests only on secure connections.
author Marco Cirillo <maranda@lightwitch.org>
date Tue, 23 Oct 2012 13:32:44 +0000
parents 850:0900ba54991e
children 852:6c2b77f97e62
files mod_register_json/mod_register_json.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_register_json/mod_register_json.lua	Wed Oct 17 03:47:15 2012 +0200
+++ b/mod_register_json/mod_register_json.lua	Tue Oct 23 13:32:44 2012 +0000
@@ -16,7 +16,7 @@
 
 -- Pick up configuration.
 
-local secure = module:get_option_boolean("reg_servlet_secure", true)
+local secure = module:get_option_boolean("reg_servlet_secure", false)
 local set_realm_name = module:get_option_string("reg_servlet_realm", "Restricted")
 local base_path = module:get_option_string("reg_servlet_base", "/register_account/")
 local throttle_time = module:get_option_number("reg_servlet_ttime", nil)
@@ -41,6 +41,7 @@
 local function handle_req(event)
 	local request = event.request
 	local body = request.body
+	if secure and not request.secure then return nil end
 
 	if request.method ~= "POST" then
 		return http_response(event, 405, "Bad method...", {["Allow"] = "POST"})