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
-*- 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]
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.
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
* 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
*/
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.
*/
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);
}
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 */
}
}
+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,
* 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 */
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);