diff core/moduleapi.lua @ 13990:cf21d285385b

core.moduleapi: Fix :context() called from a global module Because `is_global` defaults to nil, it passes trough the metatabele to the calling module, so a host context retrieved from a global module would have the .global flag be true. This causes trouble with the code retrieving the hostname in `module:http_url()`, so `http:list()` in the shell would produce host URLs like `https://*:5281/`
author Kim Alvefur <zash@zash.se>
date Wed, 05 Nov 2025 16:19:50 +0100
parents a0faff6ba853
children a124e80d3498
line wrap: on
line diff
--- a/core/moduleapi.lua	Tue Oct 28 19:15:51 2025 +0100
+++ b/core/moduleapi.lua	Wed Nov 05 16:19:50 2025 +0100
@@ -412,7 +412,7 @@
 end
 
 function api:context(host)
-	local is_global;
+	local is_global = false;
 	if not host or host == "*" then
 		host, is_global = "*", true;
 	end