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/22 14:18:15 UTC

svn commit: r1909992 - in /httpd/httpd/branches/2.4.x: ./ changes-entries/proxy_http2_retries.txt modules/http2/h2_proxy_session.c test/modules/http2/test_003_get.py test/modules/http2/test_104_padding.py

Author: icing
Date: Mon May 22 14:18:14 2023
New Revision: 1909992

URL: http://svn.apache.org/viewvc?rev=1909992&view=rev
Log:
Merge r1909989 from trunk:

  *) mod_proxy_http2: fix retry handling to not leak temporary errors.
     On detecting that that an existing connection was shutdown by the other
     side, a 503 response leaked even though the request was retried on a
     fresh connection.


Added:
    httpd/httpd/branches/2.4.x/changes-entries/proxy_http2_retries.txt
      - copied unchanged from r1909989, httpd/httpd/trunk/changes-entries/proxy_http2_retries.txt
Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/modules/http2/h2_proxy_session.c
    httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py
    httpd/httpd/branches/2.4.x/test/modules/http2/test_104_padding.py

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1909989

Modified: httpd/httpd/branches/2.4.x/modules/http2/h2_proxy_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http2/h2_proxy_session.c?rev=1909992&r1=1909991&r2=1909992&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http2/h2_proxy_session.c (original)
+++ httpd/httpd/branches/2.4.x/modules/http2/h2_proxy_session.c Mon May 22 14:18:14 2023
@@ -1375,12 +1375,9 @@ static void ev_stream_done(h2_proxy_sess
                           session->id, stream_id, touched, stream->error_code);
 
             if (status != APR_SUCCESS) {
-                b = ap_bucket_error_create(HTTP_SERVICE_UNAVAILABLE, NULL, stream->r->pool,
-                                           stream->r->connection->bucket_alloc);
-                APR_BRIGADE_INSERT_TAIL(stream->output, b);
-                b = apr_bucket_eos_create(stream->r->connection->bucket_alloc);
-                APR_BRIGADE_INSERT_TAIL(stream->output, b);
-                ap_pass_brigade(stream->r->output_filters, stream->output);
+              /* stream failed, error reporting is done by caller
+               * of proxy_session, e.g. mod_proxy_http2 which also
+               * decides about retries. */
             }
             else if (!stream->data_received) {
                 /* if the response had no body, this is the time to flush

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py?rev=1909992&r1=1909991&r2=1909992&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_003_get.py Mon May 22 14:18:14 2023
@@ -197,11 +197,7 @@ content-type: text/html
     def test_h2_003_50(self, env, path, repeat):
         # check that the resource supports ranges and we see its raw content-length
         url = env.mkurl("https", "test1", path)
-        # TODO: sometimes we see a 503 here from h2proxy
-        for i in range(10):
-            r = env.curl_get(url, 5)
-            if r.response["status"] != 503:
-                break
+        r = env.curl_get(url, 5)
         assert r.response["status"] == 200
         assert "HTTP/2" == r.response["protocol"]
         h = r.response["header"]
@@ -210,10 +206,7 @@ content-type: text/html
         assert "content-length" in h
         clen = h["content-length"]
         # get the first 1024 bytes of the resource, 206 status, but content-length as original
-        for i in range(10):
-            r = env.curl_get(url, 5, options=["-H", "range: bytes=0-1023"])
-            if r.response["status"] != 503:
-                break
+        r = env.curl_get(url, 5, options=["-H", "range: bytes=0-1023"])
         assert 206 == r.response["status"]
         assert "HTTP/2" == r.response["protocol"]
         assert 1024 == len(r.response["body"])

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_104_padding.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_104_padding.py?rev=1909992&r1=1909991&r2=1909992&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_104_padding.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_104_padding.py Mon May 22 14:18:14 2023
@@ -13,57 +13,63 @@ class TestPadding:
 
     @pytest.fixture(autouse=True, scope='class')
     def _class_scope(self, env):
+        def add_echo_handler(conf):
+            conf.add([
+                "<Location \"/h2test/echo\">",
+                "    SetHandler h2test-echo",
+                "</Location>",
+            ])
+
         conf = H2Conf(env)
         conf.start_vhost(domains=[f"ssl.{env.http_tld}"], port=env.https_port, doc_root="htdocs/cgi")
-        conf.add("AddHandler cgi-script .py")
+        add_echo_handler(conf)
         conf.end_vhost()
         conf.start_vhost(domains=[f"pad0.{env.http_tld}"], port=env.https_port, doc_root="htdocs/cgi")
         conf.add("H2Padding 0")
-        conf.add("AddHandler cgi-script .py")
+        add_echo_handler(conf)
         conf.end_vhost()
         conf.start_vhost(domains=[f"pad1.{env.http_tld}"], port=env.https_port, doc_root="htdocs/cgi")
         conf.add("H2Padding 1")
-        conf.add("AddHandler cgi-script .py")
+        add_echo_handler(conf)
         conf.end_vhost()
         conf.start_vhost(domains=[f"pad2.{env.http_tld}"], port=env.https_port, doc_root="htdocs/cgi")
         conf.add("H2Padding 2")
-        conf.add("AddHandler cgi-script .py")
+        add_echo_handler(conf)
         conf.end_vhost()
         conf.start_vhost(domains=[f"pad3.{env.http_tld}"], port=env.https_port, doc_root="htdocs/cgi")
         conf.add("H2Padding 3")
-        conf.add("AddHandler cgi-script .py")
+        add_echo_handler(conf)
         conf.end_vhost()
         conf.start_vhost(domains=[f"pad8.{env.http_tld}"], port=env.https_port, doc_root="htdocs/cgi")
         conf.add("H2Padding 8")
-        conf.add("AddHandler cgi-script .py")
+        add_echo_handler(conf)
         conf.end_vhost()
         conf.install()
         assert env.apache_restart() == 0
 
     # default paddings settings: 0 bits
-    def test_h2_104_01(self, env):
-        url = env.mkurl("https", "ssl", "/echo.py")
+    def test_h2_104_01(self, env, repeat):
+        url = env.mkurl("https", "ssl", "/h2test/echo")
         # we get 2 frames back: one with data and an empty one with EOF
         # check the number of padding bytes is as expected
         for data in ["x", "xx", "xxx", "xxxx", "xxxxx", "xxxxxx", "xxxxxxx", "xxxxxxxx"]:
             r = env.nghttp().post_data(url, data, 5)
             assert r.response["status"] == 200
-            assert r.results["paddings"] == [
-                frame_padding(len(data)+1, 0), 
-                frame_padding(0, 0)
-            ]
+            for i in r.results["paddings"]:
+                assert i == frame_padding(len(data)+1, 0)
 
     # 0 bits of padding
     def test_h2_104_02(self, env):
-        url = env.mkurl("https", "pad0", "/echo.py")
+        url = env.mkurl("https", "pad0", "/h2test/echo")
         for data in ["x", "xx", "xxx", "xxxx", "xxxxx", "xxxxxx", "xxxxxxx", "xxxxxxxx"]:
             r = env.nghttp().post_data(url, data, 5)
             assert r.response["status"] == 200
-            assert r.results["paddings"] == [0, 0]
+            for i in r.results["paddings"]:
+                assert i == 0
 
     # 1 bit of padding
     def test_h2_104_03(self, env):
-        url = env.mkurl("https", "pad1", "/echo.py")
+        url = env.mkurl("https", "pad1", "/h2test/echo")
         for data in ["x", "xx", "xxx", "xxxx", "xxxxx", "xxxxxx", "xxxxxxx", "xxxxxxxx"]:
             r = env.nghttp().post_data(url, data, 5)
             assert r.response["status"] == 200
@@ -72,7 +78,7 @@ class TestPadding:
 
     # 2 bits of padding
     def test_h2_104_04(self, env):
-        url = env.mkurl("https", "pad2", "/echo.py")
+        url = env.mkurl("https", "pad2", "/h2test/echo")
         for data in ["x", "xx", "xxx", "xxxx", "xxxxx", "xxxxxx", "xxxxxxx", "xxxxxxxx"]:
             r = env.nghttp().post_data(url, data, 5)
             assert r.response["status"] == 200
@@ -81,7 +87,7 @@ class TestPadding:
 
     # 3 bits of padding
     def test_h2_104_05(self, env):
-        url = env.mkurl("https", "pad3", "/echo.py")
+        url = env.mkurl("https", "pad3", "/h2test/echo")
         for data in ["x", "xx", "xxx", "xxxx", "xxxxx", "xxxxxx", "xxxxxxx", "xxxxxxxx"]:
             r = env.nghttp().post_data(url, data, 5)
             assert r.response["status"] == 200
@@ -90,7 +96,7 @@ class TestPadding:
 
     # 8 bits of padding
     def test_h2_104_06(self, env):
-        url = env.mkurl("https", "pad8", "/echo.py")
+        url = env.mkurl("https", "pad8", "/h2test/echo")
         for data in ["x", "xx", "xxx", "xxxx", "xxxxx", "xxxxxx", "xxxxxxx", "xxxxxxxx"]:
             r = env.nghttp().post_data(url, data, 5)
             assert r.response["status"] == 200