Help for this page

Select Code to Download


  1. or download this
    use Net::SSLeay qw( die_now die_if_ssl_error );
    Net::SSLeay::load_error_strings();
    ...
    eval 'no warnings "redefine";
          sub Net::SSLeay::randomize (;$$) {}
         '; die $@ if $@;
    
  2. or download this
      my $socket = IO::Socket::INET->new(
        PeerAddr => $host,
    ...
        AutoFlush => 1,
        Blocking => 0,
        Proto => 'tcp' ) or die "can't connect to https server";
    
  3. or download this
    my $ctx = Net::SSLeay::CTX_new() 
      or die("Failed to create SSL_CTX $!");
    ...
      and ssl_check_die("ssl ctx set options");
    my $ssl = Net::SSLeay::new($ctx) 
      or die_now("Failed to create SSL $!");
    
  4. or download this
    sub ssl_get_error {
      my $errors = "";
    ...
      die "${message}: ${errors}" if @$errnos;
      return;
    }
    
  5. or download this
    Net::SSLeay::set_fd($ssl, fileno($socket));
    my $res = Net::SSLeay::connect($ssl) 
    ...
      # that changes the "select" handler for the socket for the next
      # phase (writing the data).
    }
    
  6. or download this
    my $written = $ssl->write(substr($cur_buff, $cur_count));
    if($written <= 0){
    ...
      ### Here is where code specific to select dispatcher 
      ### must determine whether we have written all the data...
    }
    
  7. or download this
    my $res = CORE::shutdown $socket, 1;
    
  8. or download this
    my $rb = $ssl->read(16384);
    ssl_check_die("SSL read");
    ...
        ## you have read some data in $rb -- do something with it
      }
    }
    
  9. or download this
    Net::SSLeay::free($ssl);
    Net::SSLeay::CTX_free($ctx);
    $socket->close();