-*- coding: utf-8 -*-
Changes with Apache 2.2.7
+ *) HTTP protocol: Add "DefaultType none" option.
+ PR 13986 and PR 16139 [Nick Kew]
+
*) mod_rewrite: Add option to suppress URL unescaping
PR 34602 [Guenther Gsenger <guenther.gsenger gmail.com>]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * HTTP protocol: Add "DefaultType none" option.
- PR 13986 and PR 16139
- http://svn.apache.org/viewvc?view=rev&revision=579991 (code)
- http://svn.apache.org/viewvc?view=rev&revision=580502 (docs)
- http://svn.apache.org/viewvc?view=rev&revision=584842 (docs)
- +1: niq, rpluem, jim
-
* Core: Fix possible crash at startup in case of nonexistent DocumentRoot.
PR 39722
http://svn.apache.org/viewvc?view=rev&revision=589177
<name>DefaultType</name>
<description>MIME content-type that will be sent if the
server cannot determine a type in any other way</description>
-<syntax>DefaultType <var>MIME-type</var></syntax>
+<syntax>DefaultType <var>MIME-type|none</var></syntax>
<default>DefaultType text/plain</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context>
document whose type cannot be determined by its <glossary
ref="mime-type">MIME types</glossary> mappings.</p>
- <p>The server must inform the client of the content-type of the
- document, so in the event of an unknown type it uses the
+ <p>The server SHOULD inform the client of the content-type of the
+ document. If the server is unable to determine this by normal
+ means, it will set it to the configured
<code>DefaultType</code>. For example:</p>
<example>
<p>would be appropriate for a directory which contained many GIF
images with filenames missing the <code>.gif</code> extension.</p>
+ <p>In cases where it can neither be determined by the server nor
+ the administrator (e.g. a proxy), it is preferable to omit the MIME
+ type altogether rather than provide information that may be false.
+ This can be accomplished using</p>
+ <example>
+ DefaultType None
+ </example>
+ <p>DefaultType None is only available in httpd-2.2.7 and later.</p>
+
<p>Note that unlike <directive
module="core">ForceType</directive>, this directive only
provides the default mime-type. All other mime-type definitions,
#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"
"byteranges; boundary=",
ctx->boundary, NULL));
- ctx->bound_head = apr_pstrcat(r->pool,
- CRLF "--", ctx->boundary,
- CRLF "Content-type: ",
- orig_ct,
- CRLF "Content-range: bytes ",
- NULL);
+ if (strcasecmp(orig_ct, NO_CONTENT_TYPE)) {
+ ctx->bound_head = apr_pstrcat(r->pool,
+ CRLF "--", ctx->boundary,
+ CRLF "Content-type: ",
+ orig_ct,
+ CRLF "Content-range: bytes ",
+ NULL);
+ }
+ else {
+ /* if we have no type for the content, do our best */
+ ctx->bound_head = apr_pstrcat(r->pool,
+ CRLF "--", ctx->boundary,
+ CRLF "Content-range: bytes ",
+ NULL);
+ }
ap_xlate_proto_to_ascii(ctx->bound_head, strlen(ctx->bound_head));
}
apr_bucket_brigade *b2;
header_struct h;
header_filter_ctx *ctx = f->ctx;
+ const char *ctype;
AP_DEBUG_ASSERT(!r->main);
apr_table_unset(r->headers_out, "Content-Length");
}
- apr_table_setn(r->headers_out, "Content-Type",
- ap_make_content_type(r, r->content_type));
+ ctype = ap_make_content_type(r, r->content_type);
+ if (strcasecmp(ctype, NO_CONTENT_TYPE)) {
+ apr_table_setn(r->headers_out, "Content-Type", ctype);
+ }
if (r->content_encoding) {
apr_table_setn(r->headers_out, "Content-Encoding",