You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by fi...@apache.org on 2009/01/30 20:12:52 UTC

svn commit: r739382 - in /httpd/httpd/trunk: ./ include/ modules/filters/ modules/http/ modules/mappers/ modules/proxy/ server/

Author: fielding
Date: Fri Jan 30 19:12:51 2009
New Revision: 739382

URL: http://svn.apache.org/viewvc?rev=739382&view=rev
Log:
Disabled DefaultType directive and removed ap_default_type()
from core.  We now exclude Content-Type from responses for which
a media type has not been configured via mime.types, AddType,
ForceType, or some other mechanism.  MMN major bump to NZ time.

PR: 13986


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_core.h
    httpd/httpd/trunk/include/http_protocol.h
    httpd/httpd/trunk/include/httpd.h
    httpd/httpd/trunk/modules/filters/mod_charset_lite.c
    httpd/httpd/trunk/modules/http/byterange_filter.c
    httpd/httpd/trunk/modules/http/http_filters.c
    httpd/httpd/trunk/modules/mappers/mod_actions.c
    httpd/httpd/trunk/modules/mappers/mod_negotiation.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c
    httpd/httpd/trunk/server/config.c
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/protocol.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Jan 30 19:12:51 2009
@@ -2,6 +2,11 @@
 Changes with Apache 2.3.2
 [ When backported to 2.2.x, remove entry from this file ]
 
+ *) Disabled DefaultType directive and removed ap_default_type()
+    from core.  We now exclude Content-Type from responses for which
+    a media type has not been configured via mime.types, AddType,
+    ForceType, or some other mechanism. PR 13986. [Roy T. Fielding]
+
  *) mod_rewrite: Add IPV6 variable to RewriteCond
     [Ryan Phillips <ryan-apache trolocsis.com>]
 

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Fri Jan 30 19:12:51 2009
@@ -187,12 +187,13 @@
  * 20081231.0 (2.3.0-dev)  Switch ap_escape_html API: add ap_escape_html2,
  *                         and make ap_escape_html a macro for it.
  * 20090130.0 (2.3.2-dev)  Add ap_ prefix to unixd_setup_child().
+ * 20090131.0 (2.3.2-dev)  Remove ap_default_type(), disable DefaultType
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20090130
+#define MODULE_MAGIC_NUMBER_MAJOR 20090131
 #endif
 #define MODULE_MAGIC_NUMBER_MINOR 0                     /* 0...n */
 

Modified: httpd/httpd/trunk/include/http_core.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_core.h?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_core.h (original)
+++ httpd/httpd/trunk/include/http_core.h Fri Jan 30 19:12:51 2009
@@ -149,13 +149,6 @@
 AP_DECLARE(int) ap_allow_overrides(request_rec *r);
 
 /**
- * Retrieve the value of the DefaultType directive, or text/plain if not set
- * @param r The current request
- * @return The default type
- */
-AP_DECLARE(const char *) ap_default_type(request_rec *r);     
-
-/**
  * Retrieve the document root for this server
  * @param r The current request
  * @warning Don't use this!  If your request went through a Userdir, or 
@@ -438,13 +431,6 @@
     overrides_t override;
     allow_options_t override_opts;
     
-    /* MIME typing --- the core doesn't do anything at all with this,
-     * but it does know what to slap on a request for a document which
-     * goes untyped by other mechanisms before it slips out the door...
-     */
-    
-    char *ap_default_type;
-  
     /* Custom response config. These can contain text or a URL to redirect to.
      * if response_code_strings is NULL then there are none in the config,
      * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.

Modified: httpd/httpd/trunk/include/http_protocol.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_protocol.h?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_protocol.h (original)
+++ httpd/httpd/trunk/include/http_protocol.h Fri Jan 30 19:12:51 2009
@@ -129,7 +129,7 @@
 /**
  * Build the content-type that should be sent to the client from the
  * content-type specified.  The following rules are followed:
- *    - if type is NULL, type is set to ap_default_type(r)
+ *    - if type is NULL or "", return NULL (do not set content-type).
  *    - if charset adding is disabled, stop processing and return type.
  *    - then, if there are no parameters on type, add the default charset
  *    - return type

Modified: httpd/httpd/trunk/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/include/httpd.h (original)
+++ httpd/httpd/trunk/include/httpd.h Fri Jan 30 19:12:51 2009
@@ -219,24 +219,6 @@
 #define AP_DEFAULT_INDEX "index.html"
 #endif
 
-
-/** 
- * Define this to be what type you'd like returned for files with unknown 
- * suffixes.  
- * @warning MUST be all lower case. 
- */
-#ifndef DEFAULT_CONTENT_TYPE
-#define DEFAULT_CONTENT_TYPE "text/plain"
-#endif
-
-/**
- * NO_CONTENT_TYPE is an alternative DefaultType value that suppresses
- * setting any default type when there's no information (e.g. a proxy).
- */
-#ifndef NO_CONTENT_TYPE
-#define NO_CONTENT_TYPE "none"
-#endif
-
 /** The name of the MIME types file */
 #ifndef AP_TYPES_CONFIG_FILE
 #define AP_TYPES_CONFIG_FILE "conf/mime.types"

