[libsoup/carlosgc/thread-safe: 8/19] tests: add support for apache http/2 module




commit 54a4c8ddb4a39de3210e1fbdaf6e952f9c058f1c
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue Apr 12 16:45:52 2022 +0200

    tests: add support for apache http/2 module
    
    Use mpm_event instead of mpm_prefork because http/2 module doesn't
    support prefork. For now the server prefers http1 because that's what
    all the tests using apache expect.

 get_apache_modules_dirs.py | 8 ++++++--
 meson.build                | 3 +++
 tests/httpd.conf.in        | 6 +++++-
 3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/get_apache_modules_dirs.py b/get_apache_modules_dirs.py
index 73eca392..6fc1a122 100755
--- a/get_apache_modules_dirs.py
+++ b/get_apache_modules_dirs.py
@@ -45,7 +45,7 @@ def check_required_basic_modules(modules_path):
         'mod_authz_user',
         'mod_dir',
         'mod_mime',
-        'mod_mpm_prefork',
+        'mod_mpm_event',
         'mod_proxy',
         'mod_proxy_http',
         'mod_proxy_connect'
@@ -99,6 +99,7 @@ def main():
     apache_modules_dir = ''
     apache_ssl_module_dir = ''
     apache_mod_unixd_module_file = ''
+    apache_http2_module_dir = ''
 
     for lib_dir in ['lib', 'lib64']:
         for httpd_dir in ['apache', 'apache2', 'http', 'http2', 'httpd']:
@@ -111,6 +112,8 @@ def main():
                         apache_ssl_module_dir = modules_path
                     if check_module(modules_path, 'mod_unixd.so'):
                         apache_mod_unixd_module_file = modules_path
+                    if check_module(modules_path, 'mod_http2.so'):
+                        apache_http2_module_dir = modules_path
 
     # These two are mandatory for having properly configured Apache
     if apache_modules_dir == '' or apache_ssl_module_dir == '':
@@ -118,7 +121,8 @@ def main():
 
     print(apache_modules_dir + ":" +
           apache_ssl_module_dir + ":" +
-          apache_mod_unixd_module_file, end='')
+          apache_mod_unixd_module_file + ":" +
+          apache_http2_module_dir, end='')
 
 if __name__ == "__main__":
     main()
diff --git a/meson.build b/meson.build
index 31653cf5..e16ccda6 100644
--- a/meson.build
+++ b/meson.build
@@ -268,6 +268,9 @@ if have_apache
     cdata.set('APACHE_SSL_MODULE_DIR', apache_modules_dirs[1])
     message('Apache mod_unixd module directory: ' + (apache_modules_dirs[2] != '' ? apache_modules_dirs[2] : 
'(none)'))
     cdata.set('IF_HAVE_MOD_UNIXD', apache_modules_dirs[2] != '' ? '' : '#')
+    message('Apache HTTP/2 module directory: ' + apache_modules_dirs[3])
+    cdata.set('IF_HAVE_MOD_HTTP2', apache_modules_dirs[3] != '' ? '' : '#')
+    cdata.set('APACHE_HTTP2_MODULE_DIR', apache_modules_dirs[3])
     cdata.set('HAVE_APACHE', have_apache)
   else
     message('Failed to locate necessary Apache modules for full test coverage')
diff --git a/tests/httpd.conf.in b/tests/httpd.conf.in
index e84c182a..66f081dd 100644
--- a/tests/httpd.conf.in
+++ b/tests/httpd.conf.in
@@ -13,7 +13,7 @@ GracefulShutdownTimeout 1
 # Change this to "./error.log" if it's failing and you don't know why
 ErrorLog /dev/null
 
-LoadModule mpm_prefork_module   @APACHE_MODULE_DIR@/mod_mpm_prefork.so
+LoadModule mpm_event_module        @APACHE_MODULE_DIR@/mod_mpm_event.so
 LoadModule alias_module         @APACHE_MODULE_DIR@/mod_alias.so
 LoadModule auth_basic_module    @APACHE_MODULE_DIR@/mod_auth_basic.so
 LoadModule auth_digest_module   @APACHE_MODULE_DIR@/mod_auth_digest.so
@@ -29,11 +29,15 @@ LoadModule proxy_http_module    @APACHE_MODULE_DIR@/mod_proxy_http.so
 LoadModule proxy_connect_module @APACHE_MODULE_DIR@/mod_proxy_connect.so
 LoadModule ssl_module           @APACHE_SSL_MODULE_DIR@/mod_ssl.so
 @IF_HAVE_MOD_UNIXD@LoadModule unixd_module         @APACHE_SSL_MODULE_DIR@/mod_unixd.so
+@IF_HAVE_MOD_HTTP2@LoadModule http2_module         @APACHE_HTTP2_MODULE_DIR@/mod_http2.so
 
 DirectoryIndex index.txt
 TypesConfig /dev/null
 Redirect permanent /redirected /index.txt
 
+# Prefer http1 for now because most of the tests expect http1 behavior.
+Protocols http/1.1 h2
+
 # Proxy #1: unauthenticated
 Listen 127.0.0.1:47526
 <VirtualHost 127.0.0.1:47526>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]