You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2019/11/07 12:21:35 UTC
svn commit: r1869502 - in /httpd/httpd/branches/2.4.x: ./ CHANGES
modules/filters/mod_brotli.c modules/filters/mod_deflate.c
Author: ylavic
Date: Thu Nov 7 12:21:35 2019
New Revision: 1869502
URL: http://svn.apache.org/viewvc?rev=1869502&view=rev
Log:
Merge r1868313 from trunk:
Honor "Accept-Encoding: foo;q=0" as per RFC 7231; which means 'foo' is
"not acceptable". PR 58158
Submitted by: jailletc36
Reviewed/backported by: jailletc36, jim, ylavic
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/CHANGES
httpd/httpd/branches/2.4.x/modules/filters/mod_brotli.c
httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
Merged /httpd/httpd/trunk:r1868313
Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1869502&r1=1869501&r2=1869502&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Thu Nov 7 12:21:35 2019
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.4.42
+ *) mod_deflate, mod_brotli: honor "Accept-Encoding: foo;q=0" as per RFC 7231; which
+ means 'foo' is "not acceptable". PR 58158 [Chistophe Jaillet]
+
*) mod_md v2.2.3:
- Configuring MDCAChallenges replaces any previous existing challenge configuration. It
had been additive before which was not the intended behaviour. [@mkauf]
Modified: httpd/httpd/branches/2.4.x/modules/filters/mod_brotli.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/filters/mod_brotli.c?rev=1869502&r1=1869501&r2=1869502&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/filters/mod_brotli.c (original)
+++ httpd/httpd/branches/2.4.x/modules/filters/mod_brotli.c Thu Nov 7 12:21:35 2019
@@ -344,6 +344,7 @@ static apr_status_t compress_filter(ap_f
const char *encoding;
const char *token;
const char *accepts;
+ const char *q = NULL;
/* Only work on main request, not subrequests, that are not
* a 204 response with no content, and are not tagged with the
@@ -411,7 +412,19 @@ static apr_status_t compress_filter(ap_f
token = (*accepts) ? ap_get_token(r->pool, &accepts, 0) : NULL;
}
- if (!token || token[0] == '\0') {
+ /* Find the qvalue, if provided */
+ if (*accepts) {
+ while (*accepts == ';') {
+ ++accepts;
+ }
+ q = ap_get_token(r->pool, &accepts, 1);
+ ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
+ "token: '%s' - q: '%s'", token, q);
+ }
+
+ /* No acceptable token found or q=0 */
+ if (!token || token[0] == '\0' ||
+ (q && strlen(q) >= 3 && strncmp("q=0.000", q, strlen(q)) == 0)) {
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}
Modified: httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c?rev=1869502&r1=1869501&r2=1869502&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c (original)
+++ httpd/httpd/branches/2.4.x/modules/filters/mod_deflate.c Thu Nov 7 12:21:35 2019
@@ -699,6 +699,8 @@ static apr_status_t deflate_out_filter(a
*/
if (!apr_table_get(r->subprocess_env, "force-gzip")) {
const char *accepts;
+ const char *q = NULL;
+
/* if they don't have the line, then they can't play */
accepts = apr_table_get(r->headers_in, "Accept-Encoding");
if (accepts == NULL) {
@@ -721,10 +723,21 @@ static apr_status_t deflate_out_filter(a
token = (*accepts) ? ap_get_token(r->pool, &accepts, 0) : NULL;
}
- /* No acceptable token found. */
- if (token == NULL || token[0] == '\0') {
+ /* Find the qvalue, if provided */
+ if (*accepts) {
+ while (*accepts == ';') {
+ ++accepts;
+ }
+ q = ap_get_token(r->pool, &accepts, 1);
+ ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
+ "token: '%s' - q: '%s'", token, q);
+ }
+
+ /* No acceptable token found or q=0 */
+ if (!token || token[0] == '\0' ||
+ (q && strlen(q) >= 3 && strncmp("q=0.000", q, strlen(q)) == 0)) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
- "Not compressing (no Accept-Encoding: gzip)");
+ "Not compressing (no Accept-Encoding: gzip or q=0)");
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}