From 24c8f2c594dc9b7327c398702bcb338641607fc0 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sun, 23 Oct 2011 22:17:52 +0000 Subject: [PATCH] Log reason for not deflating at level trace1 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1187991 13f79535-47bb-0310-9956-ffa450edef68 --- modules/filters/mod_deflate.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 7a2271136b..ba537e491e 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -463,7 +463,7 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, while (1) { apr_status_t rc; if (APR_BUCKET_IS_EOS(e)) { - ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r, + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "Not compressing very small response of %" APR_SIZE_T_FMT " bytes", len); ap_remove_output_filter(f); @@ -498,6 +498,15 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, apr_table_get(r->subprocess_env, "no-gzip") || apr_table_get(r->headers_out, "Content-Range") ) { + if (APLOG_R_IS_LEVEL(r, APLOG_TRACE1)) { + const char *reason = + (r->main != NULL) ? "subrequest" : + (r->status == HTTP_NO_CONTENT) ? "no content" : + apr_table_get(r->subprocess_env, "no-gzip") ? "no-gzip" : + "content-range"; + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "Not compressing (%s)", reason); + } ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } @@ -511,6 +520,8 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, const char *env_value = apr_table_get(r->subprocess_env, "gzip-only-text/html"); if ( env_value && (strcmp(env_value,"1") == 0) ) { + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "Not compressing, (gzip-only-text/html)"); ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } @@ -547,7 +558,9 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, /* stolen from mod_negotiation: */ if (strcmp(token, "identity") && strcmp(token, "7bit") && strcmp(token, "8bit") && strcmp(token, "binary")) { - + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "Not compressing (content-encoding already " + " set: %s)", token); ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } @@ -595,10 +608,16 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, /* No acceptable token found. */ if (token == NULL || token[0] == '\0') { + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "Not compressing (no Accept-Encoding: gzip)"); ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } } + else { + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "Forcing compression (force-gzip set)"); + } /* At this point we have decided to filter the content. Let's try to * to initialize zlib (except for 304 responses, where we will only -- 2.50.0