Resolves: RHEL-71575: Wrong Content-Type when proxying using H2 protocol

This commit is contained in:
Luboš Uhliarik 2025-01-07 16:09:08 +01:00
parent a7d97b4818
commit de819c927b
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,23 @@
diff --git a/mod_http2/h2_proxy_session.c b/mod_http2/h2_proxy_session.c
index 121c226..5f64dbc 100644
--- a/mod_http2/h2_proxy_session.c
+++ b/mod_http2/h2_proxy_session.c
@@ -334,6 +334,7 @@ static void h2_proxy_stream_end_headers_out(h2_proxy_stream *stream)
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);
@@ -343,6 +344,10 @@ static void h2_proxy_stream_end_headers_out(h2_proxy_stream *stream)
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

View File

@ -3,7 +3,7 @@
Name: mod_http2
Version: 1.15.7
Release: 10%{?dist}.1
Release: 10%{?dist}.2
Summary: module implementing HTTP/2 for Apache 2
Group: System Environment/Daemons
License: ASL 2.0
@ -22,6 +22,8 @@ Patch7: mod_http2-1.15.7-CVE-2023-45802.patch
Patch8: mod_http2-1.15.7-CVE-2024-27316.patch
# https://issues.redhat.com/browse/RHEL-46214
Patch9: mod_http2-1.15.7-log-error-resp.patch
# https://issues.redhat.com/browse/RHEL-71575
Patch10: mod_http2-1.15.7-wrong-cl-proxy-resp-handling.patch
BuildRequires: pkgconfig, httpd-devel >= 2.4.20, libnghttp2-devel >= 1.7.0, openssl-devel >= 1.0.2
Requires: httpd-mmn = %{_httpd_mmn}
@ -42,6 +44,7 @@ top of libnghttp2 for httpd 2.4 servers.
%patch7 -p1 -b .CVE-2023-45802
%patch8 -p1 -b .CVE-2024-27316
%patch9 -p1 -b .log-error-resp
%patch10 -p1 -b .wrong-cl-proxy-resp-handling
%build
%configure
@ -68,6 +71,9 @@ make check
%{_httpd_moddir}/mod_proxy_http2.so
%changelog
* Tue Jan 07 2025 Luboš Uhliarik <luhliari@redhat.com> - 1.15.7-10.2
- Resolves: RHEL-71575: Wrong Content-Type when proxying using H2 protocol
* Tue Aug 27 2024 Luboš Uhliarik <luhliari@redhat.com> - 1.15.7-10.1
- Resolves: RHEL-46214 - Access logs and ErrorDocument don't work when HTTP431
occurs using http/2 on RHEL8