Modified: httpd/httpd/trunk/modules/filters/mod_charset_lite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_charset_lite.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_charset_lite.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_charset_lite.c Fri Jan 30 19:12:51 2009
@@ -803,9 +803,9 @@
     /* Check the mime type to see if translation should be performed.
      */
     if (!ctx->noop && ctx->xlate == NULL) {
-        const char *mime_type = f->r->content_type ? f->r->content_type : ap_default_type(f->r);
+        const char *mime_type = f->r->content_type;
 
-        if (strncasecmp(mime_type, "text/", 5) == 0 ||
+        if (mime_type && (strncasecmp(mime_type, "text/", 5) == 0 ||
 #if APR_CHARSET_EBCDIC
         /* On an EBCDIC machine, be willing to translate mod_autoindex-
          * generated output.  Otherwise, it doesn't look too cool.
@@ -822,7 +822,7 @@
             strcmp(mime_type, DIR_MAGIC_TYPE) == 0 ||
 #endif
             strncasecmp(mime_type, "message/", 8) == 0 || 
-            dc->force_xlate == FX_FORCE) {
+            dc->force_xlate == FX_FORCE)) {
 
             rv = apr_xlate_open(&ctx->xlate,
                                 dc->charset_default, dc->charset_source, f->r->pool);
@@ -840,7 +840,7 @@
         }
         else {
             ctx->noop = 1;
-            if (dc->debug >= DBGLVL_GORY) {
+            if (mime_type && dc->debug >= DBGLVL_GORY) {
                 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, f->r,
                               "mime type is %s; no translation selected",
                               mime_type);

Modified: httpd/httpd/trunk/modules/http/byterange_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/byterange_filter.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/byterange_filter.c (original)
+++ httpd/httpd/trunk/modules/http/byterange_filter.c Fri Jan 30 19:12:51 2009
@@ -192,7 +192,7 @@
                                            "byteranges; boundary=",
                                            ctx->boundary, NULL));
 
-        if (strcasecmp(orig_ct, NO_CONTENT_TYPE)) {
+        if (orig_ct) {
             ctx->bound_head = apr_pstrcat(r->pool,
                                           CRLF "--", ctx->boundary,
                                           CRLF "Content-type: ",

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Fri Jan 30 19:12:51 2009
@@ -1181,7 +1181,7 @@
     }
 
     ctype = ap_make_content_type(r, r->content_type);
-    if (strcasecmp(ctype, NO_CONTENT_TYPE)) {
+    if (ctype) {
         apr_table_setn(r->headers_out, "Content-Type", ctype);
     }
 

Modified: httpd/httpd/trunk/modules/mappers/mod_actions.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_actions.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_actions.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_actions.c Fri Jan 30 19:12:51 2009
@@ -178,9 +178,8 @@
     /* Second, check for actions (which override the method scripts) */
     action = r->handler ? r->handler :
         ap_field_noparam(r->pool, r->content_type);
-    action = action ? action : ap_default_type(r);
 
-    if ((t = apr_table_get(conf->action_types, action))) {
+    if (action && (t = apr_table_get(conf->action_types, action))) {
         if (*t++ == '0' && r->finfo.filetype == 0) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                           "File does not exist: %s", r->filename);

Modified: httpd/httpd/trunk/modules/mappers/mod_negotiation.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_negotiation.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_negotiation.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_negotiation.c Fri Jan 30 19:12:51 2009
@@ -1157,8 +1157,7 @@
         anymatch = 1;
 
         /* See if it's something which we have access to, and which
-         * has a known type and encoding (as opposed to something
-         * which we'll be slapping default_type on later).
+         * has a known type and encoding.
          */
         sub_req = ap_sub_req_lookup_dirent(&dirent, r, AP_SUBREQ_MERGE_ARGS,
                                            NULL);
@@ -1238,8 +1237,7 @@
         }
 
         /*
-         * ###: be warned, the _default_ content type is already
-         * picked up here!  If we failed the subrequest, or don't
+         * If we failed the subrequest, or don't
          * know what we are serving, then continue.
          */
         if (sub_req->status != HTTP_OK || (!sub_req->content_type)) {

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c Fri Jan 30 19:12:51 2009
@@ -1718,13 +1718,6 @@
                                            "ISO-8859-1",  NULL));
     }
     else {
-        if (r->content_type) {
-            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
-                     "proxy: FTP: Content-Type set to %s", r->content_type);
-        }
-        else {
-            ap_set_content_type(r, ap_default_type(r));
-        }
         if (xfer_type != 'A' && size != NULL) {
             /* We "trust" the ftp server to really serve (size) bytes... */
             apr_table_setn(r->headers_out, "Content-Length", size);
@@ -1732,9 +1725,11 @@
                          "proxy: FTP: Content-Length set to %s", size);
         }
     }
