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 14:56:09 UTC

svn commit: r1166663 - in /httpd/httpd/trunk: include/ap_mmn.h include/http_protocol.h modules/dav/fs/repos.c modules/filters/mod_reflector.c modules/http/http_protocol.c modules/mappers/mod_negotiation.c modules/test/mod_dialup.c server/core.c

Author: covener
Date: Thu Sep  8 12:56:08 2011
New Revision: 1166663

URL: http://svn.apache.org/viewvc?rev=1166663&view=rev
Log:
refactor to pull setting of Accept-Ranges header into http_protocol.c which
had been copied to other handlers.


Modified:
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_protocol.h
    httpd/httpd/trunk/modules/dav/fs/repos.c
    httpd/httpd/trunk/modules/filters/mod_reflector.c
    httpd/httpd/trunk/modules/http/http_protocol.c
    httpd/httpd/trunk/modules/mappers/mod_negotiation.c
    httpd/httpd/trunk/modules/test/mod_dialup.c
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Thu Sep  8 12:56:08 2011
@@ -349,6 +349,7 @@
  * 20110724.2 (2.3.15-dev) retries and retry_delay in util_ldap_state_t
  * 20110724.3 (2.3.15-dev) add util_varbuf.h / ap_varbuf API
  * 20110724.4 (2.3.15-dev) add max_ranges to core_dir_config
+ * 20110724.5 (2.3.15-dev) add ap_set_accept_ranges()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -356,7 +357,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20110724
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 4                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 5                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/http_protocol.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_protocol.h?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_protocol.h (original)
+++ httpd/httpd/trunk/include/http_protocol.h Thu Sep  8 12:56:08 2011
@@ -306,6 +306,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 respons
+ * @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/trunk/modules/dav/fs/repos.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/fs/repos.c?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/dav/fs/repos.c (original)
+++ httpd/httpd/trunk/modules/dav/fs/repos.c Thu Sep  8 12:56:08 2011
@@ -1056,7 +1056,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/trunk/modules/filters/mod_reflector.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_reflector.c?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_reflector.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_reflector.c Thu Sep  8 12:56:08 2011
@@ -87,7 +87,7 @@ static int reflector_handler(request_rec
             ap_update_mtime(r, apr_time_now());
             ap_set_last_modified(r);
         }
-        apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
+        ap_set_accept_ranges(r);
 
         /* reflect the content length, if present */
         if ((content_length = apr_table_get(r->headers_in, "Content-Length"))) {

Modified: httpd/httpd/trunk/modules/http/http_protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_protocol.c?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_protocol.c (original)
+++ httpd/httpd/trunk/modules/http/http_protocol.c Thu Sep  8 12:56:08 2011
@@ -849,6 +849,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_core_module_config(r->per_dir_config);
+    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/trunk/modules/mappers/mod_negotiation.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_negotiation.c?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_negotiation.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_negotiation.c Thu Sep  8 12:56:08 2011
@@ -3007,7 +3007,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/trunk/modules/test/mod_dialup.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/test/mod_dialup.c?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/test/mod_dialup.c (original)
+++ httpd/httpd/trunk/modules/test/mod_dialup.c Thu Sep  8 12:56:08 2011
@@ -172,7 +172,7 @@ dialup_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);
 
     status = ap_meets_conditions(r);

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1166663&r1=1166662&r2=1166663&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Thu Sep  8 12:56:08 2011
@@ -4211,9 +4211,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", 
-                       (d->max_ranges == AP_MAXRANGES_NORANGES) ? "none" 
-                                                                : "bytes");
+        ap_set_accept_ranges(r);
         ap_set_content_length(r, r->finfo.size);
         if (bld_content_md5) {
             apr_table_setn(r->headers_out, "Content-MD5",