@@ -14,7 +14,7 @@ plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Moj
1414# openssl req -x509 -days 7300 -key ca.key -in ca.csr -out ca.crt
1515#
1616# openssl genrsa -out server.key 1024
17- # openssl req -new -key server.key -out server.csr -subj "/C=US/CN=127.0.0.1 "
17+ # openssl req -new -key server.key -out server.csr -subj "/C=US/CN=localhost "
1818# openssl x509 -req -days 7300 -in server.csr -out server.crt -CA ca.crt \
1919# -CAkey ca.key -CAcreateserial
2020#
@@ -36,7 +36,7 @@ utf8::upgrade $upgraded;
3636my ($server , $client );
3737my $promise = Mojo::Promise-> new-> ioloop($loop );
3838my $id = $loop -> server(
39- {address => ' 127.0.0.1 ' , tls => 1} => sub {
39+ {address => ' localhost ' , tls => 1} => sub {
4040 my ($loop , $stream ) = @_ ;
4141 $stream -> write ($upgraded => sub { shift -> write (' 321' ) });
4242 $stream -> on(close => sub { $promise -> resolve });
@@ -46,7 +46,7 @@ my $id = $loop->server(
4646my $port = $loop -> acceptor($id )-> port;
4747my $promise2 = Mojo::Promise-> new-> ioloop($loop );
4848$loop -> client(
49- {port => $port , tls => 1, tls_options => {SSL_verify_mode => 0x00}} => sub {
49+ {address => ' localhost ' , port => $port , tls => 1, tls_options => {SSL_verify_mode => 0x00}} => sub {
5050 my ($loop , $err , $stream ) = @_ ;
5151 $stream -> write (' tset' => sub { shift -> write (' 123' ) });
5252 $stream -> on(close => sub { $promise2 -> resolve });
@@ -64,7 +64,7 @@ my ($remove, $running, $timeout, $server_err, $server_close, $client_close);
6464Mojo::IOLoop-> remove(Mojo::IOLoop-> recurring(0 => sub { $remove ++ }));
6565$promise = Mojo::Promise-> new;
6666$id = Mojo::IOLoop-> server(
67- address => ' 127.0.0.1 ' ,
67+ address => ' localhost ' ,
6868 tls => 1,
6969 tls_ca => ' t/mojo/certs/ca.crt' ,
7070 tls_cert => ' t/mojo/certs/server.crt' ,
@@ -88,6 +88,7 @@ $id = Mojo::IOLoop->server(
8888$port = Mojo::IOLoop-> acceptor($id )-> port;
8989$promise2 = Mojo::Promise-> new;
9090Mojo::IOLoop-> client(
91+ address => ' localhost' ,
9192 port => $port ,
9293 tls => 1,
9394 tls_cert => ' t/mojo/certs/client.crt' ,
@@ -118,6 +119,7 @@ ok !$server_err, 'no error';
118119# Invalid client certificate
119120my $client_err ;
120121Mojo::IOLoop-> client(
122+ address => ' localhost' ,
121123 port => $port ,
122124 tls => 1,
123125 tls_cert => ' t/mojo/certs/bad.crt' ,
@@ -133,7 +135,7 @@ ok $client_err, 'has error';
133135# Missing client certificate
134136($server_err , $client_err ) = ();
135137Mojo::IOLoop-> client(
136- {port => $port , tls => 1} => sub {
138+ {address => ' localhost ' , port => $port , tls => 1} => sub {
137139 shift -> stop;
138140 $client_err = shift ;
139141 }
@@ -146,7 +148,7 @@ ok $client_err, 'has error';
146148$loop = Mojo::IOLoop-> new;
147149($server_err , $client_err ) = ();
148150$id = $loop -> server(
149- address => ' 127.0.0.1 ' ,
151+ address => ' localhost ' ,
150152 tls => 1,
151153 tls_ca => ' no cert' ,
152154 tls_cert => ' t/mojo/certs/server.crt' ,
@@ -155,6 +157,7 @@ $id = $loop->server(
155157);
156158$port = $loop -> acceptor($id )-> port;
157159$loop -> client(
160+ address => ' localhost' ,
158161 port => $port ,
159162 tls => 1,
160163 tls_cert => ' t/mojo/certs/client.crt' ,
@@ -173,7 +176,7 @@ ok $client_err, 'has error';
173176($client , $client_close ) = ();
174177$promise = Mojo::Promise-> new;
175178$id = Mojo::IOLoop-> server(
176- address => ' 127.0.0.1 ' ,
179+ address => ' localhost ' ,
177180 tls => 1,
178181 tls_ca => ' t/mojo/certs/ca.crt' ,
179182 tls_cert => ' t/mojo/certs/server.crt' ,
@@ -195,6 +198,7 @@ $id = Mojo::IOLoop->server(
195198$port = Mojo::IOLoop-> acceptor($id )-> port;
196199$promise2 = Mojo::Promise-> new;
197200Mojo::IOLoop-> client(
201+ address => ' localhost' ,
198202 port => $port ,
199203 tls => 1,
200204 tls_ca => ' t/mojo/certs/ca.crt' ,
@@ -227,17 +231,18 @@ ok !$server_err, 'no error';
227231$loop = Mojo::IOLoop-> new;
228232($server_err , $client_err ) = ();
229233$id = $loop -> server(
230- address => ' 127.0.0.1 ' ,
234+ address => ' localhost ' ,
231235 tls => 1,
232236 tls_cert => ' t/mojo/certs/bad.crt' ,
233237 tls_key => ' t/mojo/certs/bad.key' ,
234238 sub { $server_err = ' accepted' }
235239);
236240$port = $loop -> acceptor($id )-> port;
237241$loop -> client(
238- port => $port ,
239- tls => 1,
240- tls_ca => ' t/mojo/certs/ca.crt' ,
242+ address => ' localhost' ,
243+ port => $port ,
244+ tls => 1,
245+ tls_ca => ' t/mojo/certs/ca.crt' ,
241246 sub {
242247 shift -> stop;
243248 $client_err = shift ;
@@ -251,15 +256,15 @@ ok $client_err, 'has error';
251256$loop = Mojo::IOLoop-> new;
252257($server_err , $client_err ) = ();
253258$id = $loop -> server(
254- address => ' 127.0.0.1 ' ,
259+ address => ' localhost ' ,
255260 tls => 1,
256261 tls_cert => ' t/mojo/certs/bad.crt' ,
257262 tls_key => ' t/mojo/certs/bad.key' ,
258263 sub { $server_err = ' accepted' }
259264);
260265$port = $loop -> acceptor($id )-> port;
261266$loop -> client(
262- address => ' 127.0.0.1 ' ,
267+ address => ' localhost ' ,
263268 port => $port ,
264269 tls => 1,
265270 tls_ca => ' t/mojo/certs/ca.crt' ,
@@ -276,17 +281,18 @@ ok $client_err, 'has error';
276281$loop = Mojo::IOLoop-> new;
277282($server_err , $client_err ) = ();
278283$id = $loop -> server(
279- address => ' 127.0.0.1 ' ,
284+ address => ' localhost ' ,
280285 tls => 1,
281286 tls_cert => ' t/mojo/certs/bad.crt' ,
282287 tls_key => ' t/mojo/certs/bad.key' ,
283288 sub { $server_err = ' accepted' }
284289);
285290$port = $loop -> acceptor($id )-> port;
286291$loop -> client(
287- port => $port ,
288- tls => 1,
289- tls_ca => ' no cert' ,
292+ address => ' localhost' ,
293+ port => $port ,
294+ tls => 1,
295+ tls_ca => ' no cert' ,
290296 sub {
291297 shift -> stop;
292298 $client_err = shift ;
@@ -301,7 +307,7 @@ $loop = Mojo::IOLoop->new;
301307my ($cipher , $version );
302308($server , $client , $client_err ) = ();
303309$id = $loop -> server(
304- address => ' 127.0.0.1 ' ,
310+ address => ' localhost ' ,
305311 tls => 1,
306312 tls_ca => ' t/mojo/certs/ca.crt' ,
307313 tls_cert => ' t/mojo/certs/server.crt' ,
@@ -315,6 +321,7 @@ $id = $loop->server(
315321);
316322$port = $loop -> acceptor($id )-> port;
317323$loop -> client(
324+ address => ' localhost' ,
318325 port => $port ,
319326 tls => 1,
320327 tls_cert => ' t/mojo/certs/bad.crt' ,
@@ -340,7 +347,7 @@ is $cipher, $expect, "$expect has been negotiatied";
340347# Ignore missing client certificate
341348($server , $client , $client_err ) = ();
342349$id = Mojo::IOLoop-> server(
343- address => ' 127.0.0.1 ' ,
350+ address => ' localhost ' ,
344351 tls => 1,
345352 tls_ca => ' t/mojo/certs/ca.crt' ,
346353 tls_cert => ' t/mojo/certs/server.crt' ,
@@ -350,7 +357,7 @@ $id = Mojo::IOLoop->server(
350357);
351358$port = Mojo::IOLoop-> acceptor($id )-> port;
352359Mojo::IOLoop-> client(
353- {port => $port , tls => 1, tls_options => {SSL_verify_mode => 0x00}} => sub {
360+ {address => ' localhost ' , port => $port , tls => 1, tls_options => {SSL_verify_mode => 0x00}} => sub {
354361 shift -> stop;
355362 $client = ' connected' ;
356363 $client_err = shift ;
@@ -365,7 +372,7 @@ subtest 'ALPN' => sub {
365372 plan skip_all => ' ALPN support required!' unless IO::Socket::SSL-> can_alpn;
366373 my ($server_proto , $client_proto );
367374 $id = Mojo::IOLoop-> server(
368- address => ' 127.0.0.1 ' ,
375+ address => ' localhost ' ,
369376 tls => 1,
370377 tls_options => {SSL_alpn_protocols => [' foo' , ' bar' , ' baz' ]},
371378 sub {
@@ -376,6 +383,7 @@ subtest 'ALPN' => sub {
376383 );
377384 $port = Mojo::IOLoop-> acceptor($id )-> port;
378385 Mojo::IOLoop-> client(
386+ address => ' localhost' ,
379387 port => $port ,
380388 tls => 1,
381389 tls_options => {SSL_alpn_protocols => [' baz' , ' bar' ], SSL_verify_mode => 0x00},
0 commit comments