<div dir="ltr"><div style>Use this by adding "gunzip_always on;" to configuration.</div><div style>This was in the modules to-do list.</div><div style>Cheers.</div><div style><br></div><div style><div>@@ -16,6 +16,7 @@</div>
<div> typedef struct {</div><div> ngx_flag_t enable;</div><div> ngx_bufs_t bufs;</div><div>+ ngx_flag_t always;</div><div> } ngx_http_gunzip_conf_t;</div><div> </div><div> </div><div>
@@ -77,6 +78,13 @@</div><div> NGX_HTTP_LOC_CONF_OFFSET,</div><div> offsetof(ngx_http_gunzip_conf_t, bufs),</div><div> NULL },</div><div>+ </div><div>+ { ngx_string("gunzip_always"),</div>
<div>+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,</div><div>+ ngx_conf_set_flag_slot,</div><div>+ NGX_HTTP_LOC_CONF_OFFSET,</div><div>+ offsetof(ngx_http_gunzip_conf_t, always),</div>
<div>+ NULL },</div><div> </div><div> ngx_null_command</div><div> };</div><div>@@ -126,7 +134,7 @@</div><div> conf = ngx_http_get_module_loc_conf(r, ngx_http_gunzip_filter_module);</div><div> </div><div> /* TODO support multiple content-codings */</div>
<div>- /* TODO always gunzip - due to configuration or module request */</div><div>+ /* TODO always gunzip - due to module request */</div><div> /* TODO ignore content encoding? */</div><div> </div><div> if (!conf->enable</div>
<div>@@ -140,13 +148,16 @@</div><div> </div><div> r->gzip_vary = 1;</div><div> </div><div>- if (!r->gzip_tested) {</div><div>- if (ngx_http_gzip_ok(r) == NGX_OK) {</div><div>+ /* if configured to gunzip always, don't check request headers */</div>
<div>+ if (!conf->always) {</div><div>+ if (!r->gzip_tested) {</div><div>+ if (ngx_http_gzip_ok(r) == NGX_OK) {</div><div>+ return ngx_http_next_header_filter(r);</div><div>+ }</div>
<div>+</div><div>+ } else if (r->gzip_ok) {</div><div> return ngx_http_next_header_filter(r);</div><div> }</div><div>-</div><div>- } else if (r->gzip_ok) {</div><div>- return ngx_http_next_header_filter(r);</div>
<div> }</div><div> </div><div> ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_gunzip_ctx_t));</div><div>@@ -644,6 +655,7 @@</div><div> */</div><div> </div><div> conf->enable = NGX_CONF_UNSET;</div><div>
+ conf->always = NGX_CONF_UNSET;</div><div> </div><div> return conf;</div><div> }</div><div>@@ -656,6 +668,7 @@</div><div> ngx_http_gunzip_conf_t *conf = child;</div><div> </div><div> ngx_conf_merge_value(conf->enable, prev->enable, 0);</div>
<div>+ ngx_conf_merge_value(conf->always, prev->always, 0);</div><div> </div><div> ngx_conf_merge_bufs_value(conf->bufs, prev->bufs,</div><div> (128 * 1024) / ngx_pagesize, ngx_pagesize);</div>
</div><div><br></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><p style="color:rgb(136,136,136);margin:0px"><font face="Arial, sans-serif"><b>Roy Reznik, VP R&D</b></font></p><p style="color:rgb(136,136,136);margin:0px">
<span style="color:rgb(0,39,118);font-family:Arial,sans-serif;font-size:8pt">Adallom, 1 Ha'barzel st., Tel-Aviv, Israel</span></p><p style="color:rgb(136,136,136);margin:0px"><span style="color:rgb(0,39,118);font-family:Arial,sans-serif;font-size:8pt">Mobile: <a value="+972544980930" style="color:rgb(17,85,204)">+972 (54) 4524066</a></span></p>
<p style="color:rgb(136,136,136);margin:0px"><u style="font-size:11px;color:rgb(51,51,255);font-family:Arial,sans-serif"><span style="color:rgb(34,34,34);background-color:rgb(255,255,255)"><a href="mailto:roy@adallom.com" style="color:rgb(17,85,204)" target="_blank">roy@adallom.com</a></span>, <a href="http://www.adallom.com/" style="color:rgb(17,85,204)" target="_blank">www.adallom.com</a></u></p>
</div>
</div>