﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1332	gunzip module works inappropriately	Alex Zhang		"Hi, everyone!

So i have a backend server, which proxied by nginx.

I found the gunzip module works inappropriately when the request method is `HEAD` and the backend server returns the gzipped data but with the `Content-Length` header instead of `Tranfer-Encoding`. 

The backend server's output is followed(some irrelevant headers removed by myself).
{{{
HTTP/1.1 200 OK
Date: Wed, 26 Jul 2017 04:42:59 GMT
Content-Type: text/plain
Content-Length: 83
Connection: keep-alive
Accept-Ranges: bytes
Content-Encoding: gzip
Content-Transfer-Encoding: binary
Last-Modified: Tue, 25 Jul 2017 08:32:49 GMT
Vary: Accept-Encoding
}}}

When i enable the gunzip, nginx gunzip module will remove the `Content-Length` header, and the chunked filter module also will be bypassed in this scene. Ultimately, we will see a HTTP response without` Conent-Length` and `Tranfer-Encoding`:

{{{
curl -I http://127.0.0.1:9091/ios/1500971336_524/build_info.txt\?v\=7623874234
HTTP/1.1 200 OK
Server: nginx/1.13.4
Date: Tue, 25 Jul 2017 05:34:38 GMT
Content-Type: text/plain
Connection: keep-alive
Cache-Control: public, max-age=31536000
Content-Transfer-Encoding: binary
Last-Modified: Tue, 25 Jul 2017 08:32:49 GMT
Vary: Accept-Encoding
}}}

And my nginx proxy config is followed:

{{{
server {
    listen 9091;
    location / {
        gunzip on;

        proxy_set_header Accept-Encoding gzip;
        proxy_set_header Host hotupdatehlfmj.tfhygame.com;
        proxy_pass http://backend;
    }
}

upstream backend {
    server 1.1.1.1:80 max_fails=3 fail_timeout=30;
}
}}}

I think the gunzip module should ignore this scene(e.g. bypass the gunzip when r->request_method is `HEAD`) to ensure the client can get  `Content-Length`  header.

I am sorry if there is any place that does not conform to the ticket rules.
"	defect	closed	minor		nginx-module	1.13.x	invalid	gunzip		Linux Fedora26-64 4.11.11-300.fc26.x86_64 #1 SMP Mon Jul 17 16:32:11 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux	"nginx version: nginx/1.13.4
built by gcc 7.1.1 20170622 (Red Hat 7.1.1-3) (GCC)
configure arguments: --with-http_gunzip_module --prefix=/home/alex/bin_install/nginx"
