]> git.pld-linux.org Git - packages/lighttpd.git/blob - lighttpd-mod_compress-disable-bzip2.patch
- change compress.bzip2 to compress.allowed_encodings instead (like mod_deflate in...
[packages/lighttpd.git] / lighttpd-mod_compress-disable-bzip2.patch
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
3 @@ -46,6 +46,7 @@
4  #endif
5  
6  typedef struct {
7 +       unsigned short  bzip2;
8         buffer *compress_cache_dir;
9         array  *compress;
10         off_t   compress_max_filesize; /** max filesize in kb */
11 @@ -154,6 +155,7 @@
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 }
17         };
18  
19 @@ -166,10 +168,12 @@
20                 s->compress_cache_dir = buffer_init();
21                 s->compress = array_init();
22                 s->compress_max_filesize = 0;
23 +               s->bzip2 = 1;
24  
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);
29  
30                 p->config_storage[i] = s;
31  
32 @@ -587,6 +591,7 @@
33         PATCH(compress_cache_dir);
34         PATCH(compress);
35         PATCH(compress_max_filesize);
36 +       PATCH(bzip2);
37  
38         /* skip the first, the global context */
39         for (i = 1; i < srv->config_context->used; i++) {
40 @@ -606,6 +611,8 @@
41                                 PATCH(compress);
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"))) {
45 +                               PATCH(bzip2);
46                         }
47                 }
48         }
49 @@ -675,12 +682,18 @@
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;
54 +#ifdef USE_BZ2LIB
55 +                               if (p->conf.bzip2) {
56 +                                       if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
57 +                               }
58 +#endif
59                                 if (NULL != strstr(value, "identity")) accept_encoding |= HTTP_ACCEPT_ENCODING_IDENTITY;
60  
61                                 /* get server side supported ones */
62  #ifdef USE_BZ2LIB
63 -                               srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
64 +                               if (p->conf.bzip2) {
65 +                                       srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
66 +                               }
67  #endif
68  #ifdef USE_ZLIB
69                                 srv_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
70 @@ -689,7 +702,6 @@
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;
76  
77                                 /* get client side support encodings */
78 @@ -697,25 +709,12 @@
79                                 if (NULL != strstr(value, "deflate")) accept_encoding |= HTTP_ACCEPT_ENCODING_DEFLATE;
80                                 if (NULL != strstr(value, "compress")) accept_encoding |= HTTP_ACCEPT_ENCODING_COMPRESS;
81  #ifdef USE_BZ2LIB
82 -                               if (p->conf.bzip2) {
83 -                                       if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
84 -                               }
85 +                               if (NULL != strstr(value, "bzip2")) accept_encoding |= HTTP_ACCEPT_ENCODING_BZIP2;
86  #endif
87                                 if (NULL != strstr(value, "identity")) accept_encoding |= HTTP_ACCEPT_ENCODING_IDENTITY;
88  
89 -                               /* get server side supported ones */
90 -#ifdef USE_BZ2LIB
91 -                               if (p->conf.bzip2) {
92 -                                       srv_encodings |= HTTP_ACCEPT_ENCODING_BZIP2;
93 -                               }
94 -#endif
95 -#ifdef USE_ZLIB
96 -                               srv_encodings |= HTTP_ACCEPT_ENCODING_GZIP;
97 -                               srv_encodings |= HTTP_ACCEPT_ENCODING_DEFLATE;
98 -#endif
99 -
100                                 /* find matching entries */
101 -                               matched_encodings = accept_encoding & srv_encodings;
102 +                               matched_encodings = accept_encoding & p->conf.allowed_encodings;
103  
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
108 @@ -32,6 +32,12 @@
109  Options
110  =======
111  
112 +compress.allowed_encodings
113 +  override default set of allowed encodings
114 +
115 +  e.g.: ::
116 +    compress.allowed_encodings = ("bzip2", "gzip", "deflate")
117 +
118  compress.cache-dir
119    name of the directory where compressed content will be cached
120  
This page took 0.033678 seconds and 3 git commands to generate.