httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r589616 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS docs/manual/mod/core.xml include/httpd.h modules/http/byterange_filter.c modules/http/http_filters.c
Date Mon, 29 Oct 2007 13:11:44 GMT
Author: jim
Date: Mon Oct 29 06:11:42 2007
New Revision: 589616

URL: http://svn.apache.org/viewvc?rev=589616&view=rev
Log:
Merge r579991, r580502, r584842 from trunk:

Add "DefaultType None" option
PR 13986 and PR 16139


Document "DefaultType None" option (PR 13986)


Improve documentation of "DefaultType None"

Submitted by: niq
Reviewed by: jim

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/docs/manual/mod/core.xml
    httpd/httpd/branches/2.2.x/include/httpd.h
    httpd/httpd/branches/2.2.x/modules/http/byterange_filter.c
    httpd/httpd/branches/2.2.x/modules/http/http_filters.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=589616&r1=589615&r2=589616&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Mon Oct 29 06:11:42 2007
@@ -1,6 +1,9 @@
                                                         -*- 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>]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=589616&r1=589615&r2=589616&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Mon Oct 29 06:11:42 2007
@@ -79,13 +79,6 @@
 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

Modified: httpd/httpd/branches/2.2.x/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/mod/core.xml?rev=589616&r1=589615&r2=589616&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/mod/core.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/mod/core.xml Mon Oct 29 06:11:42 2007
@@ -596,7 +596,7 @@
 <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>
@@ -608,8 +608,9 @@
     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>
@@ -618,6 +619,15 @@
 
     <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

Modified: httpd/httpd/branches/2.2.x/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/httpd.h?rev=589616&r1=589615&r2=589616&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/httpd.h (original)
+++ httpd/httpd/branches/2.2.x/include/httpd.h Mon Oct 29 06:11:42 2007
@@ -233,6 +233,14 @@
 #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/branches/2.2.x/modules/http/byterange_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/http/byterange_filter.c?rev=589616&r1=589615&r2=589616&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/http/byterange_filter.c (original)
+++ httpd/httpd/branches/2.2.x/modules/http/byterange_filter.c Mon Oct 29 06:11:42 2007
@@ -193,12 +193,21 @@
                                            "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));
     }
 

Modified: httpd/httpd/branches/2.2.x/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/http/http_filters.c?rev=589616&r1=589615&r2=589616&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/http/http_filters.c (original)
+++ httpd/httpd/branches/2.2.x/modules/http/http_filters.c Mon Oct 29 06:11:42 2007
@@ -926,6 +926,7 @@
     apr_bucket_brigade *b2;
     header_struct h;
     header_filter_ctx *ctx = f->ctx;
+    const char *ctype;
 
     AP_DEBUG_ASSERT(!r->main);
 
@@ -1001,8 +1002,10 @@
         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",



Mime
View raw message