You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2023/05/02 09:03:32 UTC

svn commit: r1909560 - in /httpd/httpd/trunk/test: modules/proxy/test_01_http.py modules/proxy/test_02_unix.py pyhttpd/env.py

Author: icing
Date: Tue May  2 09:03:32 2023
New Revision: 1909560

URL: http://svn.apache.org/viewvc?rev=1909560&view=rev
Log:
  *) test: check for recent curl version in proxy tests


Modified:
    httpd/httpd/trunk/test/modules/proxy/test_01_http.py
    httpd/httpd/trunk/test/modules/proxy/test_02_unix.py
    httpd/httpd/trunk/test/pyhttpd/env.py

Modified: httpd/httpd/trunk/test/modules/proxy/test_01_http.py
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/proxy/test_01_http.py?rev=1909560&r1=1909559&r2=1909560&view=diff
==============================================================================
--- httpd/httpd/trunk/test/modules/proxy/test_01_http.py (original)
+++ httpd/httpd/trunk/test/modules/proxy/test_01_http.py Tue May  2 09:03:32 2023
@@ -59,6 +59,8 @@ class TestProxyHttp:
         # check that we see the document we expect there (host matching worked)
         # we need to explicitly provide a Host: header since mod_proxy cannot
         # resolve the name via DNS.
+        if not env.curl_is_at_least('8.0.0'):
+            pytest.skip(f'need at least curl v8.0.0 for this')
         domain = f"{via}.{env.http_tld}"
         r = env.curl_get(f"http://127.0.0.1:{env.http_port}/alive.json", 5, options=[
             '-H', f"Host: {domain}",

Modified: httpd/httpd/trunk/test/modules/proxy/test_02_unix.py
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/proxy/test_02_unix.py?rev=1909560&r1=1909559&r2=1909560&view=diff
==============================================================================
--- httpd/httpd/trunk/test/modules/proxy/test_02_unix.py (original)
+++ httpd/httpd/trunk/test/modules/proxy/test_02_unix.py Tue May  2 09:03:32 2023
@@ -110,6 +110,8 @@ class TestProxyUds:
         # check that we see the document we expect there (host matching worked)
         # we need to explicitly provide a Host: header since mod_proxy cannot
         # resolve the name via DNS.
+        if not env.curl_is_at_least('8.0.0'):
+            pytest.skip(f'need at least curl v8.0.0 for this')
         domain = f"{via}.{env.http_tld}"
         r = env.curl_get(f"http://127.0.0.1:{env.http_port}/alive.json", 5, options=[
             '-H', f"Host: {domain}",

Modified: httpd/httpd/trunk/test/pyhttpd/env.py
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/test/pyhttpd/env.py?rev=1909560&r1=1909559&r2=1909560&view=diff
==============================================================================
--- httpd/httpd/trunk/test/pyhttpd/env.py (original)
+++ httpd/httpd/trunk/test/pyhttpd/env.py Tue May  2 09:03:32 2023
@@ -287,6 +287,7 @@ class HttpdTestEnv:
 
         self._verify_certs = False
         self._curl_headerfiles_n = 0
+        self._curl_version = None
         self._h2load_version = None
         self._current_test = None
 
@@ -472,6 +473,20 @@ class HttpdTestEnv:
             return self._h2load_version >= self._versiontuple(minv)
         return False
 
+    def curl_is_at_least(self, minv):
+        if self._curl_version is None:
+            p = subprocess.run([self._curl, '-V'], capture_output=True, text=True)
+            if p.returncode != 0:
+                return False
+            for l in p.stdout.splitlines():
+                m = re.match(r'curl ([0-9.]+)[- ].*', l)
+                if m:
+                    self._curl_version = self._versiontuple(m.group(1))
+                    break
+        if self._curl_version is not None:
+            return self._curl_version >= self._versiontuple(minv)
+        return False
+
     def has_nghttp(self):
         return self._nghttp != ""