-    apr_table_setn(r->headers_out, "Content-Type", r->content_type);
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
-                 "proxy: FTP: Content-Type set to %s", r->content_type);
+    if (r->content_type) {
+        apr_table_setn(r->headers_out, "Content-Type", r->content_type);
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+                     "proxy: FTP: Content-Type set to %s", r->content_type);
+    }
 
 #if defined(USE_MDTM) && (defined(HAVE_TIMEGM) || defined(HAVE_GMTOFF))
     if (mtime != 0L) {

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Fri Jan 30 19:12:51 2009
@@ -355,15 +355,15 @@
         return result;
     }
 
-    if (!r->handler) {
-        handler = r->content_type ? r->content_type : ap_default_type(r);
+    if (!r->handler && r->content_type) {
+        handler = r->content_type;
         if ((p=ap_strchr_c(handler, ';')) != NULL) {
             char *new_handler = (char *)apr_pmemdup(r->pool, handler,
                                                     p - handler + 1);
             char *p2 = new_handler + (p - handler);
             handler = new_handler;
 
-            /* MIME type arguments */
+            /* exclude media type arguments */
             while (p2 > handler && p2[-1] == ' ')
                 --p2; /* strip trailing spaces */
 

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Jan 30 19:12:51 2009
@@ -82,10 +82,8 @@
  * server operations, including options and commands which control the
  * operation of other modules.  Consider this the bureaucracy module.
  *
- * The core module also defines handlers, etc., do handle just enough
- * to allow a server with the core module ONLY to actually serve documents
- * (though it slaps DefaultType on all of 'em); this was useful in testing,
- * but may not be worth preserving.
+ * The core module also defines handlers, etc., to handle just enough
+ * to allow a server with the core module ONLY to actually serve documents.
  *
  * This file could almost be mod_core.c, except for the stuff which affects
  * the http_conf_globals.
@@ -263,10 +261,6 @@
         conf->override_opts = new->override_opts;
     }
 
-    if (new->ap_default_type) {
-        conf->ap_default_type = new->ap_default_type;
-    }
-
     if (conf->response_code_strings == NULL) {
         conf->response_code_strings = new->response_code_strings;
     }
@@ -702,18 +696,6 @@
     return SATISFY_NOSPEC;
 }
 
-AP_DECLARE(const char *) ap_default_type(request_rec *r)
-{
-    core_dir_config *conf;
-
-    conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
-                                                   &core_module);
-
-    return conf->ap_default_type
-               ? conf->ap_default_type
-               : DEFAULT_CONTENT_TYPE;
-}
-
 AP_DECLARE(const char *) ap_document_root(request_rec *r) /* Don't use this! */
 {
     core_server_config *conf;
@@ -1477,6 +1459,18 @@
     return NULL;
 }
 
+static const char *set_default_type(cmd_parms *cmd, void *d_,
+                                   const char *arg)
+{
+    if ((strcasecmp(arg, "off") != 0) && (strcasecmp(arg, "none") != 0)) {
+        ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
+              "Ignoring deprecated use of DefaultType in line %d of %s.",
+                     cmd->directive->line_num, cmd->directive->filename);
+    }
+
+    return NULL;
+}
+
 /*
  * Note what data should be used when forming file ETag values.
  * It would be nicer to do this as an ITERATE, but then we couldn't
@@ -3246,9 +3240,8 @@
   "config files"),
 AP_INIT_RAW_ARGS("Options", set_options, NULL, OR_OPTIONS,
   "Set a number of attributes for a given directory"),
-AP_INIT_TAKE1("DefaultType", ap_set_string_slot,
-  (void*)APR_OFFSETOF(core_dir_config, ap_default_type),
-  OR_FILEINFO, "the default MIME type for untypable files"),
+AP_INIT_TAKE1("DefaultType", set_default_type, NULL, OR_FILEINFO,
+  "the default media type for otherwise untyped files (DEPRECATED)"),
 AP_INIT_RAW_ARGS("FileETag", set_etag_bits, NULL, OR_FILEINFO,
   "Specify components used to construct a file's ETag"),
 AP_INIT_TAKE1("EnableMMAP", set_enable_mmap, NULL, OR_FILEINFO,

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=739382&r1=739381&r2=739382&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Fri Jan 30 19:12:51 2009
@@ -94,7 +94,7 @@
 /*
  * Builds the content-type that should be sent to the client from the
  * content-type specified.  The following rules are followed:
- *    - if type is NULL, type is set to ap_default_type(r)
+ *    - if type is NULL or "", return NULL (do not set content-type).
  *    - if charset adding is disabled, stop processing and return type.
  *    - then, if there are no parameters on type, add the default charset
  *    - return type
@@ -108,8 +108,8 @@
     core_request_config *request_conf;
     apr_size_t type_len;
 
-    if (!type) {
-        type = ap_default_type(r);
+    if (!type || *type == '\0') {
+        return NULL;
     }
 
     if (conf->add_default_charset != ADD_DEFAULT_CHARSET_ON) {



Re: svn commit: r739382 - in /httpd/httpd/trunk: ./ include/ modules/filters/ modules/http/ modules/mappers/ modules/proxy/ server/

Posted by Ruediger Pluem <rp...@apache.org>.

On 01/31/2009 08:53 PM, Roy T. Fielding wrote:
> On Jan 31, 2009, at 1:53 AM, Ruediger Pluem wrote:
>> This causes the server to crash in case where no r->handler is set
>> (e.g. in the case
>> of a non existing resource).
> 
> Bummer.  I suppose it would be too difficult to fix the couple hundred
> places where strcmp is used on r->handler without checking for null.

Plus I bet there are a lot of third party modules whose handlers make
the assumption that r->handler != NULL. I am not sure if this is a promised
API guarantee, but I guess many rely on it.

> No objection to applying the patch, but mod_include uses

Done in r739598. I guess we need to find a more suitable place for
the DEFAULT_HANDLER_NAME define (and possibly prefix it with AP_).

Regards

RĂ¼diger


Re: svn commit: r739382 - in /httpd/httpd/trunk: ./ include/ modules/filters/ modules/http/ modules/mappers/ modules/proxy/ server/

Posted by "Roy T. Fielding" <fi...@gbiv.com>.
On Jan 31, 2009, at 1:53 AM, Ruediger Pluem wrote:
> This causes the server to crash in case where no r->handler is set  
> (e.g. in the case
> of a non existing resource).

Bummer.  I suppose it would be too difficult to fix the couple hundred
places where strcmp is used on r->handler without checking for null.
No objection to applying the patch, but mod_include uses

     r->handler = "default-handler"

and others use symbols like

     r->handler = DAV_HANDLER_NAME;

perhaps we should use

     #define DEFAULT_HANDLER_NAME ""
     r->handler = DEFAULT_HANDLER_NAME;

and then fix the other places that are inconsistent.

....Roy


Re: svn commit: r739382 - in /httpd/httpd/trunk: ./ include/ modules/filters/ modules/http/ modules/mappers/ modules/proxy/ server/

Posted by Ruediger Pluem <rp...@apache.org>.

On 01/30/2009 08:12 PM, fielding@apache.org wrote:
> Author: fielding
> Date: Fri Jan 30 19:12:51 2009
> New Revision: 739382
> 
> URL: http://svn.apache.org/viewvc?rev=739382&view=rev
> Log:
> Disabled DefaultType directive and removed ap_default_type()
> from core.  We now exclude Content-Type from responses for which
> a media type has not been configured via mime.types, AddType,
> ForceType, or some other mechanism.  MMN major bump to NZ time.
> 
> PR: 13986
> 
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/include/ap_mmn.h
>     httpd/httpd/trunk/include/http_core.h
>     httpd/httpd/trunk/include/http_protocol.h
>     httpd/httpd/trunk/include/httpd.h
>     httpd/httpd/trunk/modules/filters/mod_charset_lite.c
>     httpd/httpd/trunk/modules/http/byterange_filter.c
>     httpd/httpd/trunk/modules/http/http_filters.c
>     httpd/httpd/trunk/modules/mappers/mod_actions.c
>     httpd/httpd/trunk/modules/mappers/mod_negotiation.c
>     httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c
>     httpd/httpd/trunk/server/config.c
>     httpd/httpd/trunk/server/core.c
>     httpd/httpd/trunk/server/protocol.c
> 

> Modified: httpd/httpd/trunk/server/config.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=739382&r1=739381&r2=739382&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/config.c (original)
> +++ httpd/httpd/trunk/server/config.c Fri Jan 30 19:12:51 2009
> @@ -355,15 +355,15 @@
>          return result;
>      }
>  
> -    if (!r->handler) {
> -        handler = r->content_type ? r->content_type : ap_default_type(r);
> +    if (!r->handler && r->content_type) {
> +        handler = r->content_type;
>          if ((p=ap_strchr_c(handler, ';')) != NULL) {
>              char *new_handler = (char *)apr_pmemdup(r->pool, handler,
>                                                      p - handler + 1);
>              char *p2 = new_handler + (p - handler);
>              handler = new_handler;
>  
> -            /* MIME type arguments */
> +            /* exclude media type arguments */
>              while (p2 > handler && p2[-1] == ' ')
>                  --p2; /* strip trailing spaces */
>  
> 

