Mercurial > hg > nginx-tests
comparison ssl_certificate.t @ 1477:8b122b35703b
Tests: fixed session reuse tests in ssl_certificate.t with TLSv1.3.
Previously, session data was retrieved too early, before server passed
application data, which usually means NewSessionTicket is not yet sent.
The fix is to ask server for application data, then retrieve a session.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 20 May 2019 16:00:40 +0300 |
parents | 889283abadf8 |
children | dbce8fb5f5f8 |
comparison
equal
deleted
inserted
replaced
1476:e8ba4ae5e3ac | 1477:8b122b35703b |
---|---|
178 | 178 |
179 like(get('password', 8083), qr/password/, 'ssl_password_file'); | 179 like(get('password', 8083), qr/password/, 'ssl_password_file'); |
180 | 180 |
181 # session reuse | 181 # session reuse |
182 | 182 |
183 my ($s, $ssl) = get_ssl_socket('default', 8080); | 183 my ($s, $ssl) = get('default', 8080); |
184 my $ses = Net::SSLeay::get_session($ssl); | 184 my $ses = Net::SSLeay::get_session($ssl); |
185 | 185 |
186 like(get('default', 8080, $ses), qr/default:r/, 'session reused'); | 186 like(get('default', 8080, $ses), qr/default:r/, 'session reused'); |
187 like(get('default', 8081, $ses), qr/default:r/, 'session id context match'); | 187 like(get('default', 8081, $ses), qr/default:r/, 'session id context match'); |
188 like(get('default', 8082, $ses), qr/default:\./, 'session id context distinct'); | 188 like(get('default', 8082, $ses), qr/default:\./, 'session id context distinct'); |
199 my ($host, $port, $ctx) = @_; | 199 my ($host, $port, $ctx) = @_; |
200 my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return; | 200 my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return; |
201 Net::SSLeay::write($ssl, 'GET / HTTP/1.0' . CRLF . CRLF); | 201 Net::SSLeay::write($ssl, 'GET / HTTP/1.0' . CRLF . CRLF); |
202 my $r = Net::SSLeay::read($ssl); | 202 my $r = Net::SSLeay::read($ssl); |
203 $s->close(); | 203 $s->close(); |
204 return $r; | 204 return $r unless wantarray(); |
205 return ($s, $ssl); | |
205 } | 206 } |
206 | 207 |
207 sub cert { | 208 sub cert { |
208 my ($host, $port, $ctx) = @_; | 209 my ($host, $port, $ctx) = @_; |
209 my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return; | 210 my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return; |