From: Justin Erenkrantz Date: Wed, 17 Apr 2002 04:09:07 +0000 (+0000) Subject: Fix subreqs with non-defined Content-Types being served improperly. X-Git-Tag: 2.0.36~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d165134180c9f8d6d938f59f39b4ff821bee7a5;p=thirdparty%2Fapache%2Fhttpd.git Fix subreqs with non-defined Content-Types being served improperly. If we do not know a C-T for a subreq, we *must* propogate that non-knowledge upwards to the main request. Previously, if you used a DirectoryIndex with a file without a C-T (say .shtml without AddType), the r->content_type will be kept as httpd/unix-directory when we promoted the subreq in mod_dir. Since there would be no handler on this file, ap_invoke_handler (config.c:355) would set the handler to be httpd/unix-directory (which was the old C-T of the dir). This would then trigger the handler to become httpd/unix-directory. mod_autoindex would then try to serve the request. But, the filename was propogated upwards by mod_dir's DirectoryIndex via internal_fast_redirect - it would then return a 403 trying to generate a mod_autoindex page for a file. Now, we will use ap_default_type() which is correct. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94676 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 34e6f4f2a40..de4b6ae4e89 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.36 + *) Fix subreqs with non-defined Content-Types being served improperly. + [Justin Erenkrantz] + *) Merge in latest GNU config.guess and config.sub files. PR 7818. [Justin Erenkrantz] diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 6b38f3ed21e..6c87ae867ae 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1297,7 +1297,10 @@ static void fixup_vary(request_rec *r) AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct) { - if (!r->content_type || strcmp(r->content_type, ct)) { + if (!ct) { + r->content_type = NULL; + } + else if (!r->content_type || strcmp(r->content_type, ct)) { r->content_type = ct; /* Insert filters requested by the AddOutputFiltersByType diff --git a/modules/http/http_request.c b/modules/http/http_request.c index ae52cd95d79..88e14345111 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -422,9 +422,7 @@ AP_DECLARE(void) ap_internal_fast_redirect(request_rec *rr, request_rec *r) r->args = rr->args; r->finfo = rr->finfo; r->handler = rr->handler; - if (rr->content_type) { - ap_set_content_type(r, rr->content_type); - } + ap_set_content_type(r, rr->content_type); r->content_encoding = rr->content_encoding; r->content_languages = rr->content_languages; r->per_dir_config = rr->per_dir_config;