Mercurial > hg > nginx-tests
comparison proxy_pass_request.t @ 952:e9064d691790
Tests: converted tests to run in parallel.
author | Andrey Zelenkov <zelenkov@nginx.com> |
---|---|
date | Tue, 21 Jun 2016 16:39:13 +0300 |
parents | 4fad3232ad56 |
children | 882267679006 |
comparison
equal
deleted
inserted
replaced
951:9361c7eddfc1 | 952:e9064d691790 |
---|---|
35 | 35 |
36 http { | 36 http { |
37 %%TEST_GLOBALS_HTTP%% | 37 %%TEST_GLOBALS_HTTP%% |
38 | 38 |
39 server { | 39 server { |
40 listen 127.0.0.1:8080; | 40 listen 127.0.0.1:%%PORT_0%%; |
41 server_name localhost; | 41 server_name localhost; |
42 | 42 |
43 proxy_pass_request_headers off; | 43 proxy_pass_request_headers off; |
44 | 44 |
45 location / { | 45 location / { |
46 proxy_pass http://127.0.0.1:8081; | 46 proxy_pass http://127.0.0.1:%%PORT_1%%; |
47 } | 47 } |
48 | 48 |
49 location /body { | 49 location /body { |
50 proxy_pass http://127.0.0.1:8081; | 50 proxy_pass http://127.0.0.1:%%PORT_1%%; |
51 proxy_pass_request_headers on; | 51 proxy_pass_request_headers on; |
52 proxy_pass_request_body off; | 52 proxy_pass_request_body off; |
53 } | 53 } |
54 | 54 |
55 location /both { | 55 location /both { |
56 proxy_pass http://127.0.0.1:8081; | 56 proxy_pass http://127.0.0.1:%%PORT_1%%; |
57 proxy_pass_request_headers off; | 57 proxy_pass_request_headers off; |
58 proxy_pass_request_body off; | 58 proxy_pass_request_body off; |
59 } | 59 } |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 EOF | 63 EOF |
64 | 64 |
65 $t->run_daemon(\&http_daemon); | 65 $t->run_daemon(\&http_daemon); |
66 $t->run()->waitforsocket('127.0.0.1:8081'); | 66 $t->run()->waitforsocket('127.0.0.1:' . port(1)); |
67 | 67 |
68 ############################################################################### | 68 ############################################################################### |
69 | 69 |
70 like(get('/', 'foo', 'bar'), qr/Header: none.*Body: bar/s, 'no headers'); | 70 like(get('/', 'foo', 'bar'), qr/Header: none.*Body: bar/s, 'no headers'); |
71 like(get('/body', 'foo', 'bar'), qr/Header: foo.*Body: none/s, 'no body'); | 71 like(get('/body', 'foo', 'bar'), qr/Header: foo.*Body: none/s, 'no body'); |
88 } | 88 } |
89 | 89 |
90 sub http_daemon { | 90 sub http_daemon { |
91 my $server = IO::Socket::INET->new( | 91 my $server = IO::Socket::INET->new( |
92 Proto => 'tcp', | 92 Proto => 'tcp', |
93 LocalHost => '127.0.0.1:8081', | 93 LocalHost => '127.0.0.1:' . port(1), |
94 Listen => 5, | 94 Listen => 5, |
95 Reuse => 1 | 95 Reuse => 1 |
96 ) | 96 ) |
97 or die "Can't create listening socket: $!\n"; | 97 or die "Can't create listening socket: $!\n"; |
98 | 98 |