From be39909cf3eb1051db9b68a7abd6d0ab0e400e52 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Sat, 17 Dec 2022 10:21:56 +0000 Subject: [PATCH] =?utf8?q?=20=20*)=20mod=5Fproxy=5Fhttp2:=20apply=20the=20?= =?utf8?q?standard=20httpd=20content=20type=20handling=20=20=20=20=20=20to?= =?utf8?q?=20responses=20from=20the=20backend,=20as=20other=20proxy=20modu?= =?utf8?q?les=20do.=20Fixes=20PR=2066391.=20=20=20=20=20=20Thanks=20to=20J?= =?utf8?q?=C3=A9r=C3=B4me=20Billiras=20for=20providing=20the=20patch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1906051 13f79535-47bb-0310-9956-ffa450edef68 --- changes-entries/h2_proxy_content_type.txt | 4 ++++ modules/http2/h2_proxy_session.c | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 changes-entries/h2_proxy_content_type.txt diff --git a/changes-entries/h2_proxy_content_type.txt b/changes-entries/h2_proxy_content_type.txt new file mode 100644 index 00000000000..d35f7c2ea71 --- /dev/null +++ b/changes-entries/h2_proxy_content_type.txt @@ -0,0 +1,4 @@ + *) 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. + [Stefan Eissing] \ No newline at end of file diff --git a/modules/http2/h2_proxy_session.c b/modules/http2/h2_proxy_session.c index 3da57f9e739..c3f2ff30101 100644 --- a/modules/http2/h2_proxy_session.c +++ b/modules/http2/h2_proxy_session.c @@ -447,6 +447,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); @@ -456,6 +457,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 -- 2.47.2