Mercurial > hg > nginx-tests
comparison fastcgi_body2.t @ 461:67f41a61307c
Tests: added fastcgi test for request body in memory.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 16 Sep 2014 13:24:32 +0400 |
parents | 4a045c74a77c |
children | 5a1f2e1ea6cd |
comparison
equal
deleted
inserted
replaced
460:0342957cca37 | 461:67f41a61307c |
---|---|
26 | 26 |
27 eval { require FCGI; }; | 27 eval { require FCGI; }; |
28 plan(skip_all => 'FCGI not installed') if $@; | 28 plan(skip_all => 'FCGI not installed') if $@; |
29 plan(skip_all => 'win32') if $^O eq 'MSWin32'; | 29 plan(skip_all => 'win32') if $^O eq 'MSWin32'; |
30 | 30 |
31 my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(1) | 31 my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(2) |
32 ->write_file_expand('nginx.conf', <<'EOF'); | 32 ->write_file_expand('nginx.conf', <<'EOF'); |
33 | 33 |
34 %%TEST_GLOBALS%% | 34 %%TEST_GLOBALS%% |
35 | 35 |
36 daemon off; | 36 daemon off; |
40 | 40 |
41 http { | 41 http { |
42 %%TEST_GLOBALS_HTTP%% | 42 %%TEST_GLOBALS_HTTP%% |
43 | 43 |
44 upstream u { | 44 upstream u { |
45 server 127.0.0.1:8081; | 45 server 127.0.0.1:8081 max_fails=0; |
46 server 127.0.0.1:8082; | 46 server 127.0.0.1:8082; |
47 } | 47 } |
48 | 48 |
49 server { | 49 server { |
50 listen 127.0.0.1:8080; | 50 listen 127.0.0.1:8080; |
54 fastcgi_pass u; | 54 fastcgi_pass u; |
55 fastcgi_param REQUEST_URI $request_uri; | 55 fastcgi_param REQUEST_URI $request_uri; |
56 fastcgi_param CONTENT_LENGTH $content_length; | 56 fastcgi_param CONTENT_LENGTH $content_length; |
57 # fastcgi_next_upstream error timeout; | 57 # fastcgi_next_upstream error timeout; |
58 fastcgi_read_timeout 1s; | 58 fastcgi_read_timeout 1s; |
59 } | |
60 | |
61 location /in_memory { | |
62 fastcgi_pass u; | |
63 fastcgi_param REQUEST_URI $request_uri; | |
64 fastcgi_param CONTENT_LENGTH $content_length; | |
65 # fastcgi_next_upstream error timeout; | |
66 fastcgi_read_timeout 1s; | |
67 client_body_buffer_size 128k; | |
59 } | 68 } |
60 } | 69 } |
61 } | 70 } |
62 | 71 |
63 EOF | 72 EOF |
72 ############################################################################### | 81 ############################################################################### |
73 | 82 |
74 TODO: { | 83 TODO: { |
75 local $TODO = 'not yet'; | 84 local $TODO = 'not yet'; |
76 | 85 |
77 like(http_get_length('/', 'x' x 102400), qr/X-Length: 102400/, 'body length'); | 86 like(http_get_length('/', 'x' x 102400), qr/X-Length: 102400/, |
87 'body length - in file'); | |
88 | |
89 # force quick recovery, so that the next request wouldn't fail | |
90 | |
91 http_get('/'); | |
92 | |
93 like(http_get_length('/in_memory', 'x' x 102400), qr/X-Length: 102400/, | |
94 'body length - in memory'); | |
78 | 95 |
79 } | 96 } |
80 | 97 |
81 ############################################################################### | 98 ############################################################################### |
82 | 99 |