comparison scgi.t @ 974:882267679006

Tests: simplified parallel modifications in tests. Mail tests were simplified in c227348453db.
author Andrey Zelenkov <zelenkov@nginx.com>
date Tue, 12 Jul 2016 17:39:03 +0300
parents d4a0232425ee
children be3ada2e9d24
comparison
equal deleted inserted replaced
973:7d7aef8b9f3a 974:882267679006
36 36
37 http { 37 http {
38 %%TEST_GLOBALS_HTTP%% 38 %%TEST_GLOBALS_HTTP%%
39 39
40 upstream u { 40 upstream u {
41 server 127.0.0.1:%%PORT_1%%; 41 server 127.0.0.1:8081;
42 } 42 }
43 43
44 server { 44 server {
45 listen 127.0.0.1:%%PORT_0%%; 45 listen 127.0.0.1:8080;
46 server_name localhost; 46 server_name localhost;
47 47
48 location / { 48 location / {
49 scgi_pass 127.0.0.1:%%PORT_1%%; 49 scgi_pass 127.0.0.1:8081;
50 scgi_param SCGI 1; 50 scgi_param SCGI 1;
51 scgi_param REQUEST_URI $request_uri; 51 scgi_param REQUEST_URI $request_uri;
52 scgi_param HTTP_X_BLAH "blah"; 52 scgi_param HTTP_X_BLAH "blah";
53 } 53 }
54 54
62 } 62 }
63 63
64 EOF 64 EOF
65 65
66 $t->run_daemon(\&scgi_daemon); 66 $t->run_daemon(\&scgi_daemon);
67 $t->run()->waitforsocket('127.0.0.1:' . port(1)); 67 $t->run()->waitforsocket('127.0.0.1:' . port(8081));
68 68
69 ############################################################################### 69 ###############################################################################
70 70
71 like(http_get('/'), qr/SEE-THIS/, 'scgi request'); 71 like(http_get('/'), qr/SEE-THIS/, 'scgi request');
72 like(http_get('/redir'), qr/ 302 /, 'scgi redirect'); 72 like(http_get('/redir'), qr/ 302 /, 'scgi redirect');
75 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD'); 75 unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD');
76 76
77 like(http_get_headers('/headers'), qr/SEE-THIS/, 77 like(http_get_headers('/headers'), qr/SEE-THIS/,
78 'scgi request with many ignored headers'); 78 'scgi request with many ignored headers');
79 79
80 like(http_get('/var?b=127.0.0.1:' . port(1)), qr/SEE-THIS/, 80 like(http_get('/var?b=127.0.0.1:' . port(8081)), qr/SEE-THIS/,
81 'scgi with variables'); 81 'scgi with variables');
82 like(http_get('/var?b=u'), qr/SEE-THIS/, 'scgi with variables to upstream'); 82 like(http_get('/var?b=u'), qr/SEE-THIS/, 'scgi with variables to upstream');
83 83
84 ############################################################################### 84 ###############################################################################
85 85
114 ############################################################################### 114 ###############################################################################
115 115
116 sub scgi_daemon { 116 sub scgi_daemon {
117 my $server = IO::Socket::INET->new( 117 my $server = IO::Socket::INET->new(
118 Proto => 'tcp', 118 Proto => 'tcp',
119 LocalHost => '127.0.0.1:' . port(1), 119 LocalHost => '127.0.0.1:' . port(8081),
120 Listen => 5, 120 Listen => 5,
121 Reuse => 1 121 Reuse => 1
122 ) 122 )
123 or die "Can't create listening socket: $!\n"; 123 or die "Can't create listening socket: $!\n";
124 124