# HG changeset patch # User Sergey Kandaurov # Date 1410859472 -14400 # Node ID 67f41a61307c1aa6b449986edbdb4bbfbdcc3f49 # Parent 0342957cca372b1ef1660a3575a3ed50264db8aa Tests: added fastcgi test for request body in memory. diff --git a/fastcgi_body2.t b/fastcgi_body2.t --- a/fastcgi_body2.t +++ b/fastcgi_body2.t @@ -28,7 +28,7 @@ eval { require FCGI; }; plan(skip_all => 'FCGI not installed') if $@; plan(skip_all => 'win32') if $^O eq 'MSWin32'; -my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(1) +my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(2) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -42,7 +42,7 @@ http { %%TEST_GLOBALS_HTTP%% upstream u { - server 127.0.0.1:8081; + server 127.0.0.1:8081 max_fails=0; server 127.0.0.1:8082; } @@ -57,6 +57,15 @@ http { # fastcgi_next_upstream error timeout; fastcgi_read_timeout 1s; } + + location /in_memory { + fastcgi_pass u; + fastcgi_param REQUEST_URI $request_uri; + fastcgi_param CONTENT_LENGTH $content_length; + # fastcgi_next_upstream error timeout; + fastcgi_read_timeout 1s; + client_body_buffer_size 128k; + } } } @@ -74,7 +83,15 @@ EOF TODO: { local $TODO = 'not yet'; -like(http_get_length('/', 'x' x 102400), qr/X-Length: 102400/, 'body length'); +like(http_get_length('/', 'x' x 102400), qr/X-Length: 102400/, + 'body length - in file'); + +# force quick recovery, so that the next request wouldn't fail + +http_get('/'); + +like(http_get_length('/in_memory', 'x' x 102400), qr/X-Length: 102400/, + 'body length - in memory'); }