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/01/09 07:47:30 UTC

svn commit: r1906476 - in /httpd/httpd/branches/2.4.x: ./ changes-entries/h2_proxy_content_type.txt modules/http2/h2_proxy_session.c test/modules/http2/test_600_h2proxy.py

Author: icing
Date: Mon Jan  9 07:47:29 2023
New Revision: 1906476

URL: http://svn.apache.org/viewvc?rev=1906476&view=rev
Log:
Merge of httpd/httpd/trunk:r1906051

  *) mod_proxy_http2: apply the standard httpd content type handling
     to responses from the backend, as other proxy modules do. Fixes PR 66391.
     Thanks to Jérôme Billiras for providing the patch.


Added:
    httpd/httpd/branches/2.4.x/changes-entries/h2_proxy_content_type.txt
      - copied unchanged from r1906051, httpd/httpd/trunk/changes-entries/h2_proxy_content_type.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_600_h2proxy.py

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

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=1906476&r1=1906475&r2=1906476&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 Jan  9 07:47:29 2023
@@ -447,6 +447,7 @@ static void h2_proxy_stream_end_headers_
     h2_proxy_session *session = stream->session;
     request_rec *r = stream->r;
     apr_pool_t *p = r->pool;
+    const char *buf;
     
     /* Now, add in the cookies from the response to the ones already saved */
     apr_table_do(add_header, stream->saves, r->headers_out, "Set-Cookie", NULL);
@@ -456,6 +457,10 @@ static void h2_proxy_stream_end_headers_
         apr_table_unset(r->headers_out, "Set-Cookie");
         r->headers_out = apr_table_overlay(p, r->headers_out, stream->saves);
     }
+
+    if ((buf = apr_table_get(r->headers_out, "Content-Type"))) {
+        ap_set_content_type(r, apr_pstrdup(p, buf));
+    }
     
     /* handle Via header in response */
     if (session->conf->viaopt != via_off 

Modified: httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py?rev=1906476&r1=1906475&r2=1906476&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py (original)
+++ httpd/httpd/branches/2.4.x/test/modules/http2/test_600_h2proxy.py Mon Jan  9 07:47:29 2023
@@ -81,8 +81,7 @@ class TestH2Proxy:
         r = env.curl_get(url, 5)
         assert r.response["status"] == 200
         assert r.json["h2_stream_id"] == "1"
-        # httpd 2.5.0 disables reuse, not matter the config
-        if enable_reuse == "on" and not env.httpd_is_at_least("2.5.0"):
+        if enable_reuse == "on":
             # reuse is not guarantueed for each request, but we expect some
             # to do it and run on a h2 stream id > 1
             reused = False
@@ -128,9 +127,7 @@ class TestH2Proxy:
         url = env.mkurl("https", "cgi", f"/h2proxy/{env.http_port2}/hello.py")
         r = env.curl_get(url, 5)
         assert r.response["status"] == 200
-        exp_port = env.http_port if enable_reuse == "on" \
-                                    and not env.httpd_is_at_least("2.5.0")\
-            else env.http_port2
+        exp_port = env.http_port if enable_reuse == "on" else env.http_port2
         assert int(r.json["port"]) == exp_port
 
     # lets do some error tests