comparison lib/Test/Nginx/SMTP.pm @ 68:5f56040c39df

Tests: smtp xclient tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 03 Feb 2009 09:27:08 +0300
parents 11e33ba0656a
children 465a711ffa19
comparison
equal deleted inserted replaced
67:5d16f380cd75 68:5f56040c39df
86 while (my $client = $server->accept()) { 86 while (my $client = $server->accept()) {
87 $client->autoflush(1); 87 $client->autoflush(1);
88 print $client "220 fake esmtp server ready" . CRLF; 88 print $client "220 fake esmtp server ready" . CRLF;
89 89
90 while (<$client>) { 90 while (<$client>) {
91 Test::Nginx::log_core('||', $_);
92
91 if (/^quit/i) { 93 if (/^quit/i) {
92 print $client '221 quit ok' . CRLF; 94 print $client '221 quit ok' . CRLF;
93 } elsif (/^(ehlo|helo)/i) { 95 } elsif (/^(ehlo|helo)/i) {
94 print $client '250 hello ok' . CRLF; 96 print $client '250 hello ok' . CRLF;
95 } elsif (/^rset/i) { 97 } elsif (/^rset/i) {
100 print $client '250 mail from ok' . CRLF; 102 print $client '250 mail from ok' . CRLF;
101 } elsif (/^rcpt to:[^@]+$/i) { 103 } elsif (/^rcpt to:[^@]+$/i) {
102 print $client '500 rcpt to error' . CRLF; 104 print $client '500 rcpt to error' . CRLF;
103 } elsif (/^rcpt to:/i) { 105 } elsif (/^rcpt to:/i) {
104 print $client '250 rcpt to ok' . CRLF; 106 print $client '250 rcpt to ok' . CRLF;
107 } elsif (/^xclient/i) {
108 print $client '220 xclient ok' . CRLF;
105 } else { 109 } else {
106 print $client "500 unknown command" . CRLF; 110 print $client "500 unknown command" . CRLF;
107 } 111 }
108 } 112 }
109 113