changeset 402:c92a37a72b25

mod_pubsub_feed: Use httpserver.new_from_config(). Fixes SSL. And fix traceback when called without a querypart.
author Kim Alvefur <zash@zash.se>
date Wed, 24 Aug 2011 15:55:49 +0200
parents c85397063eca
children fc62b26dfdf6
files mod_pubsub_feed/mod_pubsub_feed.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_feed/mod_pubsub_feed.lua	Wed Aug 24 15:03:38 2011 +0200
+++ b/mod_pubsub_feed/mod_pubsub_feed.lua	Wed Aug 24 15:55:49 2011 +0200
@@ -214,7 +214,7 @@
 
 function handle_http_request(method, body, request)
 	--module:log("debug", "%s request to %s%s with body %s", method, request.url.path, request.url.query and "?" .. request.url.query or "", #body > 0 and body or "empty");
-	local query = request.url.query;
+	local query = request.url.query or {};
 	if query and type(query) == "string" then
 		query = urlparams(query);
 		--module:log("debug", "GET data: %s", dump(query));
@@ -245,7 +245,6 @@
 		end
 		return http_response(400);
 	elseif method == "POST" then
-		-- TODO http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html#authednotify
 		if #body > 0 and feed_list[query.node] then
 			module:log("debug", "got %d bytes PuSHed for %s", #body, query.node);
 			local feed = feed_list[query.node];
@@ -271,7 +270,9 @@
 function init()
 	module:log("debug", "initiating", module.name);
 	if use_pubsubhubub then
-		httpserver.new{ port = port_number, base = base_name, handler = handle_http_request }
+		module:log("debug", "Starting http server on %s", format_url(secure, http_hostname, port_number, base_name, "NODE"));
+		--httpserver.new{ port = port_number, ssl = secure, type = (ssl and "ssl") or "tcp", base = base_name, handler = handle_http_request }
+		httpserver.new_from_config( ports, handle_http_request, { base = "callback" } );
 	end
 	add_task(0, refresh_feeds);
 end