]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1166663, r1166667 from trunk:
authorEric Covener <covener@apache.org>
Thu, 8 Sep 2011 15:59:38 +0000 (15:59 +0000)
committerEric Covener <covener@apache.org>
Thu, 8 Sep 2011 15:59:38 +0000 (15:59 +0000)
refactor to pull setting of Accept-Ranges header into http_protocol.c which
had been copied to other handlers.

Set Accept-Rangs: none instead of unsetting the Accept-Range header when we
have a filter that doesn't like byteranges.

Submitted By: Eric Covener
Reviewed By: covener, wrowe, rpluem

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1166772 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
include/ap_mmn.h
include/http_protocol.h
modules/dav/fs/repos.c
modules/filters/mod_filter.c
modules/http/http_protocol.c
modules/mappers/mod_negotiation.c
server/core.c

diff --git a/CHANGES b/CHANGES
index 0f9449006973b2289322d28e9c56e43533843390..07fd378a8d30c05ab2134140520c0d707315473e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.21
 
+  *) mod_filter: Instead of dropping the Accept-Ranges header when a filter
+     registered with AP_FILTER_PROTO_NO_BYTERANGE is present,
+     set the header value to "none". [Eric Covener, Ruediger Pluem]
+
   *) mod_proxy_ajp: Ignore flushing if headers have not been sent.
      PR 51608 [Ruediger Pluem]
 
@@ -18,8 +22,8 @@ Changes with Apache 2.2.21
      referencing the invalid int: map at runtime. PR 50994.
      [Ben Noordhuis <info noordhuis nl>]
 
-  *) core: Add MaxRanges directive to control the number of ranges permitted
-     before returning the entire resource, with a default limit of 200.
+  *) core: Allow MaxRanges none|unlimited|default and set 'Accept-Ranges: none'
+     in the case Ranges are being ignored with MaxRanges none.
      [Eric Covener]
 
   *) mod_proxy_ajp: Respect "reuse" flag in END_REPONSE packets.
diff --git a/STATUS b/STATUS
index 3d8002f5aa66dd96fd339e0b929529f1bdb1d40e..0ea546884a5f91a937e6f2efdd2a92577f6ed204 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -93,17 +93,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * core: Send Accept-Ranges: none when MaxRanges none is configured
-      Trunk version of patch: 
-          http://svn.apache.org/viewvc?rev=1166282&view=rev (Just the Accept-Range change)
-          revised 9/8: add http://svn.apache.org/viewvc?rev=1166663&view=rev
-                       add http://svn.apache.org/viewvc?rev=1166667&view=rev
-           
-      2.2.x version of patch:
-          http://people.apache.org/~covener/patches/httpd-2.2.x-maxranges-norange.diff
-          w/ 9/8 additions: http://people.apache.org/~covener/patches/httpd-2.2.x-accept_ranges_none.diff
-    +1: covener, wrowe, rpluem
-
   * mod_proxy_ajp: return HTTP_NOT_IMPLEMENTED when AJP_EBAD_METHOD
     Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1166551 &
                  http://svn.apache.org/viewvc?view=revision&revision=1166657
index 50fe52cfcbf41ef149a4ec832b070d06eace0868..bee9853a4a5408b2c130346eb42c6f80afd2d59c 100644 (file)
  * 20051115.28 (2.2.19) Restore ap_unescape_url_keep2f(char *url) signature 
  *                      altered in 2.2.18.  Add ap_unescape_url_keep2f_ex().
  * 20051115.29 (2.2.21) add max_ranges to core_dir_config
+ * 20051115.30 (2.2.21) add ap_set_accept_ranges()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 29                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 30                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index 276d09bf98fb6b23acc809f3e0d699ed34a170e7..d18f1ed2298b73cbfb993235dfb231af8fab9819 100644 (file)
@@ -309,6 +309,13 @@ AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l);
  */
 AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct);
 
+/**
+ * Set the Accept-Ranges header for this response
+ * @param r The current request
+ */
+AP_DECLARE(void) ap_set_accept_ranges(request_rec *r);
+
+
 /* Hmmm... could macrofy these for now, and maybe forever, though the
  * definitions of the macros would get a whole lot hairier.
  */
index bb1978815b0ee37f7f8f3e7b52c77e5f8f2a5a06..0502808c652512c6e147619ee7a6ebcba97482f3 100644 (file)
@@ -948,7 +948,7 @@ static dav_error * dav_fs_set_headers(request_rec *r,
     ap_set_etag(r);
 
     /* we accept byte-ranges */
-    apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
+    ap_set_accept_ranges(r);
 
     /* set up the Content-Length header */
     ap_set_content_length(r, resource->info->finfo.size);
index 8e7062293524f541b88f05a7e6915b180a26f0cd..ad7aba3daa6a9829b591191befc6787d4939ca46 100644 (file)
@@ -321,7 +321,7 @@ static int filter_lookup(ap_filter_t *f, ap_filter_rec_t *filter)
             }
 
             if (proto_flags & AP_FILTER_PROTO_NO_BYTERANGE) {
-                apr_table_unset(r->headers_out, "Accept-Ranges");
+                apr_table_setn(r->headers_out, "Accept-Ranges", "none");
             }
             else if (rctx && rctx->range) {
                 /* restore range header we saved earlier */
index be864e8256e64815873e089d8f2a3240e7f4ca1a..6812c4904908ab46ab48f4ecd0bfe304f233d301 100644 (file)
@@ -848,6 +848,13 @@ AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct)
     }
 }
 
+AP_DECLARE(void) ap_set_accept_ranges(request_rec *r)
+{
+    core_dir_config *d = ap_get_module_config(r->per_dir_config, &core_module);
+    apr_table_setn(r->headers_out, "Accept-Ranges",
+                  (d->max_ranges == AP_MAXRANGES_NORANGES) ? "none"
+                                                           : "bytes");
+}
 static const char *add_optional_notes(request_rec *r,
                                       const char *prefix,
                                       const char *key,
index 6feb58c0a56a923c74f086fb5491563b7e121297..25e60348b777956a9df99d0d7081abeb3972e593 100644 (file)
@@ -3009,7 +3009,7 @@ static int handle_map_file(request_rec *r)
          * ap_set_last_modified(r);
          * ap_set_etag(r);
          */
-        apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
+        ap_set_accept_ranges(r);
         ap_set_content_length(r, best->bytes);
 
         /* set MIME type and charset as negotiated */
index f2cfd48ebcd67591e660ae334f128a70a8e050e0..ca72713925fdd804ef5172f7a3fd04a91202c5b1 100644 (file)
@@ -3763,7 +3763,7 @@ static int default_handler(request_rec *r)
         ap_update_mtime(r, r->finfo.mtime);
         ap_set_last_modified(r);
         ap_set_etag(r);
-        apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
+        ap_set_accept_ranges(r);
         ap_set_content_length(r, r->finfo.size);
 
         bb = apr_brigade_create(r->pool, c->bucket_alloc);