You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2026/09/24 14:48:33 UTC

svn commit: r1938491 - httpd/httpd/trunk/test/pyhttpd

Author: jorton
Date: Thu Sep 24 14:48:33 2026
New Revision: 1938491

Log:
* test/pyhttpd/env.py (HttpdTestSetup._cgi_module,
  HttpdTestSetup.add_cgi_module): New, so a suite can ask for CGI
  without naming mod_cgid.
  (HttpdTestSetup._make_modules_conf): Use _cgi_module() for a
  requested "cgid" on every platform, not just Windows.

Co-Authored-By: Claude Opus 5 (1M context) <no...@anthropic.com>
GitHub: PR #769

Modified:
   httpd/httpd/trunk/test/pyhttpd/env.py

Modified: httpd/httpd/trunk/test/pyhttpd/env.py
==============================================================================
--- httpd/httpd/trunk/test/pyhttpd/env.py	Thu Sep 24 14:48:26 2026	(r1938490)
+++ httpd/httpd/trunk/test/pyhttpd/env.py	Thu Sep 24 14:48:33 2026	(r1938491)
@@ -84,6 +84,20 @@ class HttpdTestSetup:
     def add_optional_modules(self, modules: List[str]):
         self._optional_modules.extend(modules)
 
+    def _cgi_module(self):
+        """The name of a CGI module this build has: mod_cgid for preference,
+        mod_cgi otherwise.  There is no mod_cgid on Windows."""
+        if sys.platform != "win32" \
+                and os.path.isfile(os.path.join(self.env.libexec_dir,
+                                                "mod_cgid.so")):
+            return "cgid"
+        return "cgi"
+
+    def add_cgi_module(self):
+        """Load a CGI module, for a suite which needs CGI but does not care
+        which of mod_cgid and mod_cgi runs it."""
+        self.add_modules([self._cgi_module()])
+
     def make(self):
         self._make_dirs()
         self._make_conf()
@@ -153,8 +167,8 @@ class HttpdTestSetup:
             # issue load directives for all modules we want that are shared
             missing_mods = list()
             modules = self._modules
-            if sys.platform == "win32":
-                modules = ["cgi" if m == "cgid" else m for m in modules]
+            modules = [self._cgi_module() if m == "cgid" else m
+                       for m in modules]
             for m in modules:
                 match = re.match(r'^mod_(.+)$', m)
                 if match: