agentzh/echo-nginx-module — Issue #6: nginx 1.0.9 echo.t test 21 proxy not okay
Author: maage
Created: 2011-11-02 17:42:15+00:00
State: open

I don't understand this test. I expect it to produce

Content-Type: text/plain
Content-Length: 12
Connection: close

hello
world

But it produces:

Content-Type: text/plain
Content-Length: 6
Connection: close

hello
world

Also test expects to get only hello

Result is:

PATH="$HOME"/nginx/sbin:"$PATH" prove -r t/echo.t
t/echo.t .. 1/43 WARNING: TEST 21: proxy - unexpected extra bytes after last chunk in response: "world\x{0a}"
t/echo.t .. ok
All tests successful.
Files=1, Tests=43, 4 wallclock secs ( 0.03 usr 0.01 sys + 0.50 cusr 1.01 csys = 1.55 CPU)
Result: PASS

I don't think test result should be ok as Content-Lenght is clearly wrong.

According to:
http://wiki.nginx.org/HttpEchoModule#echo

result from /echo should be

hello
world

I checked this test with 1.0.9 and

./configure \
--user=nginx \
--group=nginx \
--prefix="$HOME"/nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_geoip_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-ipv6 \
--with-file-aio \
--with-mail \
--with-mail_ssl_module \
--with-debug \
and extra modules ngx_devel_kit ngx_http_echo

System to tests is Fedora 15 x86_64

I don't know if it is okay with v1.0.8 or smaller.

=== TEST 21: proxy
--- config
location /main {
proxy_pass http://127.0.0.1:$server_port/echo;
}
location /echo {
echo hello;
echo world;
}
--- request
GET /main
--- response_headers
Content-Length: 6
--- response_body
hello