… | |
… | |
600 | |
600 | |
601 | =cut |
601 | =cut |
602 | |
602 | |
603 | sub on_starttls { |
603 | sub on_starttls { |
604 | $_[0]{on_stoptls} = $_[1]; |
604 | $_[0]{on_stoptls} = $_[1]; |
|
|
605 | } |
|
|
606 | |
|
|
607 | =item $handle->rbuf_max ($max_octets) |
|
|
608 | |
|
|
609 | Configures the C<rbuf_max> setting (C<undef> disables it). |
|
|
610 | |
|
|
611 | =cut |
|
|
612 | |
|
|
613 | sub rbuf_max { |
|
|
614 | $_[0]{rbuf_max} = $_[1]; |
605 | } |
615 | } |
606 | |
616 | |
607 | ############################################################################# |
617 | ############################################################################# |
608 | |
618 | |
609 | =item $handle->timeout ($seconds) |
619 | =item $handle->timeout ($seconds) |
… | |
… | |
984 | |
994 | |
985 | # avoid recursion |
995 | # avoid recursion |
986 | return if $self->{_skip_drain_rbuf}; |
996 | return if $self->{_skip_drain_rbuf}; |
987 | local $self->{_skip_drain_rbuf} = 1; |
997 | local $self->{_skip_drain_rbuf} = 1; |
988 | |
998 | |
989 | if ( |
|
|
990 | defined $self->{rbuf_max} |
|
|
991 | && $self->{rbuf_max} < length $self->{rbuf} |
|
|
992 | ) { |
|
|
993 | $self->_error (Errno::ENOSPC, 1), return; |
|
|
994 | } |
|
|
995 | |
|
|
996 | while () { |
999 | while () { |
997 | # we need to use a separate tls read buffer, as we must not receive data while |
1000 | # we need to use a separate tls read buffer, as we must not receive data while |
998 | # we are draining the buffer, and this can only happen with TLS. |
1001 | # we are draining the buffer, and this can only happen with TLS. |
999 | $self->{rbuf} .= delete $self->{_tls_rbuf} |
1002 | $self->{rbuf} .= delete $self->{_tls_rbuf} |
1000 | if exists $self->{_tls_rbuf}; |
1003 | if exists $self->{_tls_rbuf}; |
… | |
… | |
1039 | $self->{on_eof} |
1042 | $self->{on_eof} |
1040 | ? $self->{on_eof}($self) |
1043 | ? $self->{on_eof}($self) |
1041 | : $self->_error (0, 1, "Unexpected end-of-file"); |
1044 | : $self->_error (0, 1, "Unexpected end-of-file"); |
1042 | |
1045 | |
1043 | return; |
1046 | return; |
|
|
1047 | } |
|
|
1048 | |
|
|
1049 | if ( |
|
|
1050 | defined $self->{rbuf_max} |
|
|
1051 | && $self->{rbuf_max} < length $self->{rbuf} |
|
|
1052 | ) { |
|
|
1053 | $self->_error (Errno::ENOSPC, 1), return; |
1044 | } |
1054 | } |
1045 | |
1055 | |
1046 | # may need to restart read watcher |
1056 | # may need to restart read watcher |
1047 | unless ($self->{_rw}) { |
1057 | unless ($self->{_rw}) { |
1048 | $self->start_read |
1058 | $self->start_read |