[Remove entries to the current 2.0 section below, when backported]
+ *) you can now specify the compression level for mod_deflate.
+ [Ian Holsman, Stephen Pierzchala <stephen@pierzchala.com>,
+ Michael Schroepl <Michael.Schroepl@telekurs.de>]
+
*) Restore the ability of htdigest.exe to create files that contain
more than one user. PR 12910. [André Malo]
</directivesynopsis>
<directivesynopsis>
+
<name>DeflateMemLevel</name>
<description>How much memory should be used by zlib for compression</description>
<syntax>DeflateMemLevel <var>value</var></syntax>
</usage>
</directivesynopsis>
+<directivesynopsis>
+<name>CompressionLevel</name>
+<description>How much compression do we apply to the output</description>
+<syntax>CompressionLevel<var>value</var></syntax>
+<default>Zlib's default</default>
+<contextlist><context>server config</context><context>virtual host</context>
+</contextlist>
+
+<usage>
+ <p>The <directive>CompressionLevel</directive> directive specifies
+ what level of compression should be used, the higher the value,
+ the better the compression, but the more CPU time is required to
+ achieve this.</p>
+ <p>The value must between 1 (less compression) and 9 (more compression).</p>
+</usage>
+</directivesynopsis>
+
+
</modulesynopsis>
{
int windowSize;
int memlevel;
+ int compressionlevel;
apr_size_t bufferSize;
char *note_ratio_name;
char *note_input_name;
} deflate_filter_config;
/* windowsize is negative to suppress Zlib header */
+#define DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION
#define DEFAULT_WINDOWSIZE -15
#define DEFAULT_MEMLEVEL 9
#define DEFAULT_BUFFERSIZE 8096
c->memlevel = DEFAULT_MEMLEVEL;
c->windowSize = DEFAULT_WINDOWSIZE;
c->bufferSize = DEFAULT_BUFFERSIZE;
+ c->compressionlevel = DEFAULT_COMPRESSION;
return c;
}
return NULL;
}
+static const char *deflate_set_compressionlevel(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ deflate_filter_config *c = ap_get_module_config(cmd->server->module_config,
+ &deflate_module);
+ int i;
+
+ i = atoi(arg);
+
+ if (i < 1 || i > 9)
+ return "Compression Level must be between 1 and 9";
+
+ c->compressionlevel = i;
+
+ return NULL;
+}
+
/* magic header */
static char deflate_magic[2] = { '\037', '\213' };
ctx->bb = apr_brigade_create(r->pool, f->c->bucket_alloc);
ctx->buffer = apr_palloc(r->pool, c->bufferSize);
- zRC = deflateInit2(&ctx->stream, Z_BEST_SPEED, Z_DEFLATED,
+ zRC = deflateInit2(&ctx->stream, c->compressionlevel, Z_DEFLATED,
c->windowSize, c->memlevel,
Z_DEFAULT_STRATEGY);
"Set the Deflate Buffer Size"),
AP_INIT_TAKE1("DeflateMemLevel", deflate_set_memlevel, NULL, RSRC_CONF,
"Set the Deflate Memory Level (1-9)"),
+ AP_INIT_TAKE1("CompressionLevel", deflate_set_compressionlevel, NULL, RSRC_CONF,
+ "Set the Deflate Compression Level (1-9)"),
{NULL}
};