diff plugins/mod_admin_socket.lua @ 12415:01ba67e7f824

Merge 0.12->trunk
author Matthew Wild <mwild1@gmail.com>
date Sat, 19 Mar 2022 09:28:59 +0000
parents 6966026262f4
children dd47adf74e93
line wrap: on
line diff
--- a/plugins/mod_admin_socket.lua	Fri Mar 18 20:14:20 2022 +0000
+++ b/plugins/mod_admin_socket.lua	Sat Mar 19 09:28:59 2022 +0000
@@ -2,6 +2,15 @@
 
 local have_unix, unix = pcall(require, "socket.unix");
 
+if have_unix and type(unix) == "function" then
+	-- COMPAT #1717
+	-- Before the introduction of datagram support, only the stream socket
+	-- constructor was exported instead of a module table. Due to the lack of a
+	-- proper release of LuaSocket, distros have settled on shipping either the
+	-- last RC tag or some commit since then.
+	-- Here we accomodate both variants.
+	unix = { stream = unix };
+end
 if not have_unix or type(unix) ~= "table" then
 	module:log_status("error", "LuaSocket unix socket support not available or incompatible, ensure it is up to date");
 	return;