Mercurial > hg > nginx-tests
annotate mail_auth_wait.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 913d96252b7a |
children |
rev | line source |
---|---|
1977
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
2 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
3 # (C) Maxim Dounin |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
4 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
5 # Tests for nginx mail module for WAIT auth response. |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
6 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
7 ############################################################################### |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
8 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
9 use warnings; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
10 use strict; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
11 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
12 use Test::More; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
13 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
14 BEGIN { use FindBin; chdir($FindBin::Bin); } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
15 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
16 use lib 'lib'; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
17 use Test::Nginx; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
18 use Test::Nginx::IMAP; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
19 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
20 ############################################################################### |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
21 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
24 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
25 local $SIG{PIPE} = 'IGNORE'; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
26 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
27 my $t = Test::Nginx->new()->has(qw/mail imap http map rewrite/) |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
28 ->write_file_expand('nginx.conf', <<'EOF'); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
29 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
31 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
32 daemon off; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
33 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
34 events { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
35 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
36 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
37 mail { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
38 proxy_pass_error_message on; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
39 proxy_timeout 15s; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
40 auth_http http://127.0.0.1:8080/mail/auth; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
41 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
42 server { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
43 listen 127.0.0.1:8143; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
44 protocol imap; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
45 imap_auth plain cram-md5 external; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
46 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
47 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
48 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
49 http { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
50 %%TEST_GLOBALS_HTTP%% |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
51 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
52 map $upstream_http_count $reply { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
53 # Each wait is 1 second, so wait 4 times, which should get us |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
54 # to after the sleep(3), but then after another sleep(2) we |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
55 # should have completed with a success |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
56 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
57 1 WAIT; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
58 2 WAIT; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
59 3 WAIT; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
60 4 WAIT; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
61 5 OK; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
62 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
63 default ERROR; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
64 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
65 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
66 log_format test "reply=$reply"; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
67 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
68 server { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
69 listen 127.0.0.1:8080; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
70 server_name localhost; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
71 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
72 access_log %%TESTDIR%%/auth.log test; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
73 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
74 location = /mail/auth { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
75 add_header Auth-Status $reply; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
76 add_header Auth-Server 127.0.0.1; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
77 add_header Auth-Port %%PORT_8144%%; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
78 add_header Auth-Pass ""; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
79 add_header Auth-Wait 1; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
80 proxy_pass http://127.0.0.1:8081; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
81 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
82 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
83 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
84 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
85 EOF |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
86 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
87 $t->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
88 $t->run_daemon(\&http_daemon); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
89 $t->run()->plan(4); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
90 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
91 $t->waitforsocket('127.0.0.1:' . port(8144)); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
92 $t->waitforsocket('127.0.0.1:' . port(8081)); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
93 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
94 ############################################################################### |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
95 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
96 # WAIT response |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
97 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
98 my $s = Test::Nginx::IMAP->new(); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
99 $s->read(); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
100 $s->send('a01 LOGIN test@example.com wait'); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
101 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
102 sleep(3); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
103 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
104 my $f = $t->read_file('auth.log'); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
105 my @waits = $f =~ /^reply=WAIT/mg; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
106 ok(@waits >= 2, "found multiple WAIT responses in log"); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
107 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
108 my @ready = $s->can_read(0.1); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
109 is(scalar @ready, 0, "nothing to read while waiting"); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
110 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
111 sleep(2); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
112 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
113 @ready = $s->can_read(0); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
114 is(scalar @ready, 1, "ready for reading"); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
115 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
116 $s->ok('login success after waiting'); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
117 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
118 ############################################################################### |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
119 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
120 sub http_daemon { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
121 my $server = IO::Socket::INET->new( |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
122 Proto => 'tcp', |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
123 LocalHost => '127.0.0.1', |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
124 LocalPort => port(8081), |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
125 Listen => 5, |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
126 Reuse => 1 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
127 ) |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
128 or die "Can't create listening socket: $!\n"; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
129 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
130 local $SIG{PIPE} = 'IGNORE'; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
131 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
132 my $count = 0; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
133 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
134 while (my $client = $server->accept()) { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
135 $client->autoflush(1); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
136 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
137 my $headers = ''; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
138 my $uri = ''; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
139 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
140 while (<$client>) { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
141 $headers .= $_; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
142 last if (/^\x0d?\x0a?$/); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
143 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
144 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
145 next if $headers eq ''; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
146 $count++; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
147 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
148 Test::Nginx::log_core('||', "response, $count"); |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
149 print $client <<EOF; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
150 HTTP/1.1 204 No content |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
151 Count: $count |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
152 Connection: close |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
153 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
154 EOF |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
155 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
156 } continue { |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
157 close $client; |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
158 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
159 } |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
160 |
913d96252b7a
Tests: added test for WAIT mail auth response.
Rob Mueller <robm@fastmailteam.com>
parents:
diff
changeset
|
161 ############################################################################### |