diff mod_register_json/mod_register_json.lua @ 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 c26652d055b5
children 9c5573b389c0
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"})