You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2011/09/08 17:59:38 UTC

svn commit: r1166772 - in /httpd/httpd/branches/2.2.x: 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

Author: covener
Date: Thu Sep  8 15:59:38 2011
New Revision: 1166772

URL: http://svn.apache.org/viewvc?rev=1166772&view=rev
Log:
Merge r1166663, r1166667 from trunk:

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

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/include/ap_mmn.h
    httpd/httpd/branches/2.2.x/include/http_protocol.h
    httpd/httpd/branches/2.2.x/modules/dav/fs/repos.c
    httpd/httpd/branches/2.2.x/modules/filters/mod_filter.c
    httpd/httpd/branches/2.2.x/modules/http/http_protocol.c
    httpd/httpd/branches/2.2.x/modules/mappers/mod_negotiation.c
    httpd/httpd/branches/2.2.x/server/core.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Thu Sep  8 15:59:38 2011
@@ -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.

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Thu Sep  8 15:59:38 2011
@@ -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

Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Thu Sep  8 15:59:38 2011
@@ -147,6 +147,7 @@
  * 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" */
@@ -154,7 +155,7 @@
 #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

Modified: httpd/httpd/branches/2.2.x/include/http_protocol.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/http_protocol.h?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/http_protocol.h (original)
+++ httpd/httpd/branches/2.2.x/include/http_protocol.h Thu Sep  8 15:59:38 2011
@@ -309,6 +309,13 @@ AP_DECLARE(void) ap_clear_method_list(ap
  */
 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.
  */

Modified: httpd/httpd/branches/2.2.x/modules/dav/fs/repos.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/dav/fs/repos.c?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/dav/fs/repos.c (original)
+++ httpd/httpd/branches/2.2.x/modules/dav/fs/repos.c Thu Sep  8 15:59:38 2011
@@ -948,7 +948,7 @@ static dav_error * dav_fs_set_headers(re
     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);

Modified: httpd/httpd/branches/2.2.x/modules/filters/mod_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/filters/mod_filter.c?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/filters/mod_filter.c (original)
+++ httpd/httpd/branches/2.2.x/modules/filters/mod_filter.c Thu Sep  8 15:59:38 2011
@@ -321,7 +321,7 @@ static int filter_lookup(ap_filter_t *f,
             }
 
             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 */

Modified: httpd/httpd/branches/2.2.x/modules/http/http_protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/http/http_protocol.c?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/http/http_protocol.c (original)
+++ httpd/httpd/branches/2.2.x/modules/http/http_protocol.c Thu Sep  8 15:59:38 2011
@@ -848,6 +848,13 @@ AP_DECLARE(void) ap_set_content_type(req
     }
 }
 
+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,

Modified: httpd/httpd/branches/2.2.x/modules/mappers/mod_negotiation.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/mappers/mod_negotiation.c?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/mappers/mod_negotiation.c (original)
+++ httpd/httpd/branches/2.2.x/modules/mappers/mod_negotiation.c Thu Sep  8 15:59:38 2011
@@ -3009,7 +3009,7 @@ static int handle_map_file(request_rec *
          * 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 */

Modified: httpd/httpd/branches/2.2.x/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/core.c?rev=1166772&r1=1166771&r2=1166772&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/core.c (original)
+++ httpd/httpd/branches/2.2.x/server/core.c Thu Sep  8 15:59:38 2011
@@ -3763,7 +3763,7 @@ static int default_handler(request_rec *
         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);