Skip to content

Merge r1820750 from trunk #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 2.4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changes-entries/1820750.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*) mod_headers: 'RequestHeader set|edit|edit_r Content-Type X' could
inadvertently modify the Content-Type _response_ header. Applies to
Content-Type only and likely to only affect static file responses.
[Eric Covener]
12 changes: 9 additions & 3 deletions modules/metadata/mod_headers.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,21 +782,27 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers,
}
break;
case hdr_set:
if (!ap_cstr_casecmp(hdr->header, "Content-Type")) {
if (r->headers_in != headers &&
!ap_cstr_casecmp(hdr->header, "Content-Type")) {
ap_set_content_type_ex(r, process_tags(hdr, r), 1);
}
apr_table_setn(headers, hdr->header, process_tags(hdr, r));
break;
case hdr_setifempty:
if (NULL == apr_table_get(headers, hdr->header)) {
if (!ap_cstr_casecmp(hdr->header, "Content-Type")) {
if (r->headers_in != headers &&
!ap_cstr_casecmp(hdr->header, "Content-Type")) {
ap_set_content_type_ex(r, process_tags(hdr, r), 1);
}
apr_table_setn(headers, hdr->header, process_tags(hdr, r));
}
break;
case hdr_unset:
apr_table_unset(headers, hdr->header);
if (r->headers_in != headers &&
!ap_cstr_casecmp(hdr->header, "Content-Type")) {
ap_set_content_type(r, NULL);
}
break;
case hdr_echo:
v.r = r;
Expand All @@ -809,7 +815,7 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers,
const char *repl = process_regexp(hdr, r->content_type, r);
if (repl == NULL)
return 0;
ap_set_content_type_ex(r, repl, 1);
if (r->headers_in != headers) ap_set_content_type_ex(r, repl, 1);
}
if (apr_table_get(headers, hdr->header)) {
edit_do ed;
Expand Down