comparison proxy_cookie.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 847ea345becb
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 location / { 43 location / {
44 proxy_pass http://127.0.0.1:8081; 44 proxy_pass http://127.0.0.1:%%PORT_1%%;
45 45
46 proxy_cookie_domain www.example.org .example.com; 46 proxy_cookie_domain www.example.org .example.com;
47 proxy_cookie_domain .$server_name.com en.$server_name.org; 47 proxy_cookie_domain .$server_name.com en.$server_name.org;
48 proxy_cookie_domain ~^(.+)\.com$ $1.org; 48 proxy_cookie_domain ~^(.+)\.com$ $1.org;
49 49
53 proxy_cookie_path ~*^/caseless/(.+)$ /$1; 53 proxy_cookie_path ~*^/caseless/(.+)$ /$1;
54 } 54 }
55 } 55 }
56 56
57 server { 57 server {
58 listen 127.0.0.1:8081; 58 listen 127.0.0.1:%%PORT_1%%;
59 server_name localhost; 59 server_name localhost;
60 60
61 location / { 61 location / {
62 if ($arg_domain) { 62 if ($arg_domain) {
63 set $sc_domain "; Domain=$arg_domain"; 63 set $sc_domain "; Domain=$arg_domain";
74 EOF 74 EOF
75 75
76 $t->run()->plan(8); 76 $t->run()->plan(8);
77 77
78 ############################################################################### 78 ###############################################################################
79
80 my $port = port(0);
79 81
80 is(http_get_set_cookie('/?domain=www.Example.org'), 82 is(http_get_set_cookie('/?domain=www.Example.org'),
81 'v=path=domain=; Domain=example.com', 'domain rewrite'); 83 'v=path=domain=; Domain=example.com', 'domain rewrite');
82 is(http_get_set_cookie('/?domain=.LocalHost.com'), 84 is(http_get_set_cookie('/?domain=.LocalHost.com'),
83 'v=path=domain=; Domain=.en.localhost.org', 85 'v=path=domain=; Domain=.en.localhost.org',
101 103
102 ############################################################################### 104 ###############################################################################
103 105
104 sub http_get_set_cookie { 106 sub http_get_set_cookie {
105 my ($uri) = @_; 107 my ($uri) = @_;
106 http_get("http://127.0.0.1:8080$uri") =~ /^Set-Cookie:\s(.+?)\x0d?$/mi; 108 http_get("http://127.0.0.1:$port$uri") =~ /^Set-Cookie:\s(.+?)\x0d?$/mi;
107 return $1; 109 return $1;
108 } 110 }
109 111
110 ############################################################################### 112 ###############################################################################