Package list libpoe-component-sslify-perl / 7ad6bbb
more doc tweaks Apocalypse 10 years ago
4 changed file(s) with 12 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
8282 $socket = Client_SSLify( $socket, undef, undef, $ctx );
8383
8484 NOTE: You can pass the callback anywhere in the arguments, we'll figure it out for you! If you want to call a POE event, please look
85 into the postback/callback stuff in POE::Session.
85 into the postback/callback stuff in L<POE::Session>.
8686
8787 $socket = Client_SSLify( $socket, $session->callback( 'got_connect' => @args ) );
8888
401401
402402 =func SSLify_GetStatus
403403
404 Returns the status of the SSL negotiation/handshake/connection.
404 Returns the status of the SSL negotiation/handshake/connection. See L<http://www.openssl.org/docs/ssl/SSL_connect.html#RETURN_VALUES>
405 for more info.
405406
406407 my $status = SSLify_GetStatus( $socket );
407 -1 = still in negotiation stage
408 -1 = still in negotiation stage ( or error )
408409 0 = internal SSL error, connection will be dead
409410 1 = negotiation successful
410411 =cut
5353 my $socket = eval { Server_SSLify( $_[ARG0], sub {
5454 my( $socket, $status, $errval ) = @_;
5555
56 pass( "SERVER: Got connect hook" );
56 pass( "SERVER: Got callback hook" );
5757 is( $status, 'OK', "SERVER: Status received from callback is OK" );
5858
5959 ## At this point, connection MUST be encrypted.
103103 my $socket = eval { Client_SSLify($_[ARG0], sub {
104104 my( $socket, $status, $errval ) = @_;
105105
106 pass( "CLIENT: Got connect hook" );
106 pass( "CLIENT: Got callback hook" );
107107 is( $status, 'OK', "CLIENT: Status received from callback is OK" );
108108
109109 ## At this point, connection MUST be encrypted.
8585 my $socket = eval { Client_SSLify($_[ARG0], sub {
8686 my( $socket, $status, $errval ) = @_;
8787
88 pass( "CLIENT: Got connect hook" );
88 pass( "CLIENT: Got callback hook" );
8989 is( $status, 'ERR', "CLIENT: Status received from callback is ERR - $errval" );
90 is( SSLify_GetStatus( $socket ), 0, "CLIENT: SSLify_GetStatus is error" );
9190
9291 $poe_kernel->post( 'myclient' => 'shutdown' );
9392 }) };
4848 my $socket = eval { Server_SSLify( $_[ARG0], sub {
4949 my( $socket, $status, $errval ) = @_;
5050
51 pass( "SERVER: Got connect hook" );
51 pass( "SERVER: Got callback hook" );
5252 is( $status, 'ERR', "SERVER: Status received from callback is ERR - $errval" );
53 is( SSLify_GetStatus( $socket ), 0, "SERVER: SSLify_GetStatus is error" );
5453
5554 $poe_kernel->post( 'myserver' => 'shutdown');
5655 } ) };
111110 # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :(
112111 my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ];
113112
113 # Since this test purposefully sends garbage, we expect a connection reset by peer
114 # not ok 7 - Got SERVER read error 104: Connection reset by peer
115
114116 # TODO are there other "errors" that is harmless?
115117 $error = "Normal disconnection" unless $error;
116118 my $msg = "Got CLIENT $syscall error $errno: $error";
117 unless ( $syscall eq 'read' and $errno == 0 ) {
119 unless ( $syscall eq 'read' and $errno == 104 ) {
118120 fail( $msg );
119121 } else {
120122 diag( $msg ) if $ENV{TEST_VERBOSE};