openresty / redis2-nginx-module

Nginx upstream module for the Redis 2.0 protocol
http://wiki.nginx.org/HttpRedis2Module
901 stars 142 forks source link

[WIP] Support chunked_transfer_encoding configuration #55

Closed matsumotory closed 1 year ago

matsumotory commented 6 years ago

Hi, @agentzh , thank you for your great redis module.

I support chunked_transfer_encoding off.

chunked_transfer_encoding off

        location /redis {
            chunked_transfer_encoding off;
            redis2_pass 127.0.0.1:6379;
            redis2_query get "nginx";
        }
$ curl http://127.0.0.1:58080/redis  -v
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 58080 (#0)
> GET /redis HTTP/1.1
> Host: 127.0.0.1:58080
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.15.0
< Date: Mon, 11 Jun 2018 09:50:59 GMT
< Content-Type: text/plain
< Content-Length: 11
< Connection: keep-alive
< 
$5
hello
* Connection #0 to host 127.0.0.1 left intact

chunked_transfer_encoding on by default

        location /redis {
            redis2_pass 127.0.0.1:6379;
            redis2_query get "nginx";
        }
$ curl http://127.0.0.1:58080/redis  -v
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 58080 (#0)
> GET /redis HTTP/1.1
> Host: 127.0.0.1:58080
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.15.0
< Date: Mon, 11 Jun 2018 09:52:05 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Connection: keep-alive
< 
$5
hello
* Connection #0 to host 127.0.0.1 left intact
matsumotory commented 6 years ago

Oh... I did not consider buffering. For now, change under [WIP].