This causes the server to crash in case where no r->handler is set (e.g. in the case
of a non existing resource).

The following patch fixes this:

Index: server/config.c
===================================================================
--- server/config.c     (Revision 739530)
+++ server/config.c     (Arbeitskopie)
@@ -355,20 +355,25 @@
         return result;
     }

-    if (!r->handler && r->content_type) {
-        handler = r->content_type;
-        if ((p=ap_strchr_c(handler, ';')) != NULL) {
-            char *new_handler = (char *)apr_pmemdup(r->pool, handler,
-                                                    p - handler + 1);
-            char *p2 = new_handler + (p - handler);
-            handler = new_handler;
+    if (!r->handler) {
+        if (r->content_type) {
+            handler = r->content_type;
+            if ((p=ap_strchr_c(handler, ';')) != NULL) {
+                char *new_handler = (char *)apr_pmemdup(r->pool, handler,
+                                                        p - handler + 1);
+                char *p2 = new_handler + (p - handler);
+                handler = new_handler;

-            /* exclude media type arguments */
-            while (p2 > handler && p2[-1] == ' ')
-                --p2; /* strip trailing spaces */
+                /* exclude media type arguments */
+                while (p2 > handler && p2[-1] == ' ')
+                    --p2; /* strip trailing spaces */

-            *p2='\0';
+                *p2='\0';
+            }
         }
+        else {
+            handler = "";
+        }

         r->handler = handler;
     }


Comments / thoughts / better ideas? Otherwise I would commit.


Regards

RĂ¼diger