-*- coding: utf-8 -*-
Changes with Apache 2.5.1
+ *) 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_proxy: Fix crash by resolving pool concurrency problems. PR 63503
[Ruediger Pluem, Eric Covener]
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
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);
}
*/
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) {
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);
}