No comments on whether this patch is correct in concept or not. However, it is definitely broken if you do not use ap_set_content_type() to set the content type.
Bill > On Tue, 26 Mar 2002, Jerry Baker wrote: > > > Jerry Baker wrote: > > > > > > I just noticed something about this problem. If you request > > > /nonexistentfile.html then the error response is sent back with > > > text/html, but if you request /nonexistentfile then it still comes back > > > as text/plain. > > > > > > -- > > > Jerry Baker > > > > Not only that. If you request /nonexistentfile.exe, it gets sent back as > > application/octet-stream. The ErrorDocument is being returned with > > whatever content-type matches the file extension of the requested > > document. I doubt many people want to download the ErrorDocument in the > > case that they request a non-existent application/octet-stream URI. > > > yeah - the sub request content type is getting set by negotiation, but it > is not being propagated up. i am not sure how this is supposed to take > place, but the following patch actually makes the content type set > properly in my test cases..... although i don't think its the right fix - > isn't that content type supposed to be propagated? i know this stuff is > kinda whacky - maybe this sheds some light on the situation. anyways > here's the patch > > Index: modules/mappers/mod_negotiation.c > =================================================================== > RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_negotiation.c,v > retrieving revision 1.100 > diff -u -r1.100 mod_negotiation.c > --- modules/mappers/mod_negotiation.c 20 Mar 2002 17:41:55 -0000 1.100 > +++ modules/mappers/mod_negotiation.c 26 Mar 2002 20:54:33 -0000 > @@ -942,10 +942,13 @@ > } > else if (!strncmp(buffer, "content-type:", 13)) { > struct accept_rec accept_info; > + request_rec *tmp_req; > > get_entry(neg->pool, &accept_info, body); > set_mime_fields(&mime_info, &accept_info); > has_content = 1; > + for( tmp_req = r; tmp_req != NULL; tmp_req = tmp_req->prev ) > + tmp_req->content_type = mime_info.mime_type; > } > else if (!strncmp(buffer, "content-length:", 15)) { > mime_info.bytes = atol(body); >