@@ -782,21 +782,27 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers,
782782 }
783783 break ;
784784 case hdr_set :
785- if (!ap_cstr_casecmp (hdr -> header , "Content-Type" )) {
785+ if (r -> headers_in != headers &&
786+ !ap_cstr_casecmp (hdr -> header , "Content-Type" )) {
786787 ap_set_content_type_ex (r , process_tags (hdr , r ), 1 );
787788 }
788789 apr_table_setn (headers , hdr -> header , process_tags (hdr , r ));
789790 break ;
790791 case hdr_setifempty :
791792 if (NULL == apr_table_get (headers , hdr -> header )) {
792- if (!ap_cstr_casecmp (hdr -> header , "Content-Type" )) {
793+ if (r -> headers_in != headers &&
794+ !ap_cstr_casecmp (hdr -> header , "Content-Type" )) {
793795 ap_set_content_type_ex (r , process_tags (hdr , r ), 1 );
794796 }
795797 apr_table_setn (headers , hdr -> header , process_tags (hdr , r ));
796798 }
797799 break ;
798800 case hdr_unset :
799801 apr_table_unset (headers , hdr -> header );
802+ if (r -> headers_in != headers &&
803+ !ap_cstr_casecmp (hdr -> header , "Content-Type" )) {
804+ ap_set_content_type (r , NULL );
805+ }
800806 break ;
801807 case hdr_echo :
802808 v .r = r ;
@@ -809,7 +815,7 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers,
809815 const char * repl = process_regexp (hdr , r -> content_type , r );
810816 if (repl == NULL )
811817 return 0 ;
812- ap_set_content_type_ex (r , repl , 1 );
818+ if ( r -> headers_in != headers ) ap_set_content_type_ex (r , repl , 1 );
813819 }
814820 if (apr_table_get (headers , hdr -> header )) {
815821 edit_do ed ;
0 commit comments