Mercurial > hg > nginx-tests
comparison proxy_redirect.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 | e9064d691790 |
children | 9d579fc770a6 |
comparison
equal
deleted
inserted
replaced
973:7d7aef8b9f3a | 974:882267679006 |
---|---|
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:%%PORT_0%%; | 40 listen 127.0.0.1:8080; |
41 server_name localhost; | 41 server_name localhost; |
42 | 42 |
43 location / { | 43 location / { |
44 set $some_var var_here; | 44 set $some_var var_here; |
45 | 45 |
46 proxy_pass http://127.0.0.1:%%PORT_1%%; | 46 proxy_pass http://127.0.0.1:8081; |
47 | 47 |
48 proxy_redirect http://127.0.0.1:%%PORT_1%%/var_in_second/ | 48 proxy_redirect http://127.0.0.1:8081/var_in_second/ |
49 /$some_var/; | 49 /$some_var/; |
50 proxy_redirect http://127.0.0.1:%%PORT_1%%/$some_var/ /replaced/; | 50 proxy_redirect http://127.0.0.1:8081/$some_var/ /replaced/; |
51 | 51 |
52 proxy_redirect ~^(.+)/regex_w_([^/]+) $1/$2/test.html; | 52 proxy_redirect ~^(.+)/regex_w_([^/]+) $1/$2/test.html; |
53 proxy_redirect ~*re+gexp? /replaced/test.html; | 53 proxy_redirect ~*re+gexp? /replaced/test.html; |
54 } | 54 } |
55 | 55 |
56 location /expl_default/ { | 56 location /expl_default/ { |
57 proxy_pass http://127.0.0.1:%%PORT_1%%/replace_this/; | 57 proxy_pass http://127.0.0.1:8081/replace_this/; |
58 proxy_redirect wrong wrong; | 58 proxy_redirect wrong wrong; |
59 proxy_redirect default; | 59 proxy_redirect default; |
60 } | 60 } |
61 | 61 |
62 location /impl_default/ { | 62 location /impl_default/ { |
63 proxy_pass http://127.0.0.1:%%PORT_1%%/replace_this/; | 63 proxy_pass http://127.0.0.1:8081/replace_this/; |
64 } | 64 } |
65 | 65 |
66 location /off/ { | 66 location /off/ { |
67 proxy_pass http://127.0.0.1:%%PORT_1%%/; | 67 proxy_pass http://127.0.0.1:8081/; |
68 proxy_redirect off; | 68 proxy_redirect off; |
69 | 69 |
70 location /off/on/ { | 70 location /off/on/ { |
71 proxy_pass http://127.0.0.1:%%PORT_1%%; | 71 proxy_pass http://127.0.0.1:8081; |
72 proxy_redirect http://127.0.0.1:%%PORT_1%%/off/ /; | 72 proxy_redirect http://127.0.0.1:8081/off/ /; |
73 | 73 |
74 location /off/on/on/ { | 74 location /off/on/on/ { |
75 proxy_pass http://127.0.0.1:%%PORT_1%%; | 75 proxy_pass http://127.0.0.1:8081; |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 server { | 81 server { |
82 listen 127.0.0.1:%%PORT_1%%; | 82 listen 127.0.0.1:8081; |
83 server_name localhost; | 83 server_name localhost; |
84 | 84 |
85 location / { | 85 location / { |
86 add_header Refresh "7; url=http://127.0.0.1:%%PORT_1%%$uri"; | 86 add_header Refresh "7; url=http://127.0.0.1:8081$uri"; |
87 return http://127.0.0.1:%%PORT_1%%$uri; | 87 return http://127.0.0.1:8081$uri; |
88 } | 88 } |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 EOF | 92 EOF |
93 | 93 |
94 $t->run(); | 94 $t->run(); |
95 | 95 |
96 ############################################################################### | 96 ############################################################################### |
97 | 97 |
98 my ($p0, $p1) = (port(0), port(1)); | 98 my ($p0, $p1) = (port(8080), port(8081)); |
99 | 99 |
100 is(http_get_location("http://127.0.0.1:$p0/impl_default/test.html"), | 100 is(http_get_location("http://127.0.0.1:$p0/impl_default/test.html"), |
101 "http://127.0.0.1:$p0/impl_default/test.html", 'implicit default'); | 101 "http://127.0.0.1:$p0/impl_default/test.html", 'implicit default'); |
102 is(http_get_location("http://127.0.0.1:$p0/expl_default/test.html"), | 102 is(http_get_location("http://127.0.0.1:$p0/expl_default/test.html"), |
103 "http://127.0.0.1:$p0/expl_default/test.html", 'explicit default'); | 103 "http://127.0.0.1:$p0/expl_default/test.html", 'explicit default'); |