---- lighttpd-1.4.19/src/mod_compress.c 2008-09-19 17:24:45.542342957 +0300
-+++ lighttpd-1.4.19/src/mod_compress.c 2008-09-22 14:24:00.738911820 +0300
+--- lighttpd-1.4.19/src/mod_compress.c 2008-09-22 16:24:49.930179728 +0300
++++ lighttpd-1.4.19/src/mod_compress.c 2008-09-22 17:02:36.097001825 +0300
@@ -49,6 +49,7 @@
buffer *compress_cache_dir;
array *compress;
off_t compress_max_filesize; /** max filesize in kb */
-+ int allowed_encodings;
++ int allowed_encodings;
} plugin_config;
typedef struct {
{ "compress.cache-dir", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
{ "compress.filetype", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
{ "compress.max-filesize", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },
-+ { "compress.allowed_encodings", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
++ { "compress.allowed-encodings", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
PATCH(compress);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.max-filesize"))) {
PATCH(compress_max_filesize);
-+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.allowed_encodings"))) {
++ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.allowed-encodings"))) {
+ PATCH(allowed_encodings);
}
}
Options
=======
-+compress.allowed_encodings
++compress.allowed-encodings
+ override default set of allowed encodings
+
+ e.g.: ::
-+ compress.allowed_encodings = ("bzip2", "gzip", "deflate")
++ compress.allowed-encodings = ("bzip2", "gzip", "deflate")
+
compress.cache-dir
name of the directory where compressed content will be cached
+Index: mod-compress.conf
+--- ./tests/mod-compress.conf (revision 0)
++++ ./tests/mod-compress.conf (revision 0)
+@@ -0,0 +1,32 @@
++debug.log-request-handling = "enable"
++debug.log-response-header = "disable"
++debug.log-request-header = "disable"
++
++server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/"
++server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid"
++
++## bind to port (default: 80)
++server.port = 2048
++
++## bind to localhost (default: all interfaces)
++server.bind = "localhost"
++server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log"
++server.name = "www.example.org"
++
++server.modules = (
++ "mod_compress"
++)
++
++######################## MODULE CONFIG ############################
++
++mimetype.assign = (
++ ".html" => "text/html",
++ ".txt" => "text/plain",
++)
++
++$HTTP["host"] == "cache.example.org" {
++ compress.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/"
++}
++compress.filetype = ("text/plain", "text/html")
++
++compress.allowed-encodings = ( "gzip", "deflate" )
+Index: mod-compress.t
+===================================================================
+--- ./tests/mod-compress.t (revision 2191)
++++ ./tests/mod-compress.t (working copy)
+@@ -8,12 +8,14 @@
+
+ use strict;
+ use IO::Socket;
+-use Test::More tests => 10;
++use Test::More tests => 11;
+ use LightyTest;
+
+ my $tf = LightyTest->new();
+ my $t;
+
++$tf->{CONFIGFILE} = 'mod-compress.conf';
++
+ ok($tf->start_proc == 0, "Starting lighttpd") or die();
+
+ $t->{REQUEST} = ( <<EOF
+@@ -88,5 +90,14 @@
+ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Type' => "text/plain" } ];
+ ok($tf->handle_http($t) == 0, 'Empty Accept-Encoding');
+
++$t->{REQUEST} = ( <<EOF
++GET /index.txt HTTP/1.0
++Accept-Encoding: bzip2, gzip, deflate
++Host: cache.example.org
++EOF
++ );
++$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Encoding' => 'gzip', 'Content-Type' => "text/plain" } ];
++ok($tf->handle_http($t) == 0, 'bzip2 requested but disabled');
+
++
+ ok($tf->stop_proc == 0, "Stopping lighttpd");