--- a/mod_pubsub_post/mod_pubsub_post.lua Sun May 20 02:56:48 2018 +0200
+++ b/mod_pubsub_post/mod_pubsub_post.lua Sun May 20 03:03:59 2018 +0200
@@ -67,6 +67,8 @@
end
end
+local actor_source = module:get_option_string("pubsub_post_actor", "superuser");
+
function handle_POST(event, path)
local request = event.request;
module:log("debug", "Handling POST: \n%s\n", tostring(request.body));
@@ -74,6 +76,13 @@
local content_type = request.headers.content_type or "application/octet-stream";
local actor = true;
+ if actor_source == "request.ip" then
+ actor = request.ip or request.conn:ip();
+ elseif actor_source ~= "superuser" then
+ module:log("error", "pubsub_post_actor set to unsupported value %q", actor_source);
+ return 500;
+ end
+
if content_type == "application/xml" or content_type:sub(-4) == "+xml" then
return handle_xml(path, actor, request.body);
elseif content_type == "application/json" or content_type:sub(-5) == "+json" then