… | |
… | |
654 | if (defined (my $buf = Net::SSLeay::BIO_read ($self->{tls_wbio}))) { |
654 | if (defined (my $buf = Net::SSLeay::BIO_read ($self->{tls_wbio}))) { |
655 | $self->{wbuf} .= $buf; |
655 | $self->{wbuf} .= $buf; |
656 | $self->_drain_wbuf; |
656 | $self->_drain_wbuf; |
657 | } |
657 | } |
658 | |
658 | |
659 | while () { |
|
|
660 | if (defined (my $buf = Net::SSLeay::read ($self->{tls}))) { |
659 | while (defined (my $buf = Net::SSLeay::read ($self->{tls}))) { |
661 | $self->{rbuf} .= $buf; |
660 | $self->{rbuf} .= $buf; |
662 | $self->_drain_rbuf; |
661 | $self->_drain_rbuf; |
663 | } elsif ( |
662 | } |
|
|
663 | |
|
|
664 | if ( |
664 | (my $err = Net::SSLeay::get_error ($self->{tls}, -1)) |
665 | (my $err = Net::SSLeay::get_error ($self->{tls}, -1)) |
665 | != Net::SSLeay::ERROR_WANT_READ () |
666 | != Net::SSLeay::ERROR_WANT_READ () |
666 | ) { |
667 | ) { |
667 | if ($err == Net::SSLeay::ERROR_SYSCALL ()) { |
668 | if ($err == Net::SSLeay::ERROR_SYSCALL ()) { |
668 | $self->error; |
669 | $self->error; |
669 | } elsif ($err == Net::SSLeay::ERROR_SSL ()) { |
670 | } elsif ($err == Net::SSLeay::ERROR_SSL ()) { |
670 | $! = &Errno::EIO; |
671 | $! = &Errno::EIO; |
671 | $self->error; |
672 | $self->error; |
672 | } |
|
|
673 | |
|
|
674 | last; |
|
|
675 | # all others are fine for our purposes |
|
|
676 | } else { |
|
|
677 | last; |
|
|
678 | } |
673 | } |
|
|
674 | |
|
|
675 | # all others are fine for our purposes |
679 | } |
676 | } |
680 | } |
677 | } |
681 | |
678 | |
682 | # TODO: maybe document... |
679 | # TODO: maybe document... |
683 | sub starttls { |
680 | sub starttls { |