I forgot to add an example of how I make a request:

curl -k "https://127.0.0.1:8443";

пятница, 2 июня 2017 г., 16:36:00 UTC+5 пользователь Alexey Stavrov написал:
>
> I have strange behavior (strange warnings) when use Mojo::IOLoop::TLS.
> I wrote minimal example of code.
>
> #!/usr/bin/perl
>
> use Mojo::Base -strict;
>
>
> use Mojo::IOLoop;
> use Mojo::IOLoop::TLS;
> use Mojo::IOLoop::Client;
> use Mojo::IOLoop::Server;
>
>
> #$IO::Socket::SSL::DEBUG = 3;
>
>
> my $server = Mojo::IOLoop::Server->new;
> my $client = Mojo::IOLoop::Client->new;
>
>
> my ($server_handle, $client_handle);
> my ($client_stream, $server_stream);
> my @tlss;
>
>
> sub upgrade_handle {
>   my ($handle, $is_server, $cb) = @_;
>   my $tls = Mojo::IOLoop::TLS->new($handle);
>   $tls->on(upgrade => sub { $cb->(pop) });
>   $tls->on(error => sub { warn pop });
>   $tls->negotiate(server => $is_server);
> }
>
>
> sub upgrade_handles {
>   Mojo::IOLoop->delay(
>     sub {
>       my $d = shift;
>
>
>       upgrade_handle($server_handle, 1, $d->begin(0));
>       upgrade_handle($client_handle, 0, $d->begin(0));
>     },
>     sub {
>       my ($d, $server_handle, $client_handle) = @_;
>
>
>       say 'YEAH';
>
>
>       Mojo::IOLoop->singleton->reactor->io($server_handle => sub {});
>       Mojo::IOLoop->singleton->reactor->io($client_handle => sub {});
>     }
>   );
> }
>
>
> $client->on(connect => sub {
>   $client_handle = pop;
>   Mojo::IOLoop->timer(0.1 => sub { upgrade_handles() });
> });
>
>
> $client->on(error => sub { warn pop });
>
>
> $server->on(error => sub { warn pop });
>
>
> $server->on(accept => sub {
>   $server_handle = pop;
>   $client->connect(address => 'www.yandex.ru', port => 443);
> });
>
>
> $server->listen(port => 8443);
> $server->start;
> Mojo::IOLoop->start;
>
> I get this output when I run it
>
>> $ perl 9.pl 
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> SSL accept attempt failed error:140760FC:SSL 
>> routines:SSL23_GET_CLIENT_HELLO:unknown protocol
>> YEAH
>> ^C
>> $ 
>
>
> This *error (warnings) is not stable* and to get it you have to *run the 
> script many times*.
>
> I have such development environment:
> perl - 5.22
> Mojolicious - 7.32
> IO::Socket::SSL - 2.048
> Net::SSLeay - 1.81
> openssl - 1.0.2g
>
> Does anyone had the same problem as me?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to