Welcome! Log In Create A New Profile

Advanced

Re: help with gunzip filter

Maxim Dounin
October 18, 2012 05:12AM
Hello!

On Thu, Oct 18, 2012 at 01:08:26PM +0800, honwel wrote:

> hi,all
> i recently download the nginx-1.3.7 source from www.nginx.org, and i debug the gunzip module because i want unzip content from server and filter the content(use subs filter module-weibin yao), but gunzip nerver work , so i tracking the code, and see this line from function ngx_http_gunzip_header_filter(ngx_http_request_t *r)
> static ngx_int_t
> 1 ngx_http_gunzip_header_filter(ngx_http_request_t *r)
> 2 {
> ......
> ......
> 3 if (!r->gzip_tested) {
> 4 if (ngx_http_gzip_ok(r) == NGX_OK) {
> 5 return ngx_http_next_header_filter(r);
> 6 }
> 7 } else if (!r->gzip_ok) {
> 8 return ngx_http_next_header_filter(r);
> }
> ......
> ......
> }
>
> l think line 4 should be "if (ngx_http_gzip_ok(r) != NGX_OK)
> { ... }" and change it , then i recomplie source code, make and
> debug use gdb tool, so function is run ok, is there a bug?

If you want to gunzip content always you have to omit this block
entirely. As of now gunzip only gunzips responses if client does
not support gzipped responses, hence the check.

The bug seems to be present in line 7 though, it should be

--- a/src/http/modules/ngx_http_gunzip_filter_module.c
+++ b/src/http/modules/ngx_http_gunzip_filter_module.c
@@ -145,7 +145,7 @@ ngx_http_gunzip_header_filter(ngx_http_r
return ngx_http_next_header_filter(r);
}

- } else if (!r->gzip_ok) {
+ } else if (r->gzip_ok) {
return ngx_http_next_header_filter(r);
}


I don't think this code path can be triggered by using stock nginx
modules, but fixing this won't hurt anyway. Thanks for pointing
this.


--
Maxim Dounin
http://nginx.com/support.html

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

help with gunzip filter

honwel 1076 October 18, 2012 01:10AM

Re: help with gunzip filter

Maxim Dounin 646 October 18, 2012 05:12AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 130
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready