Mercurial > hg > nginx-tests
annotate mail_smtp.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | a095b971fbcc |
children |
rev | line source |
---|---|
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 # (C) Maxim Dounin |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 # Tests for nginx mail smtp module. |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 ############################################################################### |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 use warnings; |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 use strict; |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 |
27
fb94a224fef2
Tests: add has() functions for feature testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
26
diff
changeset
|
12 use Test::More; |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 use MIME::Base64; |
7
9eb509695651
Tests: drop our own CRLF constant, use Socket's one instead.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5
diff
changeset
|
15 use Socket qw/ CRLF /; |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 |
9
f772e2a1a13f
Tests: change directory to allow runing from outside.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
f772e2a1a13f
Tests: change directory to allow runing from outside.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7
diff
changeset
|
18 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
19 use lib 'lib'; |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
20 use Test::Nginx; |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
21 use Test::Nginx::SMTP; |
5
4d75bdb05ecf
Tests: some generic code and ssi tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4
diff
changeset
|
22 |
4d75bdb05ecf
Tests: some generic code and ssi tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4
diff
changeset
|
23 ############################################################################### |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
25 select STDERR; $| = 1; |
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
26 select STDOUT; $| = 1; |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 |
96
ecff5407867c
Tests: better handle unexpected connection close from nginx.
Maxim Dounin <mdounin@mdounin.ru>
parents:
72
diff
changeset
|
28 local $SIG{PIPE} = 'IGNORE'; |
ecff5407867c
Tests: better handle unexpected connection close from nginx.
Maxim Dounin <mdounin@mdounin.ru>
parents:
72
diff
changeset
|
29 |
1111
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/) |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
31 ->write_file_expand('nginx.conf', <<'EOF'); |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
32 |
107
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
96
diff
changeset
|
33 %%TEST_GLOBALS%% |
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
96
diff
changeset
|
34 |
249
6a0d934950bc
Tests: remove extra spaces in "daemon off".
Maxim Dounin <mdounin@mdounin.ru>
parents:
166
diff
changeset
|
35 daemon off; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
36 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
37 events { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
38 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
39 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
40 mail { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
41 proxy_pass_error_message on; |
1679
74986ebee2fd
Tests: added proxy_timeout in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1673
diff
changeset
|
42 proxy_timeout 15s; |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
43 auth_http http://127.0.0.1:8080/mail/auth; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
44 xclient off; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
45 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
46 server { |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
47 listen 127.0.0.1:8025; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
48 protocol smtp; |
1111
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
49 smtp_auth login plain none cram-md5 external; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
50 } |
1673
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
51 |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
52 server { |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
53 listen 127.0.0.1:8027; |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
54 protocol smtp; |
1689
dbd19195df8a
Tests: adjusted mail_smtp.t "long pipelined" TODO.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1682
diff
changeset
|
55 smtp_auth none; |
1673
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
56 smtp_client_buffer 128; |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
57 } |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
58 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
59 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
60 http { |
107
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
96
diff
changeset
|
61 %%TEST_GLOBALS_HTTP%% |
35
7bf0e8a1d66c
Tests: always define temp paths.
Maxim Dounin <mdounin@mdounin.ru>
parents:
28
diff
changeset
|
62 |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
63 server { |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
64 listen 127.0.0.1:8080; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
65 server_name localhost; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
66 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
67 location = /mail/auth { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
68 set $reply ERROR; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
69 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
70 if ($http_auth_smtp_to ~ example.com) { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
71 set $reply OK; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
72 } |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
73 |
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
74 set $userpass "$http_auth_user:$http_auth_pass"; |
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
75 if ($userpass ~ '^test@example.com:secret$') { |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
76 set $reply OK; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
77 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
78 |
1109
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
79 set $userpass "$http_auth_user:$http_auth_salt:$http_auth_pass"; |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
80 if ($userpass ~ '^test@example.com:<.*@.*>:0{32}$') { |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
81 set $reply OK; |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
82 } |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
83 |
1110
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
84 set $userpass "$http_auth_method:$http_auth_user:$http_auth_pass"; |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
85 if ($userpass ~ '^external:test@example.com:$') { |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
86 set $reply OK; |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
87 } |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
88 |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
89 add_header Auth-Status $reply; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
90 add_header Auth-Server 127.0.0.1; |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
91 add_header Auth-Port %%PORT_8026%%; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
92 add_header Auth-Wait 1; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
93 return 204; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
94 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
95 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
96 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
97 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
98 EOF |
4
6c41dbb2954f
Tests: run nginx with appropriate config from test itself.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3
diff
changeset
|
99 |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
100 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); |
1952
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
101 $t->run()->plan(43); |
1111
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
102 |
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
103 $t->waitforsocket('127.0.0.1:' . port(8026)); |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
104 |
4
6c41dbb2954f
Tests: run nginx with appropriate config from test itself.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3
diff
changeset
|
105 ############################################################################### |
6c41dbb2954f
Tests: run nginx with appropriate config from test itself.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3
diff
changeset
|
106 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
107 my $s = Test::Nginx::SMTP->new(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
108 $s->check(qr/^220 /, "greeting"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
110 $s->send('EHLO example.com'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
111 $s->check(qr/^250 /, "ehlo"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
113 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0bad", '')); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
114 $s->check(qr/^5.. /, 'auth plain with bad password'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
116 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
69
30d6cce3f0bd
Tests: more checks for 235 code on successful smtp auth.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
117 $s->authok('auth plain'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 # We are talking to backend from this point |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
121 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
122 $s->ok('mail from after auth'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
124 $s->send('RSET'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
125 $s->ok('rset'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
127 $s->send('MAIL FROM:<test@xn--e1afmkfd.xn--80akhbyknj4f> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
128 $s->ok("idn mail from (example.test in russian)"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
130 $s->send('QUIT'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
131 $s->ok("quit"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
133 # Try auth login in simple form |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
134 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
135 $s = Test::Nginx::SMTP->new(); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
136 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
137 $s->send('EHLO example.com'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
138 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
139 |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
140 $s->send('AUTH LOGIN'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
141 $s->check(qr/^334 VXNlcm5hbWU6/, 'auth login simple username challenge'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
142 $s->send(encode_base64('test@example.com', '')); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
143 $s->check(qr/^334 UGFzc3dvcmQ6/, 'auth login simple password challenge'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
144 $s->send(encode_base64('secret', '')); |
69
30d6cce3f0bd
Tests: more checks for 235 code on successful smtp auth.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
145 $s->authok('auth login simple'); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
146 |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
147 # Try auth plain with username. Details: |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
148 # |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
149 # [MS-XLOGIN]: SMTP Protocol AUTH LOGIN Extension Specification |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
150 # http://download.microsoft.com/download/5/D/D/5DD33FDF-91F5-496D-9884-0A0B0EE698BB/%5BMS-XLOGIN%5D.pdf |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
151 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
152 $s = Test::Nginx::SMTP->new(); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
153 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
154 $s->send('EHLO example.com'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
155 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
156 |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
157 $s->send('AUTH LOGIN ' . encode_base64('test@example.com', '')); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
158 $s->check(qr/^334 UGFzc3dvcmQ6/, 'auth login with username password challenge'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
159 $s->send(encode_base64('secret', '')); |
60
11e33ba0656a
Tests: check for 235 code on successful smtp auth.
Maxim Dounin <mdounin@mdounin.ru>
parents:
58
diff
changeset
|
160 $s->authok('auth login with username'); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
161 |
1109
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
162 # Try auth cram-md5 |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
163 |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
164 $s = Test::Nginx::SMTP->new(); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
165 $s->read(); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
166 $s->send('EHLO example.com'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
167 $s->read(); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
168 |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
169 $s->send('AUTH CRAM-MD5'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
170 $s->check(qr/^334 /, 'auth cram-md5 challenge'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
171 $s->send(encode_base64('test@example.com ' . ('0' x 32), '')); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
172 $s->authok('auth cram-md5'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
173 |
1110
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
174 # Try auth external |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
175 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
176 $s = Test::Nginx::SMTP->new(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
177 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
178 $s->send('EHLO example.com'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
179 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
180 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
181 $s->send('AUTH EXTERNAL'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
182 $s->check(qr/^334 VXNlcm5hbWU6/, 'auth external challenge'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
183 $s->send(encode_base64('test@example.com', '')); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
184 $s->ok('auth external'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
185 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
186 # Try auth external with username |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
187 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
188 $s = Test::Nginx::SMTP->new(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
189 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
190 $s->send('EHLO example.com'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
191 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
192 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
193 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
194 $s->ok('auth external with username'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
195 |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
196 # Try auth plain with pipelining |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
197 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
198 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
199 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
200 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
201 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
202 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
203 $s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
204 . 'RSET'); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
205 $s->read(); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
206 $s->ok('pipelined rset after invalid command'); |
1
c731d50dd6b1
Tests: check pipelining after invalid command.
Maxim Dounin <mdounin@mdounin.ru>
parents:
0
diff
changeset
|
207 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
208 $s->send('AUTH PLAIN ' |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
209 . encode_base64("\0test\@example.com\0bad", '') . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
210 . 'MAIL FROM:<test@example.com> SIZE=100'); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
211 $s->read(); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
212 $s->ok('mail from after failed pipelined auth'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
213 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
214 $s->send('AUTH PLAIN ' |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
215 . encode_base64("\0test\@example.com\0secret", '') . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
216 . 'MAIL FROM:<test@example.com> SIZE=100'); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
217 $s->read(); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
218 $s->ok('mail from after pipelined auth'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
219 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
220 # Try auth none |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
221 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
222 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
223 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
224 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
225 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
226 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
227 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
228 $s->ok('auth none - mail from'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
229 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
230 $s->send('RCPT TO:<test@example.com>'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
231 $s->ok('auth none - rcpt to'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
232 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
233 $s->send('RSET'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
234 $s->ok('auth none - rset, should go to backend'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
235 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
236 # Auth none with pipelining |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
237 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
238 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
239 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
240 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
241 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
242 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
243 $s->send('MAIL FROM:<test@example.com> SIZE=100' . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
244 . 'RCPT TO:<test@example.com>' . CRLF |
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
245 . 'RSET'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
246 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
247 $s->ok('pipelined mail from'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
248 $s->ok('pipelined rcpt to'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
249 $s->ok('pipelined rset'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
250 |
1681
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
251 # Pipelining with split command |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
252 |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
253 $s = Test::Nginx::SMTP->new(); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
254 $s->read(); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
255 $s->send('EHLO example.com'); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
256 $s->read(); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
257 |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
258 $s->print('MAIL FROM:<test@example.com> SIZE=100' . CRLF |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
259 . 'RCPT TO:<test@example.com>' . CRLF |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
260 . 'RS'); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
261 $s->ok('split pipelined mail from'); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
262 $s->ok('split pipelined rcpt to'); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
263 |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
264 $s->send('ET'); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
265 $s->ok('split pipelined rset'); |
ac26f7f2b187
Tests: test for split commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
266 |
1673
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
267 # Pipelining longer than smtp_client_buffer |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
268 |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
269 $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(8027)); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
270 $s->read(); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
271 $s->send('EHLO example.com'); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
272 $s->read(); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
273 |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
274 $s->send('MAIL FROM:<test@example.com> SIZE=100' . CRLF |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
275 . 'RCPT TO:<foo@example.com>' . CRLF |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
276 . 'RCPT TO:<bar@example.com>' . CRLF |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
277 . 'RCPT TO:<baz@example.com>' . CRLF |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
278 . 'RCPT TO:<foobar@example.com>' . CRLF |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
279 . 'RSET'); |
1689
dbd19195df8a
Tests: adjusted mail_smtp.t "long pipelined" TODO.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1682
diff
changeset
|
280 $s->ok('long pipelined mail from'); |
1673
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
281 $s->ok('long pipelined rcpt to'); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
282 $s->ok('long pipelined rcpt to 2'); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
283 $s->ok('long pipelined rcpt to 3'); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
284 $s->ok('long pipelined rcpt to 4'); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
285 $s->ok('long pipelined rset'); |
7d40f2557a45
Tests: added smtp_client_buffer test.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
286 |
1952
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
287 # Pipelining longer than smtp_client_buffer, with |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
288 # extra pipelined commands to be processed by nginx itself |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
289 |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
290 $s = Test::Nginx::SMTP->new(PeerAddr => '127.0.0.1:' . port(8027)); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
291 $s->read(); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
292 $s->send('EHLO example.com'); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
293 $s->read(); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
294 |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
295 $s->send('MAIL FROM:<test@example.com> FOO=' . ('X' x 90) . CRLF |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
296 . 'RCPT TO:<test@example.com>' . CRLF |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
297 . 'RSET'); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
298 |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
299 $s->read(); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
300 $s->ok('pipelined long rcpt to'); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
301 $s->ok('pipelined long rset'); |
92d90cc5f5e5
Tests: test for long commands with SMTP pipelining.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1937
diff
changeset
|
302 |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
303 # Connection must stay even if error returned to rcpt to command |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
304 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
305 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
306 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
307 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
308 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
309 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
310 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
311 $s->read(); # skip mail from reply |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
312 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
313 $s->send('RCPT TO:<example.com>'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
314 $s->check(qr/^5.. /, "bad rcpt to"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
315 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
316 $s->send('RCPT TO:<test@example.com>'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
317 $s->ok('good rcpt to'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
318 |
343
e7dc8f4d0a4b
Tests: whitespace and spelling fixes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
319 # Make sure command split into many packets processed correctly |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
320 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
321 $s = Test::Nginx::SMTP->new(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
322 $s->read(); |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
323 |
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
324 $s->print('HEL'); |
1682
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
325 select undef, undef, undef, 0.1; |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
326 $s->send('O example.com'); |
343
e7dc8f4d0a4b
Tests: whitespace and spelling fixes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
327 $s->ok('split command'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
328 |
1682
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
329 # Invalid command split into many packets |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
330 |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
331 $s = Test::Nginx::SMTP->new(); |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
332 $s->read(); |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
333 |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
334 $s->print('FOO B'); |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
335 select undef, undef, undef, 0.1; |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
336 $s->send('AR'); |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
337 $s->check(qr/^5.. /, 'invalid split command'); |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
338 |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
339 $s->send('HELO example.com'); |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
340 $s->ok('good after invalid split command'); |
57ff83315818
Tests: test for invalid SMTP commands split between packets.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1681
diff
changeset
|
341 |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
342 ############################################################################### |