# HG changeset patch # User Maxim Dounin # Date 1488421271 -10800 # Node ID 66c7dee0431cf22dc0cf7e29c0d0feca6b5124c8 # Parent b9d9c962255f7d70b42776949ed2250100a1bc20 Tests: some more large_client_header_buffers tests. diff --git a/http_header_buffers.t b/http_header_buffers.t --- a/http_header_buffers.t +++ b/http_header_buffers.t @@ -24,7 +24,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(8) +my $t = Test::Nginx->new()->has(qw/http rewrite/)->plan(10) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -149,6 +149,8 @@ like(http( "GET / HTTP/1.1" . CRLF . "Host: foo" . CRLF . "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . CRLF . "GET / HTTP/1.1" . CRLF . "Host: foo" . CRLF . @@ -161,6 +163,8 @@ like(http( "GET / HTTP/1.1" . CRLF . "Host: foo" . CRLF . "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . CRLF . "GET /foo" . ("1234567890" x 20) . "bar HTTP/1.1" . CRLF . "Host: foo" . CRLF . @@ -175,6 +179,8 @@ like(http( "GET / HTTP/1.1" . CRLF . "Host: foo" . CRLF . "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . CRLF, sleep => 0.1, body => "GET / HTTP/1.1" . CRLF . @@ -188,6 +194,8 @@ like(http( "GET / HTTP/1.1" . CRLF . "Host: foo" . CRLF . "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . CRLF, sleep => 0.1, body => "GET /foo" . ("1234567890" x 20) . "bar HTTP/1.1" . CRLF . @@ -196,4 +204,45 @@ sleep => 0.1, body => CRLF ), qr!X-URI: /foo(1234567890){20}bar!, 'long request line after keepalive'); +# the same as the above, but with pipelining and then keepalive; +# this ensures that previously allocated buffers are properly cleaned +# up when we set keepalive handler, including hc->free + +like(http( + "GET / HTTP/1.1" . CRLF . + "Host: foo" . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + CRLF . + "GET / HTTP/1.1" . CRLF . + "Host: foo" . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + CRLF, +sleep => 0.1, body => + "GET / HTTP/1.1" . CRLF . + "Host: foo" . CRLF . + "Connection: close" . CRLF . + "X-Foo: foo" . ("1234567890" x 20) . "bar" . CRLF . + CRLF +), qr/X-Foo: foo(1234567890){20}bar/, 'long header after both'); + +like(http( + "GET / HTTP/1.1" . CRLF . + "Host: foo" . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + CRLF . + "GET / HTTP/1.1" . CRLF . + "Host: foo" . CRLF . + "X-Foo: " . ("1234567890" x 20) . CRLF . + CRLF, +sleep => 0.1, body => + "GET /foo" . ("1234567890" x 20) . "bar HTTP/1.1" . CRLF . + "Host: foo" . CRLF . + "Connection: close" . CRLF . + CRLF +), qr!X-URI: /foo(1234567890){20}bar!, 'long request line after both'); + ###############################################################################