Skip to content

Commit 2f8407d

Browse files
committed
Tests: added basic ssl tests with dynamic certificate not found.
1 parent 0c41d6c commit 2f8407d

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

ssl_certificate.t

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ http {
120120
ssl_certificate $two.crt;
121121
ssl_certificate_key $two.key;
122122
}
123+
124+
server {
125+
listen 127.0.0.1:8084 ssl;
126+
server_name localhost;
127+
128+
ssl_certificate $ssl_server_name.crt;
129+
ssl_certificate_key $ssl_server_name.key;
130+
}
123131
}
124132
125133
EOF
@@ -155,7 +163,7 @@ foreach my $name ('pass') {
155163
$t->write_file('password_file', 'pass');
156164
$t->write_file('index.html', '');
157165

158-
$t->try_run('no ssl_certificate variables')->plan(10);
166+
$t->try_run('no ssl_certificate variables')->plan(11);
159167

160168
###############################################################################
161169

@@ -179,6 +187,12 @@ like(get('default', 8080, $ses), qr/default:r/, 'session reused');
179187
like(get('default', 8081, $ses), qr/default:r/, 'session id context match');
180188
like(get('default', 8082, $ses), qr/default:\./, 'session id context distinct');
181189

190+
# errors
191+
192+
Net::SSLeay::ERR_clear_error();
193+
get_ssl_socket('nx', 8084);
194+
ok(Net::SSLeay::ERR_peek_error(), 'no certificate');
195+
182196
###############################################################################
183197

184198
sub get {

stream_ssl_certificate.t

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ stream {
103103
ssl_certificate $two.crt;
104104
ssl_certificate_key $two.key;
105105
}
106+
107+
server {
108+
listen 127.0.0.1:8084 ssl;
109+
return $ssl_server_name:$ssl_session_reused;
110+
111+
ssl_certificate $ssl_server_name.crt;
112+
ssl_certificate_key $ssl_server_name.key;
113+
}
106114
}
107115
108116
EOF
@@ -138,7 +146,7 @@ foreach my $name ('pass') {
138146
$t->write_file('password_file', 'pass');
139147
$t->write_file('index.html', '');
140148

141-
$t->try_run('no ssl_certificate variables')->plan(6);
149+
$t->try_run('no ssl_certificate variables')->plan(7);
142150

143151
###############################################################################
144152

@@ -160,6 +168,12 @@ like(get('default', 8080, $ses), qr/:r/, 'session reused');
160168
like(get('default', 8081, $ses), qr/:r/, 'session id context match');
161169
like(get('default', 8082, $ses), qr/:\./, 'session id context distinct');
162170

171+
# errors
172+
173+
Net::SSLeay::ERR_clear_error();
174+
get_ssl_socket('nx', 8084);
175+
ok(Net::SSLeay::ERR_peek_error(), 'no certificate');
176+
163177
###############################################################################
164178

165179
sub get {

0 commit comments

Comments
 (0)