Skip to content

Commit 5f82765

Browse files
committed
Merge r1427465, r1918823 from trunk:
Remove support for Request-Range header sent by Navigator 2-3 and MSIE 3 * Follow up to r1918814: Strings are from configuration and thus trusted Submitted by: sf, rpluem Reviewed by: rpluem, covener, jorton Github: closes #475 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1920981 13f79535-47bb-0310-9956-ffa450edef68
1 parent be9f2ea commit 5f82765

File tree

6 files changed

+16
-44
lines changed

6 files changed

+16
-44
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
-*- coding: utf-8 -*-
22
Changes with Apache 2.4.63
33

4+
*) http: Remove support for Request-Range header sent by Navigator 2-3 and
5+
MSIE 3. [Stefan Fritsch]
6+
47
*) mod_rewrite: Don't require [UNC] flag to preserve a leading //
58
added by applying the perdir prefix to the substitution.
69
[Ruediger Pluem, Eric Covener]

modules/filters/mod_ext_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static apr_status_t init_filter_instance(ap_filter_t *f)
610610
}
611611
if (ctx->filter->outtype &&
612612
ctx->filter->outtype != OUTTYPE_UNCHANGED) {
613-
ap_set_content_type(f->r, ctx->filter->outtype);
613+
ap_set_content_type_ex(f->r, ctx->filter->outtype, 1);
614614
}
615615
if (ctx->filter->preserves_content_length != 1) {
616616
/* nasty, but needed to avoid confusing the browser

modules/generators/mod_autoindex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,11 +2052,11 @@ static int index_directory(request_rec *r,
20522052
#endif
20532053
}
20542054
if (*charset) {
2055-
ap_set_content_type(r, apr_pstrcat(r->pool, ctype, ";charset=",
2056-
charset, NULL));
2055+
ap_set_content_type_ex(r, apr_pstrcat(r->pool, ctype, ";charset=",
2056+
charset, NULL), 1);
20572057
}
20582058
else {
2059-
ap_set_content_type(r, ctype);
2059+
ap_set_content_type_ex(r, ctype, 1);
20602060
}
20612061

20622062
if (autoindex_opts & TRACK_MODIFIED) {

modules/http/byterange_filter.c

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,7 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
100100
return 0;
101101
}
102102

103-
/*
104-
* Check for Range request-header (HTTP/1.1) or Request-Range for
105-
* backwards-compatibility with second-draft Luotonen/Franks
106-
* byte-ranges (e.g. Netscape Navigator 2-3).
107-
*
108-
* We support this form, with Request-Range, and (farther down) we
109-
* send multipart/x-byteranges instead of multipart/byteranges for
110-
* Request-Range based requests to work around a bug in Netscape
111-
* Navigator 2-3 and MSIE 3.
112-
*/
113-
114-
if (!(range = apr_table_get(r->headers_in, "Range"))) {
115-
range = apr_table_get(r->headers_in, "Request-Range");
116-
}
117-
103+
range = apr_table_get(r->headers_in, "Range");
118104
if (!range || strncasecmp(range, "bytes=", 6) || r->status != HTTP_OK) {
119105
return 0;
120106
}
@@ -126,10 +112,9 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
126112

127113
/* is content already a multiple range? */
128114
if ((ct = apr_table_get(r->headers_out, "Content-Type"))
129-
&& (!strncasecmp(ct, "multipart/byteranges", 20)
130-
|| !strncasecmp(ct, "multipart/x-byteranges", 22))) {
115+
&& strncasecmp(ct, "multipart/byteranges", 20) == 0) {
131116
return 0;
132-
}
117+
}
133118

134119
/*
135120
* Check the If-Range header for Etag or Date.
@@ -298,21 +283,6 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
298283
return num_ranges;
299284
}
300285

301-
/*
302-
* Here we try to be compatible with clients that want multipart/x-byteranges
303-
* instead of multipart/byteranges (also see above), as per HTTP/1.1. We
304-
* look for the Request-Range header (e.g. Netscape 2 and 3) as an indication
305-
* that the browser supports an older protocol. We also check User-Agent
306-
* for Microsoft Internet Explorer 3, which needs this as well.
307-
*/
308-
static int use_range_x(request_rec *r)
309-
{
310-
const char *ua;
311-
return (apr_table_get(r->headers_in, "Request-Range")
312-
|| ((ua = apr_table_get(r->headers_in, "User-Agent"))
313-
&& ap_strstr_c(ua, "MSIE 3")));
314-
}
315-
316286
#define BYTERANGE_FMT "%" APR_OFF_T_FMT "-%" APR_OFF_T_FMT "/%" APR_OFF_T_FMT
317287

318288
static apr_status_t copy_brigade_range(apr_bucket_brigade *bb,
@@ -503,10 +473,9 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f,
503473
/* Is ap_make_content_type required here? */
504474
const char *orig_ct = ap_make_content_type(r, r->content_type);
505475

506-
ap_set_content_type(r, apr_pstrcat(r->pool, "multipart",
507-
use_range_x(r) ? "/x-" : "/",
508-
"byteranges; boundary=",
509-
ap_multipart_boundary, NULL));
476+
ap_set_content_type_ex(r, apr_pstrcat(r->pool,
477+
"multipart/byteranges; boundary=",
478+
ap_multipart_boundary, NULL), 1);
510479

511480
if (orig_ct) {
512481
bound_head = apr_pstrcat(r->pool,

modules/http/http_request.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ AP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *
808808
}
809809

810810
if (r->handler)
811-
ap_set_content_type(new, r->content_type);
811+
ap_set_content_type_ex(new, r->content_type, AP_REQUEST_IS_TRUSTED_CT(r));
812812
access_status = ap_process_request_internal(new);
813813
if (access_status == OK) {
814814
access_status = ap_invoke_handler(new);

modules/proxy/mod_proxy_ftp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,10 +1878,10 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
18781878

18791879
/* set content-type */
18801880
if (dirlisting) {
1881-
ap_set_content_type(r, apr_pstrcat(p, "text/html;charset=",
1881+
ap_set_content_type_ex(r, apr_pstrcat(p, "text/html;charset=",
18821882
fdconf->ftp_directory_charset ?
18831883
fdconf->ftp_directory_charset :
1884-
"ISO-8859-1", NULL));
1884+
"ISO-8859-1", NULL), 1);
18851885
}
18861886
else {
18871887
if (xfer_type != 'A' && size != NULL) {

0 commit comments

Comments
 (0)