1 --- lighttpd-1.4.19/src/mod_compress.c 2008-09-19 13:24:30.921429633 +0300
2 +++ lighttpd-1.4.19/src/mod_compress.c 2008-09-19 14:16:06.292324544 +0300
7 + unsigned short bzip2;
8 buffer *compress_cache_dir;
10 off_t compress_max_filesize; /** max filesize in kb */
12 { "compress.cache-dir", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },
13 { "compress.filetype", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION },
14 { "compress.max-filesize", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },
15 + { "compress.bzip2", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION },
16 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
20 s->compress_cache_dir = buffer_init();
21 s->compress = array_init();
22 s->compress_max_filesize = 0;
25 cv[0].destination = s->compress_cache_dir;
26 cv[1].destination = s->compress;
27 cv[2].destination = &(s->compress_max_filesize);
28 + cv[3].destination = &(s->bzip2);
30 p->config_storage[i] = s;
33 PATCH(compress_cache_dir);
35 PATCH(compress_max_filesize);
38 /* skip the first, the global context */
39 for (i = 1; i < srv->config_context->used; i++) {
42 } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.max-filesize"))) {
43 PATCH(compress_max_filesize);
44 + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("compress.bzip2"))) {
50 if (NULL != strstr(value, "gzip")) accept_encoding |= HTTP_ACCEPT_ENCODING_GZIP;
51 if (NULL != strstr(value, "deflate")) accept_encoding |= HTTP_ACCEPT_ENCODING_DEFLATE;
52 if (NULL != strstr(value, "compress")) accept_encoding |= HTTP_ACCEPT_ENCODING_COMPRESS;
53 - if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
55 + if (p->conf.bzip2) {
56 + if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
59 if (NULL != strstr(value, "identity")) accept_encoding |= HTTP_ACCEPT_ENCODING_IDENTITY;
61 /* get server side supported ones */
63 - srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
64 + if (p->conf.bzip2) {
65 + srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
69 srv_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
71 if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "Accept-Encoding"))) {
72 int accept_encoding = 0;
73 char *value = ds->value->ptr;
74 - int srv_encodings = 0;
75 int matched_encodings = 0;
77 /* get client side support encodings */
79 if (NULL != strstr(value, "deflate")) accept_encoding |= HTTP_ACCEPT_ENCODING_DEFLATE;
80 if (NULL != strstr(value, "compress")) accept_encoding |= HTTP_ACCEPT_ENCODING_COMPRESS;
82 - if (p->conf.bzip2) {
83 - if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
85 + if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
87 if (NULL != strstr(value, "identity")) accept_encoding |= HTTP_ACCEPT_ENCODING_IDENTITY;
89 - /* get server side supported ones */
91 - if (p->conf.bzip2) {
92 - srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
96 - srv_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
97 - srv_encodings |= HTTP_ACCEPT_ENCODING_DEFLATE;
100 /* find matching entries */
101 - matched_encodings = accept_encoding & srv_encodings;
102 + matched_encodings = accept_encoding & p->conf.allowed_encodings;
104 if (matched_encodings) {
105 const char *dflt_gzip = "gzip";
106 --- lighttpd-1.4.19/doc/compress.txt 2008-09-19 13:27:27.571638906 +0300
107 +++ lighttpd-1.4.19/doc/compress.txt 2008-09-19 14:24:12.308407368 +0300
112 +compress.allowed_encodings
113 + override default set of allowed encodings
116 + compress.allowed_encodings = ("bzip2", "gzip", "deflate")
119 name of the directory where compressed content will